Centos

vlan 沒用?

  • February 22, 2019

我有 2 台主機,通過交換機連接。交換機上沒有配置vlan。

在主機 A 上:

5: enp5s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether 0c:c4:7a:58:ef:95 brd ff:ff:ff:ff:ff:ff
   inet 192.168.10.11/24 brd 192.168.10.255 scope global enp5s0f1
      valid_lft forever preferred_lft forever
   inet 192.168.10.10/24 scope global secondary enp5s0f1
      valid_lft forever preferred_lft forever
   inet6 fe80::ec4:7aff:fe58:ef95/64 scope link 
      valid_lft forever preferred_lft forever
[root@ceph-node1 ~]# ip addr show enp5s0f1.1001
24: enp5s0f1.1001@enp5s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
   link/ether 0c:c4:7a:58:ef:95 brd ff:ff:ff:ff:ff:ff
   inet 172.16.0.1/24 scope global enp5s0f1.1001
      valid_lft forever preferred_lft forever
   inet6 fe80::ec4:7aff:fe58:ef95/64 scope link 
      valid_lft forever preferred_lft forever

在主機 B 上:

5: enp5s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether 0c:c4:7a:59:a9:5b brd ff:ff:ff:ff:ff:ff
   inet 192.168.10.12/24 brd 192.168.10.255 scope global enp5s0f1
      valid_lft forever preferred_lft forever
   inet6 fe80::ec4:7aff:fe59:a95b/64 scope link 
      valid_lft forever preferred_lft forever
[root@ceph-node2 ~]# ip addr show enp5s0f1.1001
8: enp5s0f1.1001@enp5s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
   link/ether 0c:c4:7a:59:a9:5b brd ff:ff:ff:ff:ff:ff
   inet 172.16.0.2/24 scope global enp5s0f1.1001
      valid_lft forever preferred_lft forever
   inet6 fe80::ec4:7aff:fe59:a95b/64 scope link 
      valid_lft forever preferred_lft forever

主機 A 在非 vlan 介面上 ping 主機 B:

[root@ceph-node1 ~]# ping 192.168.10.12
PING 192.168.10.12 (192.168.10.12) 56(84) bytes of data.
64 bytes from 192.168.10.12: icmp_seq=1 ttl=64 time=0.169 ms
64 bytes from 192.168.10.12: icmp_seq=2 ttl=64 time=0.241 m

s

但是當 A 在 VLAN 介面上 ping 主機 B

[root@ceph-node1 ~]# ping 172.16.0.2
PING 172.16.0.2 (172.16.0.2) 56(84) bytes of data.
From 172.16.0.1 icmp_seq=1 Destination Host Unreachable
From 172.16.0.1 icmp_seq=2 Destination Host Unreachable

作業系統是 Cents7

請給我線索來解決這個問題

真摯地

如果標記的數據包不屬於在交換機埠上配置的 VLAN,則交換機會丟棄這些數據包。

因此,如果您在伺服器上使用 vlan,則可以在交換機上設置 vlan。

也看看這個問題/答案

引用自:https://serverfault.com/questions/955207