在 Ubuntu 22.04 上配置 VLAN

在 Ubuntu 22.04 上配置 VLAN

我尝试在一个物理接口上配置 2 个 VLAN ens33。并ens34用于访问互联网,但我无法从其他主机 ping 通虚拟机。虚拟机网络适配器位于 192.168.100.0/22 网络中。

/etc/netplan/00-installer-config.yaml

  ethernets:
    ens33:
      dhcp4: true
    ens34:
      dhcp4: true
  version: 2
  vlans:
    ens33.100:
      id: 100
      link: ens33
      addresses:
      - 192.168.100.70/24
    ens33.101:
      id: 101
      link: ens33
      addresses:
      - 192.168.101.70/24

ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:86:1c:1d brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet6 fe80::20c:29ff:fe86:1c1d/64 scope link
       valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:86:1c:27 brd ff:ff:ff:ff:ff:ff
    altname enp2s2
    inet 192.168.0.5/24 metric 100 brd 192.168.0.255 scope global dynamic ens34
       valid_lft 86371sec preferred_lft 86371sec
    inet6 fe80::20c:29ff:fe86:1c27/64 scope link
       valid_lft forever preferred_lft forever
4: ens33.100@ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:29:86:1c:1d brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.70/24 brd 192.168.100.255 scope global ens33.100
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe86:1c1d/64 scope link
       valid_lft forever preferred_lft forever
5: ens33.101@ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:29:86:1c:1d brd ff:ff:ff:ff:ff:ff
    inet 192.168.101.70/24 brd 192.168.101.255 scope global ens33.101
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe86:1c1d/64 scope link
       valid_lft forever preferred_lft forever

支持802.1q:

root@gateway:~# lsmod | grep 8021q
8021q                  36864  0
garp                   20480  1 8021q
mrp                    20480  1 8021q

并且两个虚拟机之间的流量未标记,主机 192.168.100.70 不回复 ARP 消息。交通

你能帮我找出问题所在吗?

相关内容