ping不通交换机的管理IP

网络工程 思科 路由器 子网
2021-07-25 09:46:18

我的拓扑是:

拓扑

我已登录到 R1。我可以 ping R2 上的 10.0.0.2 和 R2 上的 198.51.100.1,但无法 ping sw3(198.51.100.2)的管理 IP。我究竟做错了什么?

R1#sh ip arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  10.0.0.1                -   0cc1.8f5a.c102  ARPA   GigabitEthernet0/2
Internet  10.0.0.2               11   0cc1.8fc5.c701  ARPA   GigabitEthernet0/2
Internet  10.0.0.5                -   0cc1.8f5a.c101  ARPA   GigabitEthernet0/1
Internet  10.0.0.6               11   0cc1.8f0b.af00  ARPA   GigabitEthernet0/1
Internet  192.0.2.1               -   0cc1.8f5a.c100  ARPA   GigabitEthernet0/0
Internet  192.0.2.2              11   0cc1.8fe9.8001  ARPA   GigabitEthernet0/0

R1#sh ip route
Gateway of last resort is not set
         10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.0.0.0/30 is directly connected, GigabitEthernet0/2
L        10.0.0.1/32 is directly connected, GigabitEthernet0/2
C        10.0.0.4/30 is directly connected, GigabitEthernet0/1
L        10.0.0.5/32 is directly connected, GigabitEthernet0/1
      192.0.2.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.0.2.0/24 is directly connected, GigabitEthernet0/0
L        192.0.2.1/32 is directly connected, GigabitEthernet0/0
S     198.51.100.0/24 [1/0] via 10.0.0.2

R1#ping 198.51.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/13/16 ms
R1#ping 198.51.100.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

更新:我可以ping通通过sw2连接的主机,但不能ping通sw2本身

好吧,我尝试通过 sw2 添加虚拟 PC 并为其分配 IP 地址 198.51.100.5/24,网关为 198.51.100.1。结果我可以从 R1 ping 它,反之亦然,但是 R1 仍然无法 ping sw2 的管理 IP。我们不能从子网外ping交换机的管理IP吗?

R1#ping 198.51.100.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 9/21/37 ms
R1#ping 198.51.100.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

以下是每个设备的运行配置:

R1:

R1#sh run | s net0/2
interface GigabitEthernet0/2
 description Connected to R2
 ip address 10.0.0.1 255.255.255.252
 duplex auto
 speed auto
 media-type rj45
R1#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         192.0.2.1       YES manual up                    up
GigabitEthernet0/1         10.0.0.5        YES manual up                    up
GigabitEthernet0/2         10.0.0.1        YES manual up                    up
GigabitEthernet0/3         unassigned      YES unset  administratively down down

R2:

R2#ping 198.51.100.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/16/23 ms
R2#sh run | s net0/0
interface GigabitEthernet0/0
 description Connected to sw2
 ip address 198.51.100.1 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
R2#sh run | s net0/1
interface GigabitEthernet0/1
 description Connected to R1
 ip address 10.0.0.2 255.255.255.252
 duplex auto
 speed auto
 media-type rj45
R2#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         198.51.100.1    YES manual up                    up
GigabitEthernet0/1         10.0.0.2        YES manual up                    up
GigabitEthernet0/2         unassigned      YES unset  administratively down down
GigabitEthernet0/3         unassigned      YES unset  administratively down down

R2#sh ip route
Gateway of last resort is not set
         10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, GigabitEthernet0/1
L        10.0.0.2/32 is directly connected, GigabitEthernet0/1
      198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks
C        198.51.100.0/24 is directly connected, GigabitEthernet0/0
L        198.51.100.1/32 is directly connected, GigabitEthernet0/0

sw2:

sw2#sh run | s net0/0
interface GigabitEthernet0/0
 description Connected to R2
 media-type rj45
 negotiation auto
sw2#sh run | s vlan
vlan internal allocation policy ascending
sw2#sh run | s Vlan
interface Vlan1
 ip address 198.51.100.2 255.255.255.0
sw2#sh ip int br
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0     unassigned      YES unset  up                    up
GigabitEthernet0/1     unassigned      YES unset  administratively down down
GigabitEthernet0/2     unassigned      YES unset  administratively down down
GigabitEthernet0/3     unassigned      YES unset  administratively down down
Vlan1                  198.51.100.2    YES manual up                    up
2个回答

我们可以从子网外 ping 交换机的管理 IP 地址吗?

我们当然可以。

看起来您需要在交换机上设置路由。它必须有一个路由,其中​​包括10.0.0.0/30一个默认路由。它还不需要阻塞 ACL。

有时您必须将管理型交换机视为两个设备:

  • 一个2层通信设备转发帧(你的一个作品,你可以用地址198.51.100.5/24上SW2交换R1和PC之间的数据包和默认路由到R2。
  • 第 3 层管理设备插入第 2 层设备的 VLAN 之一。这是您与之通信以配置交换机行为的主机。这个主机需要一个 IP 地址、IP 路由、ACL、用户名、密码,以便它可以被正确的人从网络上的各个地方控制(而且只有正确的地方和人!)

想象一个带有重置按钮的非托管交换机:

  • 交换机没有 IP 地址或配置
  • 但是当你想重置开关时,你可以在它旁边放一个支持网络的机器人,并通过 SSH 连接到机器人

像每个主机一样,机器人需要一个 IP 地址。如果您想从本地 LAN 连接到它,它还需要路由。

托管交换机是具有非常强大的网络启用机器人的交换机,通常由 SSH 或 HTTP 控制。

事实上,拥有这样一个单独的“机器人”是很常见的:网络控制的配电,用于远程电源循环设备,在您无法轻松访问的机架中非常常见。将“终端服务器”通过 RS-232 连接到许多控制台端口也很常见。在过去,Cisco 2511,现在可能来自 Lantronix,位于机架顶部,连接到机架中所有路由器和交换机的控制台端口。

因为您希望这些机器人/管理界面只能由授权人员访问,所以通常会设置各种 ACL。在生产网络中,只能从很少的地方与管理接口交换数据包是很常见的。但几乎托管交换机的全部意义在于,网络团队可以从子网外部管理交换机。

请确保在所有路由器上配置静态路由,以便从每个路由器到达管理 IP 地址。

*在路由器R1

Router1(config)# destination 198.51.100.0 subnet 255.255.255.0 pointing towards gateway 10.0.0.2

Router(config)#destination 198.51.100.0 subnet 255.255.255.0 pointing towards gateway 10.0.0.6

在路由器 2 中

Router1(config)# destination 198.51.100.0 subnet 255.255.255.0 pointing towards gateway 10.0.0.1

在路由器 3

Router1(config)# destination 198.51.100.0 subnet 255.255.255.0 pointing towards gateway 10.0.0.5