/etc/network/interfacese

auto eth0               #for activating interface
iface eth0 inet <static/dhcp>            
address 192.168.1.1            #IP address.
netmask 255.255.255.0              #subnet mask.
gateway 192.168.10.10               #is used to define the default gateway for the eth0 interface.

Enable routing

#echo 1 > /proc/sys/net/ipv4/ip_forward

Applying the Configuration

#service networking restart

Set Temporary addresses

#iface eth0 192.168.1.1/24 up

DNS

/etc/resolve.conf

nameserver 8.8.8.8
nameserver 9.9.9.9

Routing

List main route table

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         113.30.150.254  0.0.0.0         UG    0      0        0 eth0
113.30.150.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.10.10.128    0.0.0.0         255.255.255.192 U     0      0        0 br0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

Add/Delete Routes Temporary

# route add -host 10.10.10.129 dev eth1
# route add -net 10.10.10.128/26 dev eth0
# route add -net 172.16.10.1/24 gw 10.10.10.130
# route del -net 192.168.1.0/24 dev eth1
# route del default
# route add default gw 10.10.10.129 dev Ethan

Leave a Reply

Your email address will not be published. Required fields are marked *