CentOS의 트렁크 포트 간 VLAN 전환

CentOS의 트렁크 포트 간 VLAN 전환

저는 CentOS Linux 버전 8.3.2011을 사용하고 있으며 이를 스위치로 설정하는 데 어려움을 겪고 있습니다. 네트워크 토폴로지는 다음과 같습니다.

[switch1]--------[vsphere]--------------[centos]--------------------[vRouter]
     gi0/0     vmnic2   SW1-trunk   end224   lnkbe296edcl2b     Gi0/0.10
                     SW1                bridge11

토폴로지 1

요약하면 다음과 같습니다.

  • 물리적 스위치 switch1, 인터페이스 gi0/0은 트렁크로 구성되고 일부 스위치 가상 인터페이스는 테스트를 위해 IP 주소로 구성됩니다. 이 테스트에서는 IP 주소가 192.168.0.10/24인 인터페이스 vlan 10을 사용합니다.
  • 포트 그룹 "SW1 - 트렁크" 및 물리적 어댑터 vmnic2를 포함하는 vSwitch SW1이 포함된 vSphere 하이퍼바이저입니다. 포트 그룹은 vmware에서 포트를 트렁크로 구성하는 방법인 VLAN ID 4095로 구성됩니다.
  • CML이라고 하는 CentOS VM은 KVM을 사용하여 가상 네트워크 기능을 호스팅합니다. 나는 그것에 가상 라우터를 구성했습니다. 나는 bridge11을 생성하고 vmware 연결 인터페이스(ens224)와 vrouter 연결 인터페이스(lnkbe296edcl2b)를 여기에 연결했습니다.
  • IOSv(Cisco IOS 가상화)인 vRouter에는 IP 주소가 192.168.0.11/24인 IP 하위 인터페이스가 있습니다.

vSphere 토폴로지는 다음과 같습니다.

이 구성에서는 vRouter(192.168.0.11)에서 switch1 SVI(192.168.0.10)로 ping을 보낼 수 없습니다.

R1#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         unassigned      YES manual up                    up      
GigabitEthernet0/0.10      192.168.0.11    YES TFTP   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    
R1#ping 192.168.0.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1#sh arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.0.10            0   Incomplete      ARPA   
Internet  192.168.0.11            -   5254.0000.b61d  ARPA   GigabitEthernet0/0.10
R1#

네트워크 토폴로지를 다음 중 하나로 변경하는 경우:

[switch1]--------[vsphere]--------------[centos]--------------------[vRouter]
     gi0/0     vmnic2   SW1-trunk  end224.10   lnkbe296edcl2b     Gi0/0
                     SW1                bridge11

토폴로지 2 이 토폴로지에서는 다음을 수행합니다.

  • 저는 centos에서 vmware의 하위 인터페이스를 사용하고 있으므로 브리지에서 태그가 지정되지 않은 트래픽을 수신하여 태그가 지정된 VMWare 포트 그룹 SW1-trunk로 보냅니다.
  • 라우터의 기본 인터페이스를 사용하고 있습니다. 따라서 트래픽에는 태그가 지정되지 않습니다.
  • 테스트를 위해 bridge11 - 192.168.0.1/24에 IP 주소를 추가했습니다.

이 경우 브리지 11에서 스위치 1로, 브리지 11에서 vRouter로 ping할 수 있지만 vRouter에서 스위치 1로는 ping할 수 없습니다.

  • CentOS 테스트:
[~]$ping -c5 -q 192.168.0.11
PING 192.168.0.11 (192.168.0.11) 56(84) bytes of data.

--- 192.168.0.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 11ms
rtt min/avg/max/mdev = 1.718/2.151/2.879/0.407 ms
[~]$ping -c5 -q 192.168.0.10
PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.

--- 192.168.0.10 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 103ms
rtt min/avg/max/mdev = 0.398/0.515/0.656/0.090 ms
[~]$ip nei show dev bridge11
192.168.0.10 lladdr 00:12:43:7e:4b:c1 STALE
192.168.0.11 lladdr 52:54:00:00:b6:1d STALE
[~]$
  • vRouter(R1) 테스트:
R1#ping 192.168.0.1 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
R1#ping 192.168.0.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1#show arp         
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.0.1             0   000c.2997.7368  ARPA   GigabitEthernet0/0
Internet  192.168.0.10            0   Incomplete      ARPA   
Internet  192.168.0.11            -   5254.0000.b61d  ARPA   GigabitEthernet0/0
R1#

검색한 결과 Linux의 트래픽 표시 해제 및 라우팅에 대한 참조만 찾았습니다. IP 헤더를 보지 않고 VLAN 스위치 역할을 하려면 Linux가 필요합니다.

CentOS에서 VLAN 트래픽을 전환(트렁크에서 트렁크 포트로)하는 방법에 대한 팁이 있습니까?

미리 감사드립니다


편집(21/5/16) - AB가 요청한 명령의 출력 포함:

[sysadmin]$sysctl -ne net.bridge.bridge-nf-call-iptables
0
[sysadmin]$tcpdump -e -n -i lnk2fb2a645ld1
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lnk2fb2a645ld1, link-type EN10MB (Ethernet), capture size 262144 bytes
18:00:26.276792 52:54:00:00:b6:1d > 01:00:0c:cc:cc:cc, 802.3, length 396: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 388: CDPv2, ttl: 180s, Device-ID 'R1', length 388
18:00:31.178085 52:54:00:00:b6:1d > 52:54:00:00:b6:1d, ethertype Loopback (0x9000), length 60: Loopback, skipCount 0, Reply, receipt number 0, data (40 octets)
18:00:35.482297 52:54:00:00:b6:1d > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 10, p 0, ethertype ARP, Request who-has 192.168.0.10 tell 192.168.0.11, length 46
18:00:39.480774 52:54:00:00:b6:1d > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 10, p 0, ethertype ARP, Request who-has 192.168.0.10 tell 192.168.0.11, length 46
18:00:41.177503 52:54:00:00:b6:1d > 52:54:00:00:b6:1d, ethertype Loopback (0x9000), length 60: Loopback, skipCount 0, Reply, receipt number 0, data (40 octets)
18:00:41.480474 52:54:00:00:b6:1d > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 10, p 0, ethertype ARP, Request who-has 192.168.0.10 tell 192.168.0.11, length 46
18:00:41.655353 52:54:00:00:b6:1d > ab:00:00:02:00:00, ethertype MOP RC (0x6002), length 77: 
        0x0000:  3d00 0700 0000 0100 0303 0000 0200 0221  =..............!
        0x0010:  0003 0006 0000 0000 0000 0400 023c 0005  .............<..
        0x0020:  0002 d805 0600 0200 0107 0006 5254 0000  ............RT..
        0x0030:  b61d 6400 0179 9001 0101 9101 02ee 05    ..d..y.........
18:00:43.480161 52:54:00:00:b6:1d > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 10, p 0, ethertype ARP, Request who-has 192.168.0.10 tell 192.168.0.11, length 46
^C
8 packets captured
8 packets received by filter
0 packets dropped by kernel
[sysadmin]$

편집(21/5/16) - AB가 요청한 추가 명령 출력이 포함되었습니다.

$ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master bridge0 state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:54 brd ff:ff:ff:ff:ff:ff
3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master bridge1 state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:5e brd ff:ff:ff:ff:ff:ff
4: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master bridge11 state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:68 brd ff:ff:ff:ff:ff:ff
5: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:72 brd ff:ff:ff:ff:ff:ff
6: bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:54 brd ff:ff:ff:ff:ff:ff
7: bridge1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:5e brd ff:ff:ff:ff:ff:ff
10: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:90:2d:88 brd ff:ff:ff:ff:ff:ff
11: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:90:2d:88 brd ff:ff:ff:ff:ff:ff
44: bridge11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:97:73:68 brd ff:ff:ff:ff:ff:ff
45: lnk2fb2a645ld1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bridge11 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether f2:ca:f4:6e:96:14 brd ff:ff:ff:ff:ff:ff
$ip -br link show
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
ens160           UP             00:0c:29:97:73:54 <BROADCAST,MULTICAST,UP,LOWER_UP> 
ens192           UP             00:0c:29:97:73:5e <BROADCAST,MULTICAST,UP,LOWER_UP> 
ens224           UP             00:0c:29:97:73:68 <BROADCAST,MULTICAST,UP,LOWER_UP> 
ens256           UP             00:0c:29:97:73:72 <BROADCAST,MULTICAST,UP,LOWER_UP> 
bridge0          UP             00:0c:29:97:73:54 <BROADCAST,MULTICAST,UP,LOWER_UP> 
bridge1          UP             00:0c:29:97:73:5e <BROADCAST,MULTICAST,UP,LOWER_UP> 
virbr0           DOWN           52:54:00:90:2d:88 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
virbr0-nic       DOWN           52:54:00:90:2d:88 <BROADCAST,MULTICAST> 
bridge11         UP             00:0c:29:97:73:68 <BROADCAST,MULTICAST,UP,LOWER_UP> 
lnk2fb2a645ld1   UNKNOWN        f2:ca:f4:6e:96:14 <BROADCAST,MULTICAST,UP,LOWER_UP> 
$ip -br address
lo               UNKNOWN        127.0.0.1/8 ::1/128 
ens160           UP             
ens192           UP             
ens224           UP             
ens256           UP             
bridge0          UP             10.30.8.241/22 fe80::20c:29ff:fe97:7354/64 
bridge1          UP             x.x.x.x/25 fe80::20c:29ff:fe97:735e/64 
virbr0           DOWN           192.168.255.1/24 
virbr0-nic       DOWN           
bridge11         UP             fe80::20c:29ff:fe97:7368/64 
lnk2fb2a645ld1   UNKNOWN        
$

답변1

이 작업을 수행하려면 다음 두 가지 작업을 수행해야 합니다.

  1. vlan_filtering 비활성화(ip 링크 세트 devbridge11 유형 브리지 vlan_filtering 0)
  2. vmware vSphere에서 무차별 모드 및 가짜 전송 활성화(아래 참조)

여기에 이미지 설명을 입력하세요.

관련 정보