为什么我的 VLAN 间中继路由不起作用?

网络工程 路由 局域网 树干
2022-02-28 07:15:32

我正在使用数据包跟踪器。我有以下配置:

打开开关 2950-24

  • VLAN 99

    • .

    • 分配给它的接口是 fa 0/1

    • PC 1 的 IP 为 10.10.10.2,默认网关为 10.10.10.3。PC 1 连接到 fa 0/1。
  • VLAN 100

    • .

    • 分配给它的接口是 fa 0/2

      • PC 2 的 IP 为 10.100.100.2,默认网关为 10.100.100.3。PC 2 连接到 fa 0/2。
  • 在交换机上,接口 fa 0/3 设置为中继模式

  • 路由器 2621-XM

    • 接口 fa 0/0 已启动并连接到交换机 fa 0/3
    • 子接口 fa 0/0.2 有 ip 10.10.10.3
    • 子接口 fa 0/0.3 有 ip 10.100.100.3

使用所有这些设置,所有灯都是绿色的。但问题是 PC1 无法 ping PC 2

下面是配置图

我的配置图片

下面是我的路由器和交换机配置

Current configuration : 1167 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
!
interface FastEthernet0/1
 switchport access vlan 99
 switchport mode access
!
interface FastEthernet0/2
 switchport access vlan 100
 switchport mode access
!
interface FastEthernet0/3
 switchport mode trunk

!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan99
 mac-address 0060.2fbb.3401
 no ip address
!
!
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
!
end

现在我的路由器配置

Current configuration : 752 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname ROUTER
!
!
!
!
!
!
!
!
no ip cef
no ipv6 cef
!
!

interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.2
 encapsulation dot1Q 2
 ip address 10.10.10.3 255.255.255.0
!
interface FastEthernet0/0.3
 encapsulation dot1Q 3
 ip address 10.100.100.3 255.255.255.0
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial0/0
 no ip address
 shutdown
!
interface Serial0/1
 no ip address
 shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end
3个回答

子接口配置有误。由于您的 VLAN ID 是 99 和 100,您应该分别更改接口配置:

interface FastEthernet0/0.2
 encapsulation dot1Q 99
 ip address 10.10.10.3 255.255.255.0
!
interface FastEthernet0/0.3
 encapsulation dot1Q 100
 ip address 10.100.100.3 255.255.255.0

并验证您是否已通过进入启用模式在交换机上创建 VLAN

show vlan

打开开关并在此处粘贴输出。

您可能需要将路由器上的子接口分配给正确的 VLAN

int g0/0.2  
encapsulation dot1Q 2

int g0/0.3  
encapsulation dot1Q 3

因此您可能不需要在交换机上连接 VLAN

路由器子接口配置错误。需要修改路由器中的子接口配置如下。

Router(config)#interface FastEthernet0/0.99

Router(config)# encapsulation dot1Q 99

Router(config)# ip address 10.10.10.3 255.255.255.0

Router(config)#interface FastEthernet0/0.100

Router(config)#encapsulation dot1Q 100

Router(config)# ip address 10.100.100.3 255.255.255.0