一、实验目标
掌握单臂路由器配置方法;
通过单臂路由器实现不同VLAN之间互相通信;
二、实验步骤
1.新建packer tracer拓扑图
2.当交换机设置两个Vlan时,逻辑上已经成为两个网络,广播被隔离了。两个Vlan的网络要通信,必须通过路由器,如果接入路由器的一个物理端口,则必须有两个子接口分别与两个Vlan对应,同时还要求与路由器相连的交换机的端口G0/1要设置为trunk,因为这个接口要通过两个Vlan的数据包。
3.检查设置情况,应该能够正确的看到Vlan和Trunk信息。
4.计算机的网关分别指向路由器的子接口。
5.配置子接口,开启路由器物理接口。
6.默认封装dot1Q协议。
7.配置路由器子接口IP地址
三、实验设备
PC 2台;Router_2901 1台;Switch_2960 1台
1.配置PC0
IP: 192.168.2.2
Submask: 255.255.255.0
Gateway:192.168.2.1
2.配置PC1
IP: 192.168.3.3
Submask: 255.255.255.0
Gateway:192.168.3.1
- 此时PC0 ping PC1,是ping不通的
- 配置交换机Switch0
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname yyuxing
yyuxing(config)#vlan 10
yyuxing(config-vlan)#name vlan10
yyuxing(config-vlan)#exit
yyuxing(config)#vlan 20
yyuxing(config-vlan)#name vlan20
yyuxing(config-vlan)#exit
yyuxing(config)#int f0/1
yyuxing(config-if)#switchport mode access
yyuxing(config-if)#switchport access vlan 10
yyuxing(config-if)#exit
yyuxing(config)#int f0/2
yyuxing(config-if)#switchport mode access
yyuxing(config-if)#switchport access vlan 20
yyuxing(config-if)#exit
yyuxing(config)#int G0/1
yyuxing(config-if)#switchport mode access
yyuxing(config-if)#switchport mode trunk
yyuxing(config-if)#exit
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
yyuxing con0 is now available
PS:yyuxing这个名字是我自己命名的
- 配置路由器Router0
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int G0/1
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Router(config-if)#int G0/1.10
Router(config-subif)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1.10, changed state to up
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#int G0/1.20
Router(config-subif)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1.20, changed state to up
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.3.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#exit
Router con0 is now available
Press RETURN to get started.
Router>en
Router#show ip route
Codes: L - local, 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, 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
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, GigabitEthernet0/1.10
L 192.168.2.1/32 is directly connected, GigabitEthernet0/1.10
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/24 is directly connected, GigabitEthernet0/1.20
L 192.168.3.1/32 is directly connected, GigabitEthernet0/1.20
Router#
Router con0 is now available
Press RETURN to get started.
- 配置完后,我们发现,原来交换机和交换机的连线上的点变成了绿色并闪烁。此时,我们用PC0 ping PC1,是ping通的
如图为路由器配置
五、实验总结
今天的实验是根据需求配置路由器单臂路由,实现不同VLAN之间的数据通信,从中我学习到了:
1.单臂路由是为实现VLAN间通信的三层网络设备路由器
2.只需要一个以太网,通过创建子接口就可以承担所有VLAN的网关
3.当交换机设置两个VLAN时,逻辑上已经成为两个网络,传播被隔离了
4.如果接入路由器的一个物理端口,则必须有两个子接口分别与两个VLAN对应,这个实验中的子接口就是G0/1.10、G0/1.20
5.加深了对交换机、路由器不同的配置命令及各种模式之间切换的记忆文章来源:https://www.toymoban.com/news/detail-439374.html
6.要在不同的VLAN间转发数据,所以与路由器相连的交换机的端口G 0/1要设置为trunk模式。文章来源地址https://www.toymoban.com/news/detail-439374.html
到了这里,关于【实验报告】实验四 单臂路由配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!