溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

三層交換實現(xiàn)VLAN互通

發(fā)布時間:2020-06-13 08:38:22 來源:網(wǎng)絡(luò) 閱讀:858 作者:SEveral06 欄目:網(wǎng)絡(luò)安全

三層交換技術(shù):二層交換技術(shù)+三層轉(zhuǎn)發(fā)技術(shù)。它解決了局域網(wǎng)中網(wǎng)段劃分之后,網(wǎng)段中子網(wǎng)必須依賴路由器進行管理的局面,解決了傳統(tǒng)路由器低速、復(fù)雜所造成的網(wǎng)絡(luò)瓶頸問題。

三層交換實現(xiàn)VLAN互通


實驗需求:

  • C1和C4屬于VLAN10,C2、C3屬于VLAN20;

  • 三層交換實現(xiàn)PC間互通;

  • R2配置靜態(tài)路由實現(xiàn)全網(wǎng)互通;

實驗步驟:

實驗所用 :Cisco GNS3

1.SW1配置

SW1#confi t          //進入全局配置模式;

Enter configuration commands, one per line.  End with CNTL/Z.

SW1(config)#vlan 10,20   //批量添加VLAN;

SW1(config-vlan)#exit

SW1(config)#int f1/1     //進入物理接口fa1/1;

SW1(config-if)#switchport access vlan 10    //添加VLAN10;

SW1(config-if)#no shut     //激活端口;


SW1(config)#int f1/2      //進入接口fa1/2;

SW1(config-if)#switchport access vlan 20   //添加VLAN20;

SW1(config-if)#no shut     //激活端口;


SW1(config)#int f1/5      //進入接口fa1/5;

SW1(config-if)#switchport mode trunk  //中繼TRUNK口;

SW1(config-if)#

*Mar  1 00:35:23.195: %DTP-5-TRUNKPORTON: Port Fa1/5 has become dot1q trunk


SW1(config)#int f1/0    //進入接口fa1/0;

SW1(config-if)#switchport mode trunk    //中繼TRUNK口;

SW1(config-if)#

*Mar  1 00:39:33.223: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk


2.SW2配置

SW2#confi t   //全局配置模式

Enter configuration commands, one per line.  End with CNTL/Z.

SW2(config)#vlan 10,20   //批量添加VLAN;

SW2(config-vlan)#exit    

SW2(config)#int f1/3     //進接口fa1/3;

SW2(config-if)#switchport access vlan 20  //添加VLAN20;

SW2(config-if)#no shut    //激活端口;


SW2(config)#int f1/5     //進fa1/5端口;

SW2(config-if)#switchport mode trunk   //配置中繼端口;

SW2(config-if)#

*Mar  1 00:36:20.659: %DTP-5-TRUNKPORTON: Port Fa1/5 has become dot1q trunk


3.M1配置

M1#confi t   //全局配置模式;

Enter configuration commands, one per line.  End with CNTL/Z.

M1(config)#int f1/0   //進接口fa1/0;

M1(config-if)#switchport mode trunk   //配置中繼TRUNK;

M1(config-if)#

*Mar  1 00:41:48.443: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk

M1(config-if)#exit

M1(config)#vlan 10,20    //批量添加VLAN;

M1(config-vlan)#exit

M1(config)#int f1/4      //進接口fa1/4;

M1(config-if)#switchport access vlan 10    //添加VLAN10;


M1(config)#int vlan10   //進入VLAN10虛擬接口;

*Mar  1 00:44:50.479: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

M1(config-if)#ip addr 192.168.1.1 255.255.255.0   //配置網(wǎng)關(guān)IP地址;

M1(config-if)#int vlan20   //進入VLAN20虛擬接口;

*Mar  1 00:45:24.131: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

M1(config-if)#ip addr 192.168.2.1 255.255.255.0   //配置網(wǎng)關(guān)IP地址;


M1(config)#int f1/10   //進接口fa1/10;

M1(config-if)#no switchport   //二層端口轉(zhuǎn)三層端口;

M1(config-if)#ip add 10.0.0.1 255.255.255.0   //配置IP地址;

M1(config-if)#

*Mar  1 00:54:19.367: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/10, changed state to up

M1(config-if)#no shut    //端口激活;


M1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2   //配置默認靜態(tài)路由;


4.PC配置

VPCS[1]> ip 192.168.1.10 192.168.1.1   //配置C1 IP地址及網(wǎng)關(guān);

Checking for duplicate address...

PC1 : 192.168.1.10 255.255.255.0 gateway 192.168.1.1


VPCS[1]> 2

VPCS[2]> ip 192.168.2.20 192.168.2.1   //配置C2 IP地址及網(wǎng)關(guān);

Checking for duplicate address...

PC2 : 192.168.2.20 255.255.255.0 gateway 192.168.2.1


VPCS[2]> 3

VPCS[3]> ip 192.168.2.30 192.168.2.1   //配置C3 IP地址及網(wǎng)關(guān);

Checking for duplicate address...

PC3 : 192.168.2.30 255.255.255.0 gateway 192.168.2.1


VPCS[3]> 4

VPCS[4]> ip 192.168.1.40 192.168.1.1     //配置C4 IP地址及網(wǎng)關(guān);

Checking for duplicate address...

PC4 : 192.168.1.40 255.255.255.0 gateway 192.168.1.1


5.測試PC間通信

VPCS[4]> ping 192.168.1.10      //測試C1和C4連通性;

192.168.1.10 icmp_seq=1 ttl=64 time=2.002 ms

192.168.1.10 icmp_seq=2 ttl=64 time=2.967 ms

192.168.1.10 icmp_seq=3 ttl=64 time=2.003 ms

192.168.1.10 icmp_seq=4 ttl=64 time=3.008 ms

192.168.1.10 icmp_seq=5 ttl=64 time=2.003 ms


VPCS[4]> 3

VPCS[3]> ping 192.168.2.20     //測試C3、C2連通性;

192.168.2.20 icmp_seq=1 ttl=64 time=3.004 ms

192.168.2.20 icmp_seq=2 ttl=64 time=2.069 ms


VPCS[3]> ping 192.168.1.10    //測試C3、C1連通性;

192.168.1.10 icmp_seq=1 timeout

192.168.1.10 icmp_seq=2 ttl=63 time=17.949 ms

192.168.1.10 icmp_seq=3 ttl=63 time=17.967 ms

192.168.1.10 icmp_seq=4 ttl=63 time=55.063 ms

192.168.1.10 icmp_seq=5 ttl=63 time=28.966 ms


VPCS[3]>

VPCS[3]> 4

VPCS[4]> ping 192.168.2.20    //測試C4、C2連通性;

192.168.2.20 icmp_seq=1 timeout

192.168.2.20 icmp_seq=2 ttl=63 time=47.050 ms

192.168.2.20 icmp_seq=3 ttl=63 time=23.026 ms


6.R1配置

R1#confi t     //全局配置模式;

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#int f0/1   //進fa0/1接口;

R1(config-if)#ip add 10.0.0.2 255.255.255.0   //配置IP地址及子網(wǎng)掩碼;

R1(config-if)#no shut     //激活端口;

R1(config-if)#

*Mar  1 00:55:56.307: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up

*Mar  1 00:55:57.307: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up


R1(config)#int f0/0    //進入接口FA0/0;

R1(config-if)#ip add 12.0.0.2 255.255.255.0   //配置IP地址、子網(wǎng)掩碼;

R1(config-if)#no shut     //激活端口;

R1(config-if)#

*Mar  1 00:58:54.163: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

*Mar  1 00:58:55.163: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up


R1(config)#ip route 192.168.1.0 255.255.255.0 10.0.0.1    //配置默認靜態(tài)路由;

R1(config)#ip route 192.168.2.0 255.255.255.0 10.0.0.1    


7.R2配置

R2#confi t    //全局配置模式;

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#int f0/0    //進入f0/0接口;

R2(config-if)#ip add 12.0.0.3 255.255.255.0   //配置IP地址及子網(wǎng)掩碼;

R2(config-if)#no shut   //激活端口;

R2(config-if)#

*Mar  1 01:00:11.707: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

*Mar  1 01:00:12.707: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up


R2(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2   //配置靜態(tài)路由;


8.測試互通

VPCS[3]> ping 12.0.0.3   //測試C3、R2連通性;

12.0.0.3 icmp_seq=1 ttl=253 time=137.756 ms

12.0.0.3 icmp_seq=2 ttl=253 time=93.753 ms

12.0.0.3 icmp_seq=3 ttl=253 time=109.381 ms

12.0.0.3 icmp_seq=4 ttl=253 time=140.631 ms

12.0.0.3 icmp_seq=5 ttl=253 time=140.633 ms


VPCS[3]> 1

VPCS[1]> ping 12.0.0.2   //測試C1、R1連通性;

12.0.0.2 icmp_seq=1 ttl=254 time=62.501 ms

12.0.0.2 icmp_seq=2 ttl=254 time=93.764 ms

12.0.0.2 icmp_seq=3 ttl=254 time=78.126 ms

12.0.0.2 icmp_seq=4 ttl=254 time=78.126 ms

12.0.0.2 icmp_seq=5 ttl=254 time=93.756 ms





向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI