Detailed explanation of Linux routing table

1. Execute the route command under Linux
[root@localhost backup]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 enp0s3
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
 
[root@localhost backup]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default gateway 0.0.0.0 UG 100 0 0 enp0s3
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
 
Detailed explanation of the two route commands
1. Command syntax
route [-n]
Options and parameters:
-n: Display the hostname as an IP
 
2. Analysis of query results
Destination : In fact, it means Network.
Gateway : It is the IP of the gateway of the interface. If it is 0.0.0.0, it means that no additional IP is required.
Genmask: It is Netmask, which is combined with Destination to form a host or network.
Flags: There are multiple flags that can represent the meaning of the network or host.
                                U: Indicates that the route is available.
                        G: The representative needs to go through the Gateway to help deliver it.
                        H: Indicates that the line is routed to a host, not a network.
Iface: It means the interface (interface).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326488439&siteId=291194637