【实验报告】实验四 单臂路由配置

一、实验目标     

掌握单臂路由器配置方法;

通过单臂路由器实现不同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

  1. 此时PC0 ping PC1,是ping不通的

  1. 配置交换机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这个名字是我自己命名的

  1. 配置路由器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.
  1. 配置完后,我们发现,原来交换机和交换机的连线上的点变成了绿色并闪烁。此时,我们用PC0 ping PC1,是ping通的

如图为路由器配置

五、实验总结

今天的实验是根据需求配置路由器单臂路由,实现不同VLAN之间的数据通信,从中我学习到了:

1.单臂路由是为实现VLAN间通信的三层网络设备路由器

2.只需要一个以太网,通过创建子接口就可以承担所有VLAN的网关

3.当交换机设置两个VLAN时,逻辑上已经成为两个网络,传播被隔离了

4.如果接入路由器的一个物理端口,则必须有两个子接口分别与两个VLAN对应,这个实验中的子接口就是G0/1.10、G0/1.20

5.加深了对交换机、路由器不同的配置命令及各种模式之间切换的记忆

6.要在不同的VLAN间转发数据,所以与路由器相连的交换机的端口G 0/1要设置为trunk模式。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值