配置如下:
3 个交换机在 TRUNK 模式下与光纤相连。
PC0 加入 VLAN 20 (192.168.2.55/24) 中交换机的千兆端口,网关 192.168.2.254
PC1 加入 VLAN 10 (192.168.1.55/24) 中交换机的千兆端口,网关 192.168.1.254
使用 TRUNK 连接插入交换机的路由器,具有封装的端口 Fa0/0 的 ip 配置。
配置如下:
**ROUTER**
hostname Router
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 10
ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 20
ip address 192.168.2.254 255.255.255.0
!
interface FastEthernet1/0
no ip address
duplex auto
speed auto
shutdown
!
interface Serial2/0
no ip address
clock rate 2000000
shutdown
!
interface Serial3/0
no ip address
clock rate 2000000
shutdown
!
interface FastEthernet4/0
no ip address
shutdown
!
interface FastEthernet5/0
no ip address
shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
中央开关
hostname CentralSwitch
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
!
interface FastEthernet1/1
!
interface FastEthernet2/1
!
interface FastEthernet3/1
!
interface FastEthernet4/1
!
interface FastEthernet5/1
!
interface FastEthernet6/1
!
interface FastEthernet7/1
switchport mode trunk
!
interface FastEthernet8/1
!
interface FastEthernet9/1
!
interface Vlan1
no ip address
shutdown
!
!
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
!
!
end
开关 LVL 1
hostname SwitchL1
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet1/1
!
interface GigabitEthernet2/1
!
interface GigabitEthernet3/1
!
interface GigabitEthernet4/1
!
interface GigabitEthernet5/1
!
interface GigabitEthernet6/1
switchport access vlan 10
!
interface FastEthernet7/1
!
interface FastEthernet8/1
!
interface FastEthernet9/1
!
interface Vlan1
no ip address
shutdown
!
!
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
!
!
end
开关 LVL2
hostname SwitchL2
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet1/1
!
interface GigabitEthernet2/1
!
interface GigabitEthernet3/1
!
interface GigabitEthernet4/1
!
interface GigabitEthernet5/1
!
interface GigabitEthernet6/1
switchport access vlan 20
!
interface FastEthernet7/1
!
interface FastEthernet8/1
!
interface FastEthernet9/1
!
interface Vlan1
no ip address
shutdown
!
!
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
!
!
end
PC1
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::205:5EFF:FE9A:28D8
IP Address......................: 192.168.1.55
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.254
PC2
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::290:CFF:FE04:E01C
IP Address......................: 192.168.2.55
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.2.254
但 。我无法从每台 PC ping 网关,我的意图是加入 2 台具有不同 VLAN 的 PC 以便能够相互通信。
敬请回复
