我无法 ping 交换机到设备,但可以 ping 设备到设备

网络工程 思科 转变 交换 数据包跟踪器
2022-02-09 17:41:11

我目前正在对我构建的网络进行故障排除,我遇到了 ping 连接问题,我已经设置了 DHCP 和 DNS,我的终端设备可以从 DHCP 获取 IP,并且我有 intervlan 连接,我的所有终端设备都可以相互 ping,以及我的路由器可以 ping 我的终端设备,但我的 2 个交换机都无法 ping 这些设备中的任何一个。如果有人能告诉我我在配置中忽略了什么,将不胜感激,谢谢!

这是我的路由器配置

hostname ChinaRouter
!
!
!
!
ip dhcp excluded-address 192.168.99.2
!
ip dhcp pool Student
 network 192.168.30.0 255.255.255.0
 default-router 192.168.30.254
 dns-server 192.168.99.2
ip dhcp pool Management
 network 192.168.99.0 255.255.255.0
 default-router 192.168.99.254
 dns-server 192.168.99.2
ip dhcp pool VOIP
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.254
 option 150 ip 192.168.10.254
 dns-server 192.168.99.2
ip dhcp pool Instructor
 network 192.168.20.0 255.255.255.0
 default-router 192.168.20.254
 dns-server 192.168.99.2
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO1941/K9 sn FTX15245JP0-
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface GigabitEthernet0/1
 ip address 192.168.0.254 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1.10
 encapsulation dot1Q 10
 ip address 192.168.10.254 255.255.255.0
!
interface GigabitEthernet0/1.20
 encapsulation dot1Q 20
 ip address 192.168.20.254 255.255.255.0
!
interface GigabitEthernet0/1.30
 encapsulation dot1Q 30
 ip address 192.168.30.254 255.255.255.0
!
interface GigabitEthernet0/1.99
 encapsulation dot1Q 99
 ip address 192.168.99.254 255.255.255.0
!
interface Serial0/1/0
 no ip address
 clock rate 2000000
 shutdown
!
interface Serial0/1/1
 no ip address
 clock rate 2000000
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 1
 log-adjacency-changes
 passive-interface GigabitEthernet0/0
 passive-interface GigabitEthernet0/1
 network 192.168.10.0 0.0.0.255 area 0
 network 192.168.20.0 0.0.0.255 area 0
 network 192.168.30.0 0.0.0.255 area 0
 network 192.168.99.0 0.0.0.255 area 0
!
ip classless
!
ip flow-export version 9
!
!
!
no cdp run
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

这是我的 Switch 1 配置

hostname ChinaSW1
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/2
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/3
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/4
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/5
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/6
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/7
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/8
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/9
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/10
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/11
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/12
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/13
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/14
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/15
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/16
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/17
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/18
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/19
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/20
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/21
 description VOIP
 switchport access vlan 10
 switchport mode access
!
interface FastEthernet0/22
 description Management PC
 switchport access vlan 99
 switchport mode access
!
interface FastEthernet0/23
 description Trunking
 switchport mode trunk
!
interface FastEthernet0/24
 description Trunking
 switchport mode trunk
!
interface GigabitEthernet0/1
 description Connection to router
 switchport mode trunk
!
interface GigabitEthernet0/2
 description Printer
 switchport access vlan 20
 switchport mode access
!
interface Vlan1
 no ip address
 shutdown
!
!
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
!
!
end

这是我的 Switch 2 配置

hostname ChinaSW2
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/2
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/3
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/4
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/5
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/6
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/7
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/8
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/9
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/10
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/11
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/12
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/13
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/14
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/15
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/16
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/17
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/18
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/19
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/20
 description Student PC
 switchport access vlan 30
 switchport mode access
!
interface FastEthernet0/21
 description VOIP
 switchport access vlan 10
 switchport mode access
!
interface FastEthernet0/22
 description Management PC
 switchport access vlan 99
 switchport mode access
!
interface FastEthernet0/23
 description Trunking
 switchport mode trunk
!
interface FastEthernet0/24
 description Trunking
 switchport mode trunk
!
interface GigabitEthernet0/1
 description Connection to router
 switchport mode trunk
!
interface GigabitEthernet0/2
 description Printer
 switchport access vlan 20
 switchport mode access
!
interface Vlan1
 no ip address
 shutdown
!
ip default-gateway 192.168.0.254
!
!
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
!
!
end
2个回答

您的两台交换机都没有配置第 3 层接口,甚至只有一台交换机配置了网关。如果没有地址,您的交换机将无法参与第 2 层以上的任何网络层。

交换发生在第 2 层,非托管交换机无法 ping 或被 ping。具有已配置管理接口(以及能够访问网络而不是配置其管理接口的网络的网关)和地址的托管交换机可以 ping 和被 ping。

在每台交换机上,您需要为其中一个 VLAN 添加 SVI,为其配置 VLAN 网络中的地址,并为同一网络配置网关。这将为您的交换机添加一个管理界面。管理接口就像 VLAN 上的另一台主机,对切换没有任何影响。


此外,您已经在路由器上配置了 OSPF,但这完全没有必要,而且会浪费路由器 CPU 周期并在网络上增加不必要的流量,因为它实际上并没有与任何其他路由器交换路由信息。路由协议不路由;它们只与其他路由器交换路由信息。

在路由器或第 3 层设备上配置网络的 L3 接口时,您可以从此路由器或第 3 层设备 ping 目标,因为当流量为 ping 启动时。

源地址是:设备的源地址 目标地址:目标 ip 地址 源 MAC 地址 目标 MAC 地址

考虑到,目标 IP 地址与 làyer3 设备中的路由条目进行验证,并进一步将数据包相应地转发到路由器中存在的路由条目。

基本上从 layer2 交换机我们无法 ping 因为 layer2 交换机受制于 màv 地址表。当从第 2 层交换机发起 ping 流量时,无法使用 mac -address 表验证目标 IP 地址