三层交换与路由的综合配置经典案例2

三层交换与路由的综合配置经典案例2_第1张图片
 
 
第一步先配置r5 与r1 相互通信
r5(config)#int s1/0
r5(config-if)#no sh
r5(config-if)#ip add 1.1.1.1 255.255.255.0
r5(config-if)#no sh
r5(config-if)#end
r1(config)#int s1/0
r1(config-if)#no sh
r1(config-if)#ip add 1.1.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#ip nat outside
r1(config)#int f0/0
r1(config-if)#no sh
r1(config-if)#ip add 192.168.1.1 255.255.255.0
r1(config-if)#ip nat inside
r1(config-if)#du fu
r2(config)#int f0/13
r2(config-if)#no sh
r2(config-if)#no swi
r2(config-if)#ip add 192.168.1.2 255.255.255.0
r2(config-if)#exit
r2(config)#exit
r2#vlan da
r2(vlan)#vlan 10 name 10
VLAN 10 added:
Name: 10
r2(vlan)#vlan 20 name 20
VLAN 20 added:
Name: 20
r2(vlan)#exit
r2(config)#int vlan 10
r2(config-if)#no sh
r2(config-if)#ip add 192.168.10.1 255.255.255.0
r2(config-if)#int vlan 20
r2(config-if)#ip add 192.168.20.1 255.255.255.0
r2(config-if)#exit
r2(config)#int f0/14
r2(config-if)#no sh
r2(config-if)#int f0/15
r2(config-if)#swi mode acc
r2(config-if)#swi acc vlan 20
r2(config-if)#no sh
r2(config-if)#end
r2(config)#ip default-g 192.168.1.1 设置默认网关
r2(config)#ip routi 打开三层路由。
r3(config)#int f0/0
r3(config-if)#no sh
r3(config-if)#ip add 192.168.10.2 255.255.255.0
r3(config-if)#end
r3(config)#no ip routi
r3(config)#end
r3(config)#ip default-g 192.168.10.1 模拟pc 的网关
r3(config)#end
r4(config)#int f0/0
r4(config-if)#no sh
r4(config-if)#ip add 192.168.20.2 255.255.255.0
r4(config-if)#no sh
r4(config-if)#end
r4(config)#no ip routi
r4(config)#ip default-g 192.168.20.1
r2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1 能访问外网的路由
r4#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is
2 seconds:
.....
Success rate is 0 percent (0/5)
r1(config)#ip route 192.168.0.0 255.255.0.0 192.168.1.2 路由的回程路由。
r4#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is
2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max
= 32/81/128 ms
r4#ping 1.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.2, timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max
= 32/66/96 ms
r4#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2
seconds:
.....
Success rate is 0 percent (0/5)
做nat 能访问外网。
r1(config)#access-list 101 permit ip 192.168.0.0 0.0.255.255 any
限制那些主机能访问外网
端口转换
r1(config)#ip nat source list 101 interface s1/0 overload
*Jan 14 18:43:54.659: %SYS-2-MALLOCFAIL: Memory
allocation of 3000 bytes failed from 0x6141B704,
alignment 0
Pool: Processor Free: 10716 Cause: Memory fragmentation
Alternate Pool: None Free: 0 Cause: No Alternate pool
-Process= "Exec", ipl= 0, pid= 72 -Traceback= 0x613D2874
.......
 

你可能感兴趣的:(配置,案例,经典,休闲,三层)