Loading

VLAN over bond 正确配置

今天临下班的时候别组的同事同步过来一个case,客户的vm有一台网络不通。

case info:

长话短说,已知vlantag和网卡绑定配置如下:

[root@VM-48-21~]#vconfig add team1 192
[root@VM-48-21~]#ifconfig team1.192 up
[root@VM-48-21~]#brctl addif brq96f60df8-b0 team1.192
[root@VM-48-21~]# brctl show
bridge name		bridge id		STP enabled	interfaces
brq96f60df8-b0		8000.264efc8acad0	no		tap7638d16c-fd
								tapce0c079a-f1
								team1.192

虚拟机网络配置如下

...
<interface type='bridge'>
      <mac address='fa:16:3e:a8:05:23'/>
      <source bridge='brq96f60df8-b0'/>
      <target dev='tapce0c079a-f1'/>
      <model type='virtio'/>
      <driver name='vhost' queues='8'/>
      <mtu size='1500'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

问题:在vm上往外ping,在宿主机上抓包,tcpdump -i tap7638d16c-fd icmp -nn -e
在网桥brq96f60df8-b0,接口tap7638d16c-fd,tapce0c079a-f1上可以抓到出来的icmp报文。
在新增的vlan子接口上无法抓到icmp报文。

尽管最后通过把网卡设备直接绑定到vm上解决,但后来找红帽确认了下,答复如下:

"Hello,

I'm Jon from Red Hat Networking, teaming is redundant in Rhel 9, as teamd has had lots of issues.

I recommend to change your configuration to bonding instead.
https://access.redhat.com/solutions/24474

The above solution should work for Rhel 7 also.

推荐配置

bond with modeX

# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"

Configure the VLAN interface

# cat /etc/sysconfig/network-scripts/ifcfg-bond0.2
DEVICE=bond0.2
BOOTPROTO=none
IPADDR=192.168.1.1
NETMASK=255.255.255.0
USERCTL=no
VLAN=yes
ONPARENT=yes

Restart networking:

# service network restart
or ifup ifcfg.xxx
posted @ 2022-12-14 23:19  motorao  阅读(87)  评论(0编辑  收藏  举报