您的位置:首页 > 理论基础 > 计算机网络

第八章 路由器单臂路由配置

2018-02-26 15:19 337 查看
实验目标
掌握单臂路由器配置方法;
通过单臂路由器实现不同 VLAN 之间互相通信;

实验背景
某企业有两个主要部门, 技术部和销售部, 分处于不同的办公室, 为了安全和便于管理
对两个部门的主机进行了 VLAN 的划分, 技术部和销售部分处于不同的 VLAN。 现由
于业
务的需求需要销售部和技术部的主机能够相互访问, 获得相应的资源, 两个部门的交换
机通
过一台路由器进行了连接。

技术原理
单臂路由: 是为实现 VLAN 间通信的三层网络设备路由器, 它只需要一个以太网, 通
过创建子接口可以承担所有 VLAN 的网关, 而在不同的 VLAN 间转发数据。

实验步骤
新建 packer tracer 拓扑图
当交换机设置两个 Vlan 时, 逻辑上已经成为两个网络, 广播被隔离了。 两个 Vlan 的
网 络
要通信, 必须通过路由器, 如果接入路由器的一个物理端口, 则必须有两个子接口分
别与
两个 Vlan 对应, 同时还要求与路由器相连得交换机的端口 fa 0/1 要设置为 trunk, 因
为这个
接口要通过两个 Vlan 的数据包。
检查设置情况, 应该能够正确的看到 Vlan 和 Trunk 信息。
计算机的网关分别指向路由器的子接口。
配置子接口, 开启路由器物理接口。
默认封装 dot1q 协议。
配置路由器子接口 IP 地址。

实验设备
PC 2 台; Router_2811 1 台; Switch_2960 1 台

交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan all
Switch(config-if)#int f0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int f0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3
Switch(config-if)#

路由器:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#no shutRouter(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed
state to up
Router(config)#int f0/0.1
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip address 192.168.1.1 255.255.255.0
Router(config-subif)#int f0/0.2
Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config-subif)#do show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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.1.0/24 is directly connected, FastEthernet0/0.1
C 192.168.2.0/24 is directly connected, FastEthernet0/0.2
Router(config-subif)#

实验验证:
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=1ms TTL=127
Reply from 192.168.2.2: bytes=32 time=0ms TTL=127
Reply from 192.168.2.2: bytes=32 time=0ms TTL=127
Reply from 192.168.2.2: bytes=32 time=1ms TTL=127
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0msPC>

实验完成!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  网络 IT 基础