用静态路由及RIP实现不同网段之间互访
用静态路由及RIP实现不同网段之间互访
路由器jtwh f0/0: 192.168.23.1 lo0:10.10.10.0 f0/1:为外网地址218.108.32.208/29 路由器jtwh2 f0/0:192.168.23.2 lo0:10.10.20.0
一静态
jtwh>en
jtwh#conf t
jtwh(config)#int lo0
jtwh(config-if)#ip add 10.10.10.1 255.255.255.0
jtwh(config-if)#int f0/0
jtwh(config-if)#no sh
jtwh(config-if)#ip add 192.168.23.1 255.255.255.0
jtwh(config-if)#end
jtwh#conf t
jtwh(config)#ip route 10.10.20.0 255.255.255.0 192.168.23.2 //静态指向
jtwh(config)#end
jtwh#shiproute //查看路由表
......
Gateway of last resort is 218.108.32.209 to network 0.0.0.0
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.10.0 is directly connected, Loopback0
C 192.168.23.0/24 is directly connected, FastEthernet0/0
C 218.108.32.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 [1/0] via 218.108.32.209
测试ping
jtwh#ping 10.10.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/78 ms
jtwh2>en
jtwh2#conf t
jtwh2(config)#int lo0
jtwh2(config-if)#ip add 10.10.10.1 255.255.255.0
jtwh2(config-if)#int f0/0
jtwh2(config-if)#no sh
jtwh2(config-if)#ip add 192.168.23.1 255.255.255.0
jtwh2(config-if)#end
jtwh2#conf t
jtwh2(config)#ip route 10.10.10.0 255.255.255.0 192.168.23.1
测试ping
jtwh2#ping 10.10.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/64 ms
二 RIP
jtwh#conf t
jtwh(config)#no ip route 10.10.20.0 255.255.255.0 192.168.23.2 删除之前的静态 jtwh(config)#router rip 启用RIPV2 jtwh(config-router)#ver 2
jtwh(config-router)#no au 关闭自动汇总 jtwh(config-router)#net 10.10.10.0 发布网段
jtwh#ship route
......
Gateway of last resort is 218.108.32.209 to network 0.0.0.0
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.10.0 is directly connected, Loopback0
C 192.168.23.0/24 is directly connected, FastEthernet0/0
C 218.108.32.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 [1/0] via 218.108.32.209
jtwh#ping 10.10.20.1 ping测试
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.20.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 49/59/63 ms
jtwh2#conf t
jtwh2(config)#no ip route 10.10.10.0 255.255.255.0 192.168.23.1 jtwh2(config)#router rip
jtwh2(config-router)#ver 2
jtwh2(config-router)#no au
jtwh2(config-router)#net 10.10.10.0
jtwh2#sh iprou
......
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.20.0 is directly connected, Loopback0
C 192.168.23.0/24 is directly connected, FastEthernet0/0
jtwh2#ping 10.10.10.1 ping 测试
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms