我在这个拓扑上工作了很长时间,但我没有设法让每个网络都与每个网络上的不同 VLAN 一起说话。在此拓扑上:
当我跟踪从 PC3 发送到 PC4 的数据包时,数据包到达路由器,路由器丢弃数据包并显示以下消息:“路由器没有 IEEE 802.1q 帧标签上指示的 VLAN。它丢弃了帧。”
我希望 PC1(10.1.1.1) ping PC2(10.1.2.1)、PC3(10.1.3.1)、PC4(10.1.4.1) 和 PC2 ping PC1、PC3、PC4 等。关于这些 PC 中的每一个有不同的VLAN。正如您将在每个交换机配置中看到的那样,我已经创建了 VLAN。
这是路由器配置:
hostname Router
!
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface GigabitEthernet0/0/0
no ip address
!
interface GigabitEthernet0/0/1
no ip address
duplex auto
speed auto
!
interface GigabitEthernet0/0/2
no ip address
duplex auto
speed auto
shutdown
!
interface GigabitEthernet0/1/0
switchport mode trunk
switchport nonegotiate
!
interface GigabitEthernet0/1/1
switchport mode trunk
switchport nonegotiate
!
interface GigabitEthernet0/1/2
switchport mode access
switchport nonegotiate
!
interface GigabitEthernet0/1/3
switchport mode access
switchport nonegotiate
!
interface Vlan1
ip address 10.1.0.254 255.255.255.0
!
router rip
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
这是 Switch1 配置:
hostname Switch1
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/2
!
interface FastEthernet0/3
switchport mode trunk
!
..
..
!
interface Vlan1
ip address 10.1.1.254 255.255.255.0
!
line con 0
!
line vty 0 4
login
!
line vty 5 15
login
!
end
!
这是 Switch2 配置:
hostname Switch2
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 20
switchport mode access
!
..
..
!
interface Vlan1
ip address 10.1.2.254 255.255.255.0
!
line con 0
!
line vty 0 4
login
!
line vty 5 15
login
!
end
!
这是 Switch3 配置:
hostname Switch3
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 30
switchport mode access
!
..
..
!
interface Vlan1
ip address 10.1.3.254 255.255.255.0
!
line con 0
!
line vty 0 4
login
!
line vty 5 15
login
!
end
!
这是 Switch4 配置:
hostname Switch4
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 40
switchport mode access
!
..
..
!
interface Vlan1
ip address 10.1.4.254 255.255.255.0
!
line con 0
!
line vty 0 4
login
!
line vty 5 15
login
!
end
!