三層交換與路由的綜合配置經典案例1


模擬器可以模擬
 
# Simple lab
autostart = False
[localhost]
`7200`
p_w_picpath = D:\路由器\7200.bin # Full path to 7200 IOS p_w_picpath file. This is
the fully qualified path relative to the system running dynamips.
ram = 128 # Amount of Virtual RAM to allocate to each router
instance
nvram = 96 # Size of NVRAM
disk0 = 64 # Set size of PCMCIA ATA disk0
disk1 = 64 # Set size of PCMCIA ATA disk1
cnfg = None # Configuration file to import. This is the fully qualified
path relative to the system running dynamips.
confreg = 0x2102 # Set the configuration register
clock = 2 # Clock divisor (should no longer been needed as of
dynamips 0.2.5 RC1)
mmap = True # Set to false to use real memory rather than a disk file
for router vitural memory. Conserves RAM at the expense of performance.
Defaults to True
exec_area = 64 # Set the exec area size
`ROUTER r1`
model = 7200
f2/0 = NIO_gen_eth:\Device\NPF_{CA4642AB-4C39-4131-9968-
B653B0C61FD8}
#s1/0 = r2 s1/0
f0/0 = r2 f0/13
idlepc = 0x6072d4b4
`ROUTER r2`
model = 3640
console = 2001
p_w_picpath = D:\路由器\3640.bin
slot0 = NM-16ESW 注意這裏是16 個交換端口
f0/14 = r3 f0/0
f0/15 = r4 f0/0
idlepc = 0x604ec6d8
#f0/0 = r3 f0/0
#s1/1 = r3 s1/1
#idlepc = 0xffffffff80009f94
`ROUTER r3`
model = 7200
#f2/0 = r4 f2/0
#s1/0 = r4 s1/0
idlepc = 0xffffffff8000ae84
`ROUTER r4`
model = 7200
idlepc = 0x6072d2dc
#f0/0 = r5 f0/0
要求:分三個vlan,vlan2,vlan3 vlan 100.Vlan100 與路器通信,vlan2 網關爲192.168.2.1
vlan3 爲192.168.3.1 vlan100 爲192.168.1.1,路由器f0/0 接口爲192.168.1.1 。
怎麼配置才能讓pc1 pc2 能與外網通信。路由器配置與外網認爲以配置好.
配置命令
r1(config)#int f0/0
r1(config-if)#no sh
r1(config-if)#du fu
r1(config-if)#ip add 192.168.1.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#end
r1(config)#int lo0
r1(config-if)#ip add 1.1.1.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#end
配置vlan,將端口分入vlan
r2#vlan da
r2(vlan)#vlan 100 name 100
VLAN 100 added:
Name: 100
r2(vlan)#vlan 2 name 2
VLAN 2 modified:
Name: 2
r2(vlan)#vlan 3 name 3
VLAN 3 added:
Name: 3
r2(vlan)#exit
APPLY completed.
Exiting....
r2(config)#int vlan 100
r2(config-if)#ip add 192.168.1.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#int vlan 2
r2(config-if)#no sh
r2(config-if)#ip add 192.168.2.1 255.255.255.0
r2(config-if)#int vlan 3
r2(config-if)#ip add 192.168.3.1 255.255.255.0
r2(config-if)#no sh
r2(config-if)#end
r2(config)#int f0/13
r2(config-if)#no sh
r2(config-if)#du fu
r2(config-if)#sp 100
r2(config-if)#swi mode acc
r2(config-if)#swi acc vlan 100
r2(config-if)#end
r2(config)#int f0/14
r2(config-if)#no sh
r2(config-if)#du fu
r2(config-if)#sp 100
r2(config-if)#swi mode acc
r2(config-if)#swi acc vlan 2
r2(config-if)#int f0/15
r2(config-if)#no sh
r2(config-if)#du fu
r2(config-if)#sp 100
r2(config-if)#swi mode acc
r2(config-if)#swi acc vlan 3
r2(config-if)#end
R3 模擬pc,注意去路由功能,還有設置網關,地址。
r3(config)#no ip routi
r3(config)#int f0/0
r3(config-if)#no sh
r3(config-if)#du fu
r3(config-if)#ip add 192.168.2.2 255.255.255.0
r3(config-if)#end
r3(config)#ip default-g 192.168.2.1
r4(config)#no ip routi
r4(config)#int f0/0
r4(config-if)#no sh
r4(config-if)#du fu
r4(config-if)#ip add 192.168.3.2 255.255.255.0
r4(config-if)#no sh
r4(config-if)#end
r4(config)#ip default-g 192.168.3.1
在這裏設置完成,但是能ping 通網關ping 不通對vlan2 的主機,原因沒有打開交換機的
路由功能。在高端交換機,路由功能是默認打開,但是35 等是關閉。手工打開。
r4#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max =
8/24/40 ms
r4#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2
seconds:
.....
Success rate is 0 percent (0/5)
r2(config)#ip routi
路由功能打開,可以ping 通vlan 主機。
r4#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max =
8/34/68 ms
但是ping 不通路由器的地址。因爲交換機沒有到達路由器的路由。
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)
設置到達路由器的靜態路由。
r2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
r2(config)#end
設置路由器到達交換機的兩條回程路由。不然,pc 直能有去的路由,沒有回來的路由。仍
然不通。
r1#conf t
r1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
r1(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.2
r1(config)#end
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 =
16/38/60 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 100 percent (5/5), round-trip min/avg/max =
32/54/68 ms
在這個實驗中,兩點應當注意,就是交換機與路由器上的幾個靜態路由。當然,路由器要與
外面通信,還要配置接口地址,還要配置nat。三層交換機不能直接與外網通信的一個主要問題就是不支持nat
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章