三层交换-----单臂路由

一.实验环境

1.GNS3模拟器

2.两台VPC

3.两台c3725的路由器(其中一台改成交换机)

4.Windows10企业版(本机)

二.实验原理

原理:通过一台路由器,使vlan间互通数据通过路由器进行三层转发。在路由器的一个物理接口上通过配置子接口(即逻辑接口)的方式来实现以一当多的功能。路由器同一物理接口的不同子接口作为不同的VLAN默认网关,当不同VLAN间的用户主机需要通信时,只需将数据包发送给网关,网关处理后再发送至目的主机所在的VLAN,从而实现VLAN间的通信。

特点:数据仅仅只通过一条中继链路传输,该中继链路工作量比较大,如果有多个不同vlan,就会造成该中继链路瘫痪。其中路由器负责数据包的转发和vlan的转换,交换机负责数据的标记和清除。

三.网络拓扑图

四.实验步骤

1.配置sw

增加该设备的磁盘空间,以便划分vlan

增加二层接口数

关闭路由功能

sw#conf t
sw(config)#no ip routing 

创建vlan10,vlan20

sw#conf t
sw(config)#vlan 10,20

把接口f1/0,f1/1划分给vlan10,20,并查看接口信息

sw(config-vlan)#exit
sw(config)#int f1/0
sw(config-if)#switch mode access
sw(config-if)#switch access vlan 10
sw(config-if)#int f1/1
sw(config-if)#switch mode access   
sw(config-if)#switch access vlan 20
sw(config-if)#do show vlan-switch brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/2, Fa1/3, Fa1/4, Fa1/5
                                                Fa1/6, Fa1/7, Fa1/8, Fa1/9
                                                Fa1/10, Fa1/11, Fa1/12, Fa1/13
                                                Fa1/14, Fa1/15
10   VLAN0010                         active    Fa1/0
20   VLAN0020                         active    Fa1/1
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

给接口f1/2配置trunk,并查看f1/2信息

sw(config)#int f1/2
sw(config-if)#sw mo tr
sw(config-if)#sw tr en do
sw(config-if)#do show int f1/2 switchport
Name: Fa1/2
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,10,20
Protected: false
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none 
Appliance trust: none

2.配置R1

分别进入R1的虚拟子接口,并给它们配置trunk和IP地址,在实际接口f0/0中也必须开启端口

R1#conf t
R1(config)#int f0/0.1
R1(config-subif)#en do 10
R1(config-subif)#ip add 192.168.10.1 255.255.255.0
R1(config-subif)#no shut

R1(config-subif)#int f0/0.2
R1(config-subif)#en do 20
R1(config)#int f0/0.2
R1(config-subif)#ip add 192.168.20.1 255.255.255.0
R1(config-subif)#no shut
R1(config-subif)#exit

R1(config)#int f0/0
R1(config-if)#no shut

查看路由表

R1(config-if)#do show ip route  
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.10.0/24 is directly connected, FastEthernet0/0.1
C    192.168.20.0/24 is directly connected, FastEthernet0/0.2

查看虚拟子接口

R1(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    up      
FastEthernet0/0.1          192.168.10.1    YES manual up                    up      
FastEthernet0/0.2          192.168.20.1    YES manual up                    up      
FastEthernet0/1            unassigned      YES unset  administratively down down 

3.配置pc1和pc2的IP地址和网关

PC1> ip 192.168.10.10 255.255.255.0 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1
PC1>
PC2> ip 192.168.20.20 255.255.255.0 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.20 255.255.255.0 gateway 192.168.20.1

PC2> 

五.实验结果

使用pc1 ping pc2

在抓包工具中对比数据

 

 

 

经过上述实验可以了解到单臂路由的工作过程。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值