三层交换实现VLAN互通

三层交换技术:二层交换技术+三层转发技术。它解决了局域网中网段划分之后,网段中子网必须依赖路由器进行管理的局面,解决了传统路由器低速、复杂所造成的网络瓶颈问题。

创新互联是一家专注于网站设计制作、成都做网站与策划设计,永和网站建设哪家好?创新互联做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:永和等地区。永和做网站价格咨询:13518219792

三层交换实现VLAN互通

实验需求:

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

  • 三层交换实现PC间互通;

  • R2配置静态路由实现全网互通;

实验步骤:

实验所用 :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   //配置网关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   //配置网关IP地址;

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

M1(config-if)#no switchport   //二层端口转三层端口;

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   //配置默认静态路由;


4.PC配置

VPCS[1]> ip 192.168.1.10 192.168.1.1   //配置C1 IP地址及网关;

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地址及网关;

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地址及网关;

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地址及网关;

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地址及子网掩码;

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地址、子网掩码;

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    //配置默认静态路由;

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地址及子网掩码;

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   //配置静态路由;


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




分享题目:三层交换实现VLAN互通
当前URL:http://scyanting.com/article/jsdcso.html