Can't stop questioning!

IP and Routing in Linux

Tuyen D. Le September 03, 2023 [Server] #ip #routing

IP

# Assign static IP for Ubuntu 14, 16
$ sudo vim /etc/network/interfaces

iface eno1 inet static
        address 172.16.10.113
        netmask 255.255.255.0
        gateway 172.16.10.1
        dns-nameservers 8.8.8.8
        up ip route add 10.10.1.0/24 via 172.16.10.1
        up ip -6 addr add 2001::2/64 dev eno1

Commonly used IP addresses:

Route trong Linux

route -n

or ip route show

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.254   0.0.0.0         UG    100    0        0 eno16777736
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eno16777736
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Flags:

route add

Indivisual host DestinationSubnet Destionation
route add -net 205.192.25.0 netmask 255.255.255.0 dev eth3route add -net 205.192.25.0/24 gw 203.162.5.1
route -nroute -n
205.192.25.0 0.0.0.0 U eth3 205.192.25.0 203.162.5.1 UG eth3
When you want to send a package to IP 205.192.25.5,
Des. IP: 205.192.25.5Des. IP: 205.192.25.5
Des. Mac: ARP who is 205.192.25.5Des. Mac: ARP who is 203.162.5.1

How is the travel packet in the network?

goi-tin-travel-trong-mang

No.IP src.IP des.MAC src.MAC des.
1192.168.10.2172.16.0.100E3401
2192.168.10.2172.16.0.10402B01
3192.168.10.2172.16.0.10B02224

Conclude