VLAN路由實驗

茶茶奶孩發表於2020-11-05

實驗拓撲

在這裡插入圖片描述

實驗需求

1.配置拓撲圖交換機的埠IP地址
2.SW1和SW4 ,SW3和SW5相連的介面配置trunck鏈路,並允許vlan10和vlan20通過
3.SW1和SW2執行RIP,SW2和SW3執行OSPF,OSPF配置換回路口作為RID
4.業務網段不允許出現協議報文;不允許出現多餘的協議報文
5.在SW2上引入RIP和OSPF的路由引入

實驗過程

首先各交換機配置vlan

SW1
[dxy]vlan 10
[dxy-vlan10]exit
[dxy]vlan 20
[dxy-vlan20]exit
[dxy]vlan 100
SW2
[dxy]vlan 100
[dxy-vlan100]exit
[dxy]vlan 200
[dxy-vlan200]

SW3
[dxy]vlan 200
[dxy-vlan200]exit
[dxy]vlan 10
[dxy-vlan10]exit
[dxy]vlan 20

SW4
[dxy]vlan 10
[dxy-vlan10]exit
[dxy]vlan 20
[dxy-vlan20]exit
[dxy]vlan 100

SW5
[dxy]vlan 200
[dxy-vlan200]exit
[dxy]vlan 10
[dxy-vlan10]exit
[dxy]vlan 20

配置IP

SW1
[dxy]int vlan 10
[dxy-Vlan-interface10]ip add 192.168.1.1 24
[dxy-Vlan-interface10]exit
[dxy]int vlan 20
[dxy-Vlan-interface20]ip add 192.168.2.1 24
[dxy-Vlan-interface20]exit
[dxy]int vlan 100
[dxy-Vlan-interface100]ip add 100.1.1.1 24

SW2
[dxy]int vlan 100
[dxy-Vlan-interface100]ip add 100.1.1.2 24
[dxy-Vlan-interface100]exit
[dxy]int vlan 200
[dxy-Vlan-interface200]ip add 200.2.2.1 24


SW3

[dxy]int vlan 10
[dxy-Vlan-interface10]ip add 192.168.3.1 24
[dxy-Vlan-interface10]exit
[dxy]int vlan 20
[dxy-Vlan-interface20]ip add 192.168.4.1 24
[dxy-Vlan-interface20]int vlan 200
[dxy-Vlan-interface200]ip add 200.2.2.2 24


SW4
[dxy]int vlan 100
[dxy-Vlan-interface100]ip add 100.1.1.2 24
[dxy-Vlan-interface100]exit
[dxy]int vlan 10
[dxy-Vlan-interface10]ip add 192.168.1.2 24
[dxy-Vlan-interface10]exit
[dxy]int vlan 20
[dxy-Vlan-interface20]ip add 192.168.2.2 24


SW5

[dxy]int vlan 10
[dxy-Vlan-interface10]ip add 192.168.3.2 24
[dxy-Vlan-interface10]exit
[dxy]int vlan 20
[dxy-Vlan-interface20]ip add 192.168.4.2 24

SW4和SW1 SW5和SW3 介面配置trunk 鏈路模式
SW1和SW2 SW3 配置access鏈路模式

SW4
[dxy]int G1/0/1
[dxy-GigabitEthernet1/0/1]port link-type trunk
[dxy-GigabitEthernet1/0/1]port trunk permit vlan 10 20

SW5
[dxy]int g1/0/1
[dxy-GigabitEthernet1/0/1]port link-type trunk
[dxy-GigabitEthernet1/0/1]port trunk permit vlan 10 20


SW3
[dxy]int g1/0/2
[dxy-GigabitEthernet1/0/2]port link-type trunk
[dxy-GigabitEthernet1/0/2]port trunk permit vlan 10 20
[dxy]int g1/0/1
[dxy-GigabitEthernet1/0/1]port access vlan 200

SW2
[dxy]int g1/0/1
[dxy-GigabitEthernet1/0/1]port access v
[dxy-GigabitEthernet1/0/1]port access vlan 100
[dxy-GigabitEthernet1/0/1]
[dxy]int g1/0/2
[dxy-GigabitEthernet1/0/2]p
[dxy-GigabitEthernet1/0/2]port a
[dxy-GigabitEthernet1/0/2]port access
[dxy-GigabitEthernet1/0/2]port access v
[dxy-GigabitEthernet1/0/2]port access vlan 200


SW1
[dxy]int g1/0/2
[dxy-GigabitEthernet1/0/2]p
[dxy-GigabitEthernet1/0/2]port a
[dxy-GigabitEthernet1/0/2]port access v
[dxy-GigabitEthernet1/0/2]port access vlan 100
[dxy]int g1/0/1
[dxy-GigabitEthernet1/0/1]port link-type trunk
[dxy-GigabitEthernet1/0/1]port trunk permit vlan 10 20

SW1 和 SW2 上配置RIP

SW1
[dxy]rip
[dxy-rip-1]v
[dxy-rip-1]version 2
[dxy-rip-1]und
[dxy-rip-1]undo s
[dxy-rip-1]undo summary
[dxy-rip-1]net 192.168.1.0
[dxy-rip-1]net 192.168.2.0
[dxy-rip-1]net 100.1.1.0
SW2
[dxy]rip
[dxy-rip-1]version 2
[dxy-rip-1]undo summary
[dxy-rip-1]net 100.1.1.0

SW3和SW2執行OSPF鏈路協議

[dxy]int LoopBack 0
[dxy-LoopBack0]ip add 3.3.3.3 24
[dxy-LoopBack0]qu
[dxy]route id
[dxy]route id 3.3.3.3
[dxy]ospf
[dxy-ospf-1]area 0
[dxy-ospf-1-area-0.0.0.0]network 200.2.2.0 0.0.0.255
[dxy-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[dxy-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[dxy-ospf-1-area-0.0.0.0]network 3.3.3.3 255.255.255.255

SW2
[dxy]route id 2.2.2.2
[dxy]int l0
[dxy-LoopBack0]ip add 2.2.2.2 24
[dxy-LoopBack0]exit
[dxy]ospf
[dxy-ospf-1]area 0
[dxy-ospf-1-area-0.0.0.0]net 2.2.2.2 255.255.255.255
[dxy-ospf-1-area-0.0.0.0]net 200.2.2.0 0.0.0.255

SW2上路由引入RIP 和OSPF

[dxy-rip-1]ospf
[dxy-ospf-1]import-route rip 1
[dxy-ospf-1]rip
[dxy-rip-1]import-route ospf 1

SW4和SW5 上配置靜態路由,使它可到達其他網段的路由

SW4
[dxy]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1

SW5
[dxy]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1

實驗結果

PING 測試
在這裡插入圖片描述

相關文章