Packet Tracer - Configure Router-on-a-Stick Inter-VLAN Routing
题目
目标
第1部分:为交换机添加vlan
第2部分:配置子接口
第3部分:使用vlan间路由测试连通性
场景
在此活动中,您将配置vlan和vlan间路由。然后启用trunk接口并验证vlan之间的连通性。
第1部分:为交换机添加vlan
步骤1:在S1上创建vlan。
在S1上创建VLAN 10和VLAN 30。
打开配置窗口
步骤2:端口划分vlan。
a.配置F0/6和F0/11接口为接入端口,并分配vlan。
·将连接PC1的端口分配到VLAN 10中。
·将连接PC3的端口分配到VLAN 30中。
b.使用show vlan brief命令验证vlan配置。
显示vlan概要
VLAN名称状态端口
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active Fa0/11
30 VLAN0030主Fa0/6
1002年fddi-default活跃
1003年token-ring-default活跃
1004年fddinet-default活跃
1005年trnet-default活跃
关闭配置窗口
步骤3:测试PC1和PC3之间的连通性。
从PC1 ping PC3。
问题:
ping成功了吗?你为什么会得到这个结果?
第2部分:配置子接口
步骤1:在R1上配置802.1Q封装的子接口。
打开配置窗口
a.创建子接口G0/0.10。
·配置封装类型为802.1Q,子接口指定VLAN 10。
·参考地址表,为子接口分配正确的IP地址。
R1 # int g0/0.10(配置)
10 . R1(config-subif)# encapsulation dot1Q
R1(config-subif)# ip address 172.17.10.1 255.255.255.0
b.重复配置G0/0.30子接口。
步骤2:验证配置。
a.使用show ip interface brief命令检查子接口配置。两个子接口都关闭。子接口是与物理接口相关联的虚拟接口。因此,为了启用子接口,必须启用与子接口相关联的物理接口。
b.使能G0/0接口。验证子接口现在是活动的。
关闭配置窗口
第3部分:使用vlan间路由测试连通性
步骤1:在PC1和PC3之间Ping。
问题:
从PC1 ping PC3。ping仍然会失败。解释一下。
步骤2:启用集群功能。
打开配置窗口
a.在S1上执行show vlan命令。
问题:
G0/1属于哪个VLAN ?
b.由于路由器配置了多个子接口,子接口属于不同的vlan,因此需要将与路由器相连的交换机端口配置为trunk。在接口G0/1上启用集群功能。
问题:
如何使用show vlan命令确定接口是trunk类型的端口?
c.使用show interface trunk命令查看接口是否已配置为trunk。
具体配置
创建vlan10 和vlan30
S1>enable
S1#configure terminal
S1(config)#vlan 10
S1>enable
S1#configure terminal
S1(config)#vlan 30
a.端口划分vlan
S1(config)#interface f0/11
S1(config-if)#switchport access vlan 10
S1(config)#interface f0/6
S1(config-if)#switchport access vlan 30
S1(config)#interface g0/1
S1(config-if)#switch mode trunk
show vlan brief
在R1上配置802.1Q封装的子接口
R1>enable
R1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int g0/0.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address 172.17.10.1 255.255.255.0
R1(config-subif)#int g0/0.30
R1(config-subif)#encapsulation dot1Q 30
R1(config-subif)#ip address 172.17.30.1 255.255.255.0
R1(config-if)#interface g0/0
R1(config-if)#no shutdown
完成配置
希望这篇文章对你有所帮助,点个赞再走!!!