单端口机器到交换机之间的 VLAN 中继

网络工程 转变 局域网 界面
2022-02-20 08:59:05

我有这个设置有点低端,因为我用完了测试服务器来测试所以我只是尽我所能来实现目标设置。通常我会使用刀片式或机架式服务器。

所以我通常在机架式服务器中的设置将有一个 4 个以太网端口,但在台式机上它只有 1 个,所以我所做的就是拥有一个 4 个以太网端口,将其设置为 VLAN,(eth1.100,eth2 .100 等)并将其连接到 2950 cisco 交换机。我将连接到机器的端口配置为中继,因此所有 VLAN 都将通过它。至于为什么我需要这些 vlan 是因为我需要 4 个端口,这是对台式机的限制(购买 NIC 4 端口不是一个选项,所以我会坚持这个设置)。

现在,我的问题是我无法将 PC0 中的 1.1.1.1 ping 到 PC1 中的 1.1.1.2,即使我已经将这些端口配置为中继。请参阅下图以获得更易于理解的设置。另外,我读到当您配置 VLAN / 子接口时,物理端口将自动处于中继模式

在此处输入图像描述

我究竟做错了什么?

顺便说一句,作为附加信息,我将其测试到普通交换机(不是托管的,只是普通的家用交换机,我得到了成功的 ping)

大家都知道,我无法在数据包跟踪器上测试我的设置,因为我无法在数据包跟踪器中的 PC 机器上配置 VLAN(子接口),上图只是为了让每个人都能清楚地了解我的设置。日志、设置、配置是不可用的,因为它是孤立的。

更新:

sw1#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1
Fa0/2       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/1       1-1005
Fa0/2       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1,100
Fa0/2       1,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,100
Fa0/2       1,100

sw1#

sw1#show interfaces fa0/1
FastEthernet0/1 is up, line protocol is up (connected)
  Hardware is Lance, address is 0030.a311.5301 (bia 0030.a311.5301)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
sw1#show interfaces fa0/2
FastEthernet0/2 is up, line protocol is up (connected)
  Hardware is Lance, address is 0030.a311.5302 (bia 0030.a311.5302)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
sw1#

sw1#show interfaces switchport 
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none

Name: Fa0/2
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none
1个回答

首先,在不同的VLAN中拥有一个带有子接口的端口与拥有四个端口并不是一回事。在不同 VLAN 中拥有这么多 NIC 的机器通常是个坏主意。作为一个网络人,我不相信服务器知道它应该向哪个接口发送流量。在您的场景中,您能否确定原始 ping 请求来自哪个 NIC?如果不是每次都是 eth1.100,ping 就会失败。如果它从 eth1.100 发出,并且当 PC1 接收到它时,它也可能会失败,该机器将回复发送到除 eth1.100 之外的任何接口。

您可以在机器上使用wireshark 捕获来查找数据包的来/去。

在交换机上执行 ashow mac address-table并查看 MAC 地址显示在哪个 VLAN 上。虽然,根据您的配置,这可能会根据 PC 的意愿进行更改。

根据您的输出,实际上只有 VLAN 100 被中继到两台 PC。因此,您缺少 200、300 和 400。验证这些 VLAN 是否在交换机上使用show vlan.