Packet Tracer – 配置单臂路由器 VLAN 间路由

Packet Tracer – 配置单臂路由器 VLAN 间路由

地址分配表

设备

接口

IPv4 地址

子网掩码

默认网关

R1

G0/0.10

172.17.10.1

255.255.255.0

不适用

G0/0.30

172.17.30.1

255.255.255.0

不适用

PC1

NIC

172.17.10.10

255.255.255.0

172.17.10.1

PC2

NIC

172.17.30.10

255.255.255.0

172.17.30.1

拓扑图

 

目标

第 1 部分:测试不使用 VLAN 间路由时的连接

第 2 部分:为交换机添加 VLAN

第 3 部分:配置子接口

第 4 部分:测试使用 VLAN 间路由时的连接

场景

在本练习中,您将在实施 VLAN 间路由之前先检查连接。 然后,配置 VLAN 和 VLAN 间路由。 最后,您将启用中继,并验证 VLAN 之间的连接。

第 1 部分:    测试不使用 VLAN 间路由时的连接

步骤 1:    在 PC1 和 PC3 之间 Ping。

等待交换机融合,或点击几次加快转发时间。 当 PC1 和 PC3 的链路灯亮绿光时,在 PC1 和 PC3 之间执行 ping 操作。 由于两台 PC 位于不同的网络上,而且 R1 未配置,因此 ping 操作失败。

步骤 2:    切换到模拟模式以监视 ping。

a.     通过点击模拟选项卡或按 Shift+S 切换到模拟模式。

b.    点击捕获/转发以查看 ping 在 PC1 和 PC3 之间采取的步骤。 注意 ping 怎么会从不离开 PC1。 哪个过程失败,原因是什么?

ARP 进程失败,因为 ARP 请求已被 PC3 丢弃。PC1 和 PC3 不在同一网络上,因此 PC1 永远不会获取 PC3 的 MAC 地址。如果没有 MAC 地址,PC1 无法创建 ICMP 回显请求。

第 2 部分:    为交换机添加 VLAN

步骤 1:     在 S1 上创建 VLAN。

返回到实时模式,并在 S1 上创建 VLAN 10 和 VLAN 30。

S1(config)#vlan 10

S1(config-vlan)#vlan 30

步骤 2:    将 VLAN 分配给端口。

a.     将接口 F0/6 和 F0/11 配置为接入端口并分配 VLAN。

·         将 PC1 分配到 VLAN 10。

·         将 PC3 分配到 VLAN 30。

S1(config)#int f0/11

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 10

S1(config-if)#int f0/6

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 30

b.    发出 show vlan brief 命令以验证 VLAN 配置。

S1# show vlan brief

 

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

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 active Fa0/6

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

第 3 步:    测试 PC1 和 PC3 之间的连接。

从 PC1 ping PC3。 Ping 仍然会失败。 为什么 ping 不成功?

每个 VLAN 都是一个单独的网络,需要路由器或第 3 层交换机来提供它们之间的通信

第 3 部分:    配置子接口

步骤 1:    使用 802.1Q 封装在 R1 上配置子接口。

a.     创建子接口 G0/0.10。

·         将封装类型设置为 802.1Q 并将 VLAN 10 分配给子接口。

·         参见地址表,为子接口分配正确的 IP 地址。

b.    为 G0/0.30 子接口重复此操作。

R1(config)#int g0/0.10

R1(config-subif)#encapsulation dot1Q 10

R1(config-subif)#ip add 172.17.10.1 255.255.255.0

R1(config-subif)#no sh

R1(config-subif)#int g0/0.30

R1(config-subif)#encapsulation dot1Q 30

R1(config-subif)#ip add 172.17.30.1 255.255.255.0

R1(config-subif)#no sh

步骤 2:    验证配置。

a.     使用 show ip interface brief 命令验证子接口配置。 两个子接口都关闭。 子接口是与物理接口关联的虚拟接口。 因此,为了启用子接口,您必须启用与它们关联的物理接口。

b.    启用 G0/0 接口。 验证子接口现在是否处于活动状态。

R1(config)#int g0/0

R1(config-if)#no sh

第 4 部分:    测试使用 VLAN 间路由时的连接

步骤 1:    在 PC1 和 PC3 之间 Ping。

从 PC1 ping PC3。 Ping 仍然会失败。

步骤 2:    启用中继。

a.     在 S1 上,发出 show vlan 命令。 G0/1 分配到哪个 VLAN?

VLAN 1

b.    由于路由器配置了已分配到不同 VLAN 的多个子接口,连接到路由器的交换机端口必须配置为中继。 在接口 G0/1 上启用中继。

S1(config)#int g0/1

S1(config-if)#switchport mode trunk

c.     如何使用 show vlan 命令来确定接口为中继端口?

接口不再列在 VLAN 1 下

d.    发出 show interface trunk 命令以验证接口是否配置为中继。

步骤 3:    切换到模拟模式以监视 ping。

a.     通过点击模拟选项卡或按 Shift+S 切换到模拟模式。

b.    点击捕获/转发以查看 ping 在 PC1 和 PC3 之间采取的步骤。

c.     您应该会看到 S1 和 R1 之间的 ARP 请求和答复。 然后是 R1 和 S3 之间的 ARP 请求和答复。 然后,PC1 可以为 ICMP 回应请求封装正确的数据链路层信息,R1 会将请求路由到 PC3

:ARP 流程完成后,您可能需要点击“重设模拟”以查看 ICMP 流程是否完成。

实验步骤:

S1:

S1>enable

S1#conf t

Enter configuration commands, one per line. End with CNTL/Z.

S1(config)#vlan 10

S1(config-vlan)#vlan 30

S1(config-vlan)#exit

S1(config)#int f0/11

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 10

S1(config-if)#int f0/6

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 30

S1(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

S1(config-if)#exit

S1(config)#int g0/1

S1(config-if)#switchport mode trunk

S1(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

S1(config-if)#

S1(config-if)#end

S1#

%SYS-5-CONFIG_I: Configured from console by console

S1#write

Building configuration...

[OK]

S1#

R1:

R1>ena

R1#conf t

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 add 172.17.10.1 255.255.255.0

R1(config-subif)#no sh

R1(config-subif)#int g0/0.30

R1(config-subif)#encapsulation dot1Q 30

R1(config-subif)#ip add 172.17.30.1 255.255.255.0

R1(config-subif)#no sh

R1(config-subif)#exit

R1(config)#int g0/0

R1(config-if)#no sh

R1(config-if)#

%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

%LINK-5-CHANGED: Interface GigabitEthernet0/0.10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.10, changed state to up

%LINK-5-CHANGED: Interface GigabitEthernet0/0.30, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.30, changed state to up

R1(config-if)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

R1#we

R1#w

R1#write

Building configuration...

[OK]

R1#

实验脚本:

S1:

enable

conf t

vlan 10

vlan 30

exit

int f0/11

switchport mode access

switchport access vlan 10

int f0/6

switchport mode access

switchport access vlan 30

exit

int g0/1

switchport mode trunk

end

write

R1:

ena

conf t

int g0/0.10

encapsulation dot1Q 10

ip add 172.17.10.1 255.255.255.0

no sh

int g0/0.30

encapsulation dot1Q 30

ip add 172.17.30.1 255.255.255.0

no sh

exit

int g0/0

no sh

end

write

实验链接:https://pan.baidu.com/s/1hmeeCFBayf-FMYRl6LJ0Og?pwd=6336

提取码:6336

--来自百度网盘超级会员V3的分享

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

傻傻的心动

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值