Showing posts with label internet. Show all posts
Showing posts with label internet. Show all posts

Monday, June 9, 2025

MikroTik

Check Network card

 /interface print

set ip for nat card

/ip dhcp-client add interface=ether3 disabled=no
show status
/ip dhcp-client print

set ip for exit card
/ip address add address=192.168.137.1/24 interface=ether4

/ip pool add name=dhcp_pool_ether4 ranges=192.168.137.10-192.168.137.100
/ip dhcp-server network add address=192.168.137.0/24 gateway=192.168.137.1 dns-server=8.8.8.8
/ip dhcp-server add name=dhcp_ether4 interface=ether4 address-pool=dhcp_pool_ether4 disabled=no
show lease
/ip dhcp-server lease print

share
/ip firewall nat add chain=srcnat out-interface=ether3 action=masquerade

/system package update check-for-updates

/system package update download

Saturday, June 7, 2025

Debian 12 to share internet

1. Download The Debian Bookworm network installation CD

2. install follow steps and on set software unselect all

note command to see network

   ip a

3 sudo nano /etc/network/interfaces


3.1 sudo systemctl restart networking
3.2 echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
3.3 sudo nano /etc/sysctl.conf
    uncomment #
    net.ipv4.ip_forward=1
3.4 sudo sysctl -p
3.5 
sudo iptables -t nat -A POSTROUTING -o enx000ec6c29c18-j MASQUERADE
sudo iptables -A FORWARD -i ens33 -o enx000ec6c29c18 -j ACCEPT
sudo iptables -A FORWARD -i enx000ec6c29c18 -o ens33 -m state --state RELATED,ESTABLISHED -j ACCEPT
3.6 sudo apt install iptables-persistent


sudo nano /etc/apt/sources.list


sudo apt update && sudo apt upgrade
sudo apt install open-vm-tools isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf

sudo nano /etc/default/isc-dhcp-server

sudo systemctl restart isc-dhcp-server

  sudo systemctl enable isc-dhcp-server

8 sudo crontab -e

select nano

0 3 * * * /sbin/shutdown -r now

Thursday, September 28, 2023

tinycore15 share internet add pxeserver support

 tce-update

 tce-load -wi dnsmaq

 tce-load -wi ipv6-netfilter-6.6.8-tinycore

 tce-load -wi iptables


/opt/bootlocal.sh

#!/bin/sh

# put other system startup commands here

/opt/eth1.sh &

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE &

sudo iptables -A FORWARD -i eth1 -j ACCEPT &

sudo dnsmasq &

sudo sysctl -w net.ipv4.ip_forward=1 &

         sudo crond &


/opt/eth1.sh

#!/bin/sh


# If you are booting Tiny Core from a very fast storage such as SSD / NVMe Drive and getting 

# "ifconfig: SIOCSIFADDR: No such Device" or "route: SIOCADDRT: Network is unreachable"

# error during system boot, use this sleep statemet, otherwise you can remove it -

sleep 1


# kill dhcp client for eth1

sleep 1

if [ -f /var/run/udhcpc.eth1.pid ]; then

sudo kill `cat /var/run/udhcpc.eth1.pid`

sleep 1

fi


# configure interface eth1

sudo ifconfig eth1 192.168.137.1 netmask 255.255.255.0 broadcast 192.168.137.255 up


# Start the DHCP Server Process once the Interface is Ready with the IP Add

sleep 1

sudo udhcpd /etc/eth1_udhcpd.conf &

         sudo udpsvd -E 0 69 tftpd /netboot 

 

/etc/eth1_udhcpd.conf

max_leases 101

lease_file /opt/udhcpd.leases

start 192.168.137.100

end 192.168.137.200

interface eth1

         boot_file /pxelinux.0

         option tftp 192.168.137.1 

option subnet 255.255.255.0

option router 192.168.137.1

option lease 43200

option dns 192.168.137.1

option domain local

 

/opt/.filetool.lst

opt

home

         /netboot 

/etc/eth1_udhcpd.conf

        /var/spool/crond/crontabs/root 

/var/spool/crond/crontabs/root 

    SHELL=/bin/sh

    15 22 * * * /sbin/reboot > /tmp/reboot.log 2>&1

After

    filetool.sh -b

PXE server

    mkdir -p /netboot/pxelinux.cfg

    /netboot/tc/core.gz

    /netboot/tc/vmlinz

    /netboot/pxelinux.0      --> from sysliux

/netboot/pxelinux.cfg/default

    DEFAULT core

    TIMEOUT 300

    

    LABEL core

        KERNEL /tc/vmlinuz

        APPEND quiet initrd=/tc/core.gz

ln -s /netboot/pxelinux.0 /netboot/pxelinux.0     --> bug busybox udhcpd


how to update 14->15

/mnt/sda1/tce/boot/
replace corepure64.gz and vmlinuz64 to new version
1 rm corepure64.gz
2 rm vmlinuz64
3 wget http://tinycorelinux.net/16.x/x86_64/release/distribution_files/corepure64.gz
4 wget http://tinycorelinux.net/16.x/x86_64/release/distribution_files/vmlinuz64
5.tce-update
remove old extension
    /etc/sysconfig/tcedir/optional/
install new use
tce
s = search extension
ipv6
select menu and show detail extension
q = quit to menu
i = install

Monday, November 28, 2022

SET NETWORK BUT REBOOT LOST!

sudo ip link show


 sudo ip link set dev eth0 down

sudo dhclient eth0

This will bring your eth0 up by using DHCP. Your network is now configured (for the time being).

If you don't have DHCP enabled configure your network by issueing the commands below, the gateway address is the IP address of your router. And your IP should be in the same range as the router is.

sudo ip addr add 192.168.1.14/24 dev eth0
sudo ip link set dev eth0 up
sudo ip route add default via 192.168.1.1

Wednesday, February 12, 2014

ubuntu share internet

Before I begin this post, I want to thank Internet Connection Sharing – Ubuntu 10.04 NAT Gateway Setup (Abridged Version) for providing the bulk of the tutorial. I have made some modifications for Ubuntu 12.04.
The setup is simple: a single Ubuntu server will act as a gateway and DHCP server for a local network. All other machines on the local network will receive their IPs from the DHCP server. To make things easier, I’ll call this Ubuntu server “Skyray” for the rest of the post.
Skyray has two network interfaces, eth0 and eth1. eth0 is on the 10.20.30.0/24 subnet and this is the Internet facing interface. eth1 is on the 172.22.22.0/24 subnet, where all other machines are also present. Basically, eth0 will connect to the Internet and eth1 will serve DHCP requests and act as the gateway.

/etc/network/interfaces

First you need to configure eth0 and eth1 for Skyray. Edit the file and make sure it has at least the following settings (or whatever settings are appropriate for your environment).
sudo vim /etc/network/interfaces
(:wq save and quit, i insert mode , esc exit insert mode, :q! exit not save)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 192.168.10.1
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255

/etc/sysctl.conf

You need to enable IPv4 forwarding. To do so, edit this file.
sudo vim /etc/sysctl.conf
And uncomment the line
# net.ipv4.ip_forward=1
so that it now appears as
net.ipv4.ip_forward=1
Save the file and run the following command to make the change effective without a reboot.
sudo sysctl -w net.ipv4.ip_forward=1

/etc/rc.local

You’ll need to allow iptables rules for NAT to work. Edit the file and save it.
sudo vim /etc/rc.local
Make sure the following two lines appear before the exit 0 line in the file.
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
To make these iptables rules active without rebooting, run the following commands:
sudo iptables -P FORWARD ACCEPT
sudo iptables –-table nat -A POSTROUTING -o eth0 -j MASQUERADE