Skip to main content

tplogin.cn首页 > 新闻资讯 >

VLAN间路由

2012-07-12 12:32 浏览:

实验目的:

通过本实验,可以掌握如下技能

1、在路由器以太口配置子接口

2、单臂路由实现VLAN间路由的配置

3、理解三层交换的概念,配置三层交换

实验拓扑

119651752

  实验过程

  (1) 创建VLAN,并划分端口到VLAN中

  LSW1(config)#vlan 2

  LSW1(config)#int f0/1

  LSW1(config-if)#sw mo acc

  LSW1(config)#int f0/2

  LSW1(config-if)#sw mo acc

  LSW1(config-if)#sw acc vlan 2

  LSW1(config)#int f0/3

  LSW1(config-if)#sw mo trunk

  RSW2(config)#int f0/1

  RSW2(config-if)#sw mo acc

  RSW2(config-if)#sw acc vlan 3

  % Access VLAN does not exist. Creating vlan 3

  RSW2(config)#int f0/2

  RSW2(config-if)#sw mo acc

  RSW2(config-if)#sw acc vlan 4

  % Access VLAN does not exist. Creating vlan 4

  (2) 在路由器R1的f0/0口配置子接口,并定义封装类型

  R1(config)#int f0/0

  R1(config-if)#no sh

  R1(config)#int f0/0.1 //创建子接口

  R1(config-subif)#encapsulation dot1Q 1 native

  //以上是定义该子接口承载哪个VLAN 流量,由于交换机上的native vlan 是VLAN 1,所以我们这里也要指明该VLAN 就是native vlan。实际上默认时 native vlan 就是vlan 1

  R1(config-subif)#ip add 192.168.1.1 255.255.255.0 //VLAN1内主机的网关

  R1(config)#int f0/0.2

  R1(config-subif)#encapsulation dot1Q 2

  R1(config-subif)#ip add 192.168.2.1 255.255.255.0 //VLAN2主机的网关

  (3) 配置三层交换

  RSW2(config)#ip routing //开启路由功能

  RSW2(config)#int vlan 3

  RSW2(config-if)#ip add 192.168.3.1 255.255.255.0

  RSW2(config-if)#no sh

  RSW2(config)#int vlan 4

  RSW2(config-if)#ip add 192.168.4.1 255.255.255.0

  RSW2(config-if)#no sh

  (4) 配置路由协议

  R1(config)#int f0/1

  R1(config-if)#ip add 172.16.1.1 255.255.255.0

  R1(config-if)#no sh

  R1(config)#router rip

  R1(config-router)#version 2

  R1(config-router)#no auto-summary

  R1(config-router)#network 172.16.0.0

  R1(config-router)#net 192.168.1.0

  R1(config-router)#net 192.168.2.0

  RSW2(config)#int f0/3

  RSW2(config-if)#no switchport //将二层口变成三层口

  RSW2(config-if)#ip add 172.16.1.2 255.255.255.0

  RSW2(config-if)#no sh

  RSW2(config)#router rip

  RSW2(config-router)#version 2

  RSW2(config-router)#no auto-summary

  RSW2(config-router)#net 172.16.0.0

  RSW2(config-router)#net 192.168.3.0

  RSW2(config-router)#net 192.168.4.0

实验验证

PC0与PC1之间的通信

131492727

PC2和PC3之间的通信 

131610118

查看路由器R1和RSW2的路由表

  

131657745

 

  

131688930

检查PC0、PC1、PC2、PC3之间的通信

131747305

 

本文出自 “迷茫的小菜鸟” 博客。

相关文章

中国移动中兴ZXHN E503路由器,如何登录wifi.cmcc设置

2022-04-15 08:22:30    浏览: 155

电脑跟手机如何打开tp-link路由器登录入口:tplogin.cn

2022-04-15 08:11:01    浏览: 125

水星路由器设置网址:melogin cn

2022-04-15 07:56:40    浏览: 141

ios16更新卡在估算时间怎么办(附详细解决办法)

2022-04-12 16:03:44    浏览: 185

字间距调整为标准教程

2022-04-10 15:59:40    浏览: 148