實驗名稱:簡單的三層交換配置路由 (思科)
實驗拓撲:
1、配置終端設備:
pc1-pc5按照拓撲圖中所示配置各個pc的ip地址。
網關配置爲 192.168.x.254
pc6配置爲 192.168.7.1/24 網關爲192.168.7.254
2、配置網絡設備
#配置交換設備(sw1)
1、創建vlan
vlan 1
vlan 2
vlan 3
2、配置端口模式
interface range fa 0/1 - 3
switchport mode access
3、將端口加入特定vlan
interface fa0/1
switchport access vlan 1
interface fa0/2
switchport access vlan 2
interface fa0/3
switchport access vlan 3
4、配置交換機之間的互聯鏈路(trunk)
interface fa 0/24
switchport mode trunk
#配置交換設備(Lsw2)
1、創建vlan
vlan 4
vlan 5
2、配置端口模式
interface range fa 0/1 ,0/2
switchport mode access
3、將端口加入特定vlan
interface fa 0/1
switchport access vlan 4
interface fa 0/2
switchport access vlan 5
4、配置交換機之間的互聯鏈路(trunk)
interface fa 0/24
switchport mode trunk
#配置路由設備(Lsw3)
1、配置交換機之間的互聯鏈路
interface fa 0/23 , 0/24
switchport trunk encapsulation dot1q
switchport mode trunk
2、創建對應的 valn
vlan 1
vlan 2
vlan 3
vlan 4
vlan 5
3、配置每個vlan對應的svi接口(每個vlan的網關IP地址)
interface vlan 1
no shutdown
ip address 192.168.1.254 255.255.255.0
interface vlan 2
no shutdown
ip address 192.168.2.254 255.255.255.0
interface vlan 3
no shutdown
ip address 192.168.3.254 255.255.255.0
interface vlan 4
no shutdown
ip address 192.168.4.254 255.255.255.0
interface vlan 5
no shutdown
ip address 192.168.6.254 255.255.255.0
4、配置1端口模式爲路由,並配置IP地址
interface fa 0/1
no switchport
ip address 192.168.6.1
5、設置浮動靜態路由
ip routing
ip route 192.168.7.0 255.255.255.0 192.168.6.2
#配置路由器設備(AR1)
1、配置兩個端口的IP地址
interface g 0/0
ip address 192.168.7.254 255.255.255.0
interface g 0/1
ip address 192.168.6.2 255.255.255.0
2、配置浮動靜態路由
IP route 0.0.0.0 0.0.0.0 192.168.6.1
驗證:
![](https://s1.51cto.com/images/blog/201811/16/79778123f25b6defdc505583708573c8.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
pc1 ping pc6