网络技术-利用静态路由实现网络互通-3(1)
已补
1,利用静态路由实现网络互通(两个公司互相通信)
完整图:
2,配置路由器
2.1,此时可以看到电脑和路由器之间是红色的,即不可通信,解决:
Router(config)#interface fa0/0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
2.2,此时ping本机IP即可正常通信
2.3,分别启用两台路由器的serial 0/0/0接口
Router(config)#interface serial 0/0/0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
2.4,设置路由器的网关
路由器0
Router(config)#interface fa 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0 # 设置此IP地址为本网段的网关
路由器1
Router(config)#interface fa0/0
Router(config-if)#ip address 10.1.1.1 255.255.255.0
此时,PC电脑即可与路由器通信
2.5,配置路由表(路由表是表达到达目的地的下一跳地址)
路线0:
Router(config)#ip route 10.1.1.0 255.255.255.0 2.2.2.2
路线1:
Router(config)#ip route 192.168.1.0 255.255.255.0 2.2.2.3
此时,即可相互通信:
PC>ping 10.1.1.5
Pinging 10.1.1.5 with 32 bytes of data:
Reply from 10.1.1.5: bytes=32 time=11ms TTL=126
Reply from 10.1.1.5: bytes=32 time=8ms TTL=126
Reply from 10.1.1.5: bytes=32 time=3ms TTL=126
Reply from 10.1.1.5: bytes=32 time=7ms TTL=126
Ping statistics for 10.1.1.5:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 11ms, Average = 7ms
PC>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=10ms TTL=255
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 10ms, Average = 2ms
PC>ping 2.2.2.2
Pinging 2.2.2.2 with 32 bytes of data:
Reply from 2.2.2.2: bytes=32 time=1ms TTL=255
Reply from 2.2.2.2: bytes=32 time=0ms TTL=255
Reply from 2.2.2.2: bytes=32 time=0ms TTL=255
Reply from 2.2.2.2: bytes=32 time=0ms TTL=255
Ping statistics for 2.2.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC>ping 2.2.2.3
Pinging 2.2.2.3 with 32 bytes of data:
Reply from 2.2.2.3: bytes=32 time=6ms TTL=254
Reply from 2.2.2.3: bytes=32 time=3ms TTL=254
Reply from 2.2.2.3: bytes=32 time=17ms TTL=254
Reply from 2.2.2.3: bytes=32 time=3ms TTL=254
Ping statistics for 2.2.2.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 17ms, Average = 7ms
PC>ping 10.1.1.0
Pinging 10.1.1.0 with 32 bytes of data:
Reply from 2.2.2.3: bytes=32 time=4ms TTL=254
Reply from 2.2.2.3: bytes=32 time=1ms TTL=254
Reply from 2.2.2.3: bytes=32 time=3ms TTL=254
Reply from 2.2.2.3: bytes=32 time=6ms TTL=254
Ping statistics for 10.1.1.0:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 6ms, Average = 3ms
PC>ping 10.1.1.1
Pinging 10.1.1.1 with 32 bytes of data:
Reply from 10.1.1.1: bytes=32 time=4ms TTL=254
Reply from 10.1.1.1: bytes=32 time=9ms TTL=254
Reply from 10.1.1.1: bytes=32 time=12ms TTL=254
Reply from 10.1.1.1: bytes=32 time=22ms TTL=254
Ping statistics for 10.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 4ms, Maximum = 22ms, Average = 11ms
PC>ping 10.1.1.5
Pinging 10.1.1.5 with 32 bytes of data:
Reply from 10.1.1.5: bytes=32 time=2ms TTL=126
Reply from 10.1.1.5: bytes=32 time=3ms TTL=126
Reply from 10.1.1.5: bytes=32 time=1ms TTL=126
Reply from 10.1.1.5: bytes=32 time=12ms TTL=126
Ping statistics for 10.1.1.5:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 12ms, Average = 4
好!!!