两台主机之间的通讯过程:
First, host A sends a data packet to B, and B responds after receiving the data packet. After the response is completed, the link is established.
查看路由条目信息方法:
[root@oldboyedu-sh01 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.0.0.2 0.0.0.0 UG 0 0 0 eth0
Note: The last entry in the routing table is a static default gateway route
[root@oldboyedu-sh01 ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
[root@chenleilei ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.0.0.2 0.0.0.0 UG 0 0 0 eth0
[root@chenleilei ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 10.0.0.2 0.0.0.0 UG 0 0 0 eth0
If you want to get other network segments but there is no routing entry, how to add:
1. Statically add routing entry
Static routing:
2. Dynamically add routing entries
Dynamic routing:
OSI reference model:
Application layer application program and interface
Presentation layer data conversion, encryption and compression
Session layer establishment, management and termination of session
Transport layer provides reliable end-
to -end warm transmission and differential control Interconnection
Data link layer encapsulates packet data into frames, providing point-to-point transmission
Physical layer creates bits on the medium; provides mechanical and electrical protocols