使用默认缺省路由让PCA网络访问internet:
[RTA]interface S6/0
ip address 192.168.1.1 24
interface g0/0
ip address 192.168.3.1
[RTB]interface S6/0
ip address 192.168.1.2 24
interface g0/0
ip address 192.168.2.1 24
ip route-static 192.168.3.0 255.255.255.0 192.168.1.1
PCA:192.168.3.2 255.255.255.0
PCB:192.168.2.2 255.255.255.0
现在如果PCA所在网段属于私网,想要访问公网PCB,此时可在RTA上做一条静态缺省路由:
[RTA]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2 缺省路由使用0来匹配,因为不是点到点串口连接所以使用下一跳地址作为出口。
此时PCA能够访问internetPCB:
C:\Documents and Settings\xiaofei>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 12.1.1.2: bytes=32 time=1ms TTL=254 Reply from 12.1.1.2: bytes=32 time=2ms TTL=254 Reply from 12.1.1.2: bytes=32 time=1ms TTL=254 Reply from 12.1.1.2: bytes=32 time=1ms TTL=254
Ping statistics for 192.168.2.2: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 2ms, Average = 1ms