實驗名稱:簡單的三層交換配置路由
實驗拓撲:
實驗需要:
1、按圖中所示配置設網絡備vlan,IP地址
2、能夠使各pc互相ping通。
實驗步驟:
1、配置終端設備:
pc1-pc5按照拓撲圖中所示配置各個pc的ip地址。
網關配置爲 192.168.x.254
pc6配置爲 192.168.7.1/24 網關爲192.168.7.254
2、配置網絡設備
#配置交換設備(Lsw1)
1、創建vlan
vlan batch 1 2 3
2、配置端口模式
interface g0/0/1
port link-type access
interface g0/0/2
port link-type access
interface g0/0/3
port link-type access
3、將端口加入特定vlan
interface gi0/0/1
port default vlan 1
interface gi0/0/2
port default vlan 2
interface gi0/0/3
port default vlan 3
4、配置交換機之間的互聯鏈路(trunk)
interface gi0/0/24
port link-type trunk
port trunk allow-pass vlan all
#配置交換設備(Lsw2)
1、創建vlan
vlan 4
vlan 5
2、配置端口模式
interface g0/0/1
port link-type access
interface g0/0/2
port link-type access
3、將端口加入特定vlan
interface gi0/0/1
port default vlan 4
interface gi0/0/2
port default vlan 5
4、配置交換機之間的互聯鏈路(trunk)
interface gi0/0/24
port link-type trunk
port trunk allow-pass vlan all
#配置路由設備(Lsw3)
1、配置交換機之間的互聯鏈路
interface gi0/0/1
port link-type trunk
port trunk allow-pass vlan all
interface gi0/0/2
port link-type trunk
port trunk allow-pass vlan all
2、創建對應的 valn
vlan 1
vlan 2
vlan 3
vlan 4
vlan 5
vlan 6
3、配置每個vlan對應的svi接口(每個vlan的網關IP地址)
interface vlan 1
undo shutdown
ip address 192.168.1.254 255.255.255.0
interface vlan 2
undo shutdown
ip address 192.168.2.254 255.255.255.0
interface vlan 3
undo shutdown
ip address 192.168.3.254 255.255.255.0
interface vlan 4
undo shutdown
ip address 192.168.4.254 255.255.255.0
interface vlan 5
undo shutdown
ip address 192.168.5.254 255.255.255.0
interface vlan 6
undo shutdown
ip address 192.168.6.1 255.255.255.0
4、配置24端口模式,並加入vlan6
interface g0/0/24
port link-type access
port default vlan 6
5、設置浮動靜態路由
ip route-static 192.168.7.0 255.255.255.0 192.168.6.2
#配置路由器設備(AR1)
1、配置兩個端口的IP地址
interface g0/0/0
ip address 192.168.7.254 255.255.255.0
no shutdown
interface g0/0/1
ip address 192.168.6.2 255.255.255.0
no shutdown
2、配置浮動靜態路由
IP route-static 0.0.0.0 0.0.0.0 192.168.6.1
注意:路由用交換機LSW3中,與路由器連接的端口一定要加入到一個新vlan中,並配置vlan網關的ip地址。
驗證:
互相都ping通。
爲pc1 ping pc6的結果。