IP 是 TCP/IP 协议族中最为核心的协议. 所有的 TCP,UDP,ICMP,IGMP 数据都是以 IP 数据报格式传输.
1. IP 协议特点
IP 协议的特点是, 提供不可靠, 无连接的数据报传送服务.
不可靠, 它不能保证 IP 数据报能成功地到达目的地. 任何要求的可靠性必须由上层来提供 (如 TCP).
无连接, IP 并不维护任何关于后续数据报的状态信息. 每个数据报的处理是相互独立的.
三个有用的命令: ifconfig,netstat,route
IP 协议要求在网络中传输时要求以 big endian 字节序, 即网络字节序. 在传输数据前必须转换成网络字节序.
2. IP 路由选择
2.1 路由表
- # 查看和修改 IP 路由表
- route - show / manipulate the IP routing table
1) route 命令
- [root@thor ]# route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- default 10.66.91.254 0.0.0.0 UG 0 0 0 bond0
- 10.66.91.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
- link-local 0.0.0.0 255.255.0.0 U 1004 0 0 bond0
- 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
2)netstat -r 命令
- [root@thor ]# netstat -r
- Kernel IP routing table
- Destination Gateway Genmask Flags MSS Window irtt Iface
- default 10.66.91.254 0.0.0.0 UG 0 0 0 bond0
- 10.66.91.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
- link-local 0.0.0.0 255.255.0.0 U 0 0 0 bond0
- 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
2.2 IP 路由选择过程
来源: http://www.bubuko.com/infodetail-2763136.html