棒上的路由器未连接 2 个不同的 VLAN

网络工程 思科 路由器 层2 数据包追踪器
2021-07-19 02:25:05

我有一个设置,它需要两个不同的 VLAN 才能相互 ping 通。我有一个带有 2 层 2 交换机和一个定义了子接口的路由器的设置,并且在我的一生中,我找不到停止 PC 之间 ping 的错误。(由于将来要连接其他PC,我无法卸下路由器和另一台交换机之间的交换机)

我曾多次尝试在棒上配置路由器,重做子接口并中继设备之间的端口,但没有任何效果。

TL:DR - VLAN 50 无法 ping VLAN 80,棒上的路由不起作用

提前致谢

图表

这是路由器的运行配置

Current configuration : 1545 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
ip dhcp pool SERVICEPOOL
network 192.168.50.0 255.255.255.0
default-router 192.168.50.35
ip dhcp pool STUDENTPOOL
dns-server 8.8.8.8
domain-name STUDENTPOOL
ip dhcp pool ADMINPOOL
network 192.168.80.0 255.255.255.0
default-router 192.168.80.254
dns-server 8.8.8.8
!
!
no ip cef
no ipv6 cef
!
!
!
license udi pid CISCO2901/K9 sn FTX1524ETWG-
!
!
ip name-server 8.8.8.8
!
!
spanning-tree mode pvst
!
!
!
interface GigabitEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/1
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/1.50
encapsulation dot1Q 50
ip address 192.168.50.1 255.255.255.0
!
interface GigabitEthernet0/1.80
encapsulation dot1Q 80
ip address 192.168.80.1 255.255.255.0
!
interface Serial0/0/0
ip address 192.168.127.9 255.255.255.252
clock rate 2000000
!
interface Serial0/0/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan5
no ip address
!
interface Vlan50
no ip address
!
interface Vlan80
no ip address
!
interface Vlan99
ip address 192.168.99.1 255.255.255.0
!
router rip
version 2
passive-interface default
no passive-interface Vlan80
network 192.168.127.0
!
ip classless
!
ip flow-export version 9
!
no cdp run
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end

这是交换机 A 的运行配置

Current configuration : 2953 bytes
!
version 12.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport access vlan 50
switchport trunk allowed vlan 1-99
switchport mode access
!
interface FastEthernet0/13
switchport access vlan 80
switchport trunk allowed vlan 1-99
switchport mode access
!
interface GigabitEthernet0/1
switchport access vlan 50
switchport trunk allowed vlan 1-99
switchport mode trunk
spanning-tree portfast trunk
!
interface GigabitEthernet0/2
switchport access vlan 32
switchport trunk allowed vlan 1-99
switchport mode trunk
!
interface Vlan1
ip address 192.168.99.3 255.255.255.0
shutdown
!
interface Vlan5
mac-address 0001.639c.ac61
no ip address
!
interface Vlan50
mac-address 0001.6312.8467
ip address 192.168.50.50 255.255.255.0
!
interface Vlan80
mac-address 0001.64d6.bbc8
ip address 192.168.80.5 255.255.255.0
!
interface Vlan99
mac-address 00e0.b008.e40a
ip address 192.168.99.3 255.255.255.0
!
ip default-gateway 192.168.10.1
!
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
!
!
end

这是开关B

Current configuration : 2905 bytes
!
version 12.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport access vlan 50
switchport trunk allowed vlan 1-99
switchport mode trunk
!
interface FastEthernet0/13
switchport access vlan 80
switchport trunk allowed vlan 1-99
switchport mode trunk
!
interface GigabitEthernet0/1
switchport trunk allowed vlan 1-99
switchport mode trunk
!
interface GigabitEthernet0/2
switchport access vlan 32
switchport trunk allowed vlan 1-99
switchport mode trunk
!
interface Vlan1
ip address 192.168.99.40 255.255.255.0
!
interface Vlan32
mac-address 00d0.ba11.3e6d
no ip address
!
interface Vlan50
mac-address 000a.f35d.87d7
ip address 192.168.50.25 255.255.255.0
!
interface Vlan80
mac-address 000c.85c0.dcca
ip address 192.168.80.50 255.255.255.0
!
interface Vlan99
description SVI
mac-address 0090.21e6.1388
ip address 192.168.99.2 255.255.255.0
!
ip default-gateway 192.168.10.1
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end

和 2 台电脑 在此处输入图片说明 在此处输入图片说明

2个回答

第 1 台和第 2 台电脑上的配置确认您的网关设置不正确。PC1 的网关应为:192.168.50.1,PC2 的网关应为 192.168.80.1

还要注意,portfast 应该只在终端主机上打开(比如 PC),所以它不应该在交换机 A 的端口 g0/1 上

此外,计算机不应作为中继接口连接,因为它唯一的 PC 不是交换机或路由器,您的端口应该是交换机 B 端口 fa0/13 和 fa0/1 上的访问端口

为了建立在 Kubn2 的响应之上,您应该在此设置中重新配置几项内容。

  1. 连接 PC1 和 PC2 的接口设置为中继模式。您必须记住,trunk 是用于交换机之间的 Vlan 流量,而不是用于连接终端设备。因此,您必须将这两个端口更改为访问模式。

  2. VLAN 的默认网关将是在路由器子接口上设置的 IP 地址。因此,两台 PC 的默认地址必须是 xxx1。

  3. 我可能在这一点上错了,但是您在交换机上标记了 IP 地址。通常我被告知你不应该在 L2 交换机上实现 IP 地址,因为基于 IP 地址的流量总是由 L3 设备处理,在这种情况下是你的路由器。

正如 Kubn2 所提到的,Portfast 应该只在您的接入层中的交换机上启用。它们不在您的设置的分布层中使用。