无法桥接两个组合接口 - 有建议吗?

无法桥接两个组合接口 - 有建议吗?

在开始写代码之前,我先解释一下情况。我试图设置两个接口来将它们组合在一起,然后从这个组合中创建一个桥梁。

我一直在学习 RHCE,我相信这种情况可能会出现在测试中,所以我一直在努力把它记下来,但是在我所有的测试中我都无法让它正常工作。设置结束时,网桥似乎已存在,但没有为其分配 IP,并且无法 ping 通网关。

测试环境是kvm中的虚拟机,我一直在使用内部网络。

Starting Interfaces

4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:7c:68:d0 brd ff:ff:ff:ff:ff:ff

Creating Team w/ ens10 & ens11

  nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
  Connection 'team0' (75299245-c21f-4bfc-8c21-1728378d5a33) successfully added.

  nmcli con add type team-slave con-name team0-port1 ifname ens10 master team0 Connection 'team0-port1' (68ee3568-bb1d-4f66-a2a2-31ea756da2f4) successfully added.

  nmcli con add type team-slave con-name team0-port2 ifname ens11 master team0 Connection 'team0-port2' (0569a1de-2280-4087-b026-2e22afc11c79) successfully added.


  teamdctl team0 state
  setup:
    runner: activebackup
  ports:
    ens10
      link watches:
        link summary: up
        instance[link_watch_0]:
          name: ethtool
          link: up
    ens11
      link watches:
        link summary: up
        instance[link_watch_0]:
          name: ethtool
          link: up
  runner:
    active port: ens10

  6: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet 192.168.100.136/24 brd 192.168.100.255 scope global dynamic team0
         valid_lft 3460sec preferred_lft 3460sec
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever

  Teamed Interface Pinging Gateway

  ping -I team0 192.168.100.1

  PING 192.168.100.1 (192.168.100.1) from 192.168.100.136 team0: 56(84) bytes of data.
  64 bytes from 192.168.100.1: icmp_seq=10 ttl=64 time=0.703 ms
  64 bytes from 192.168.100.1: icmp_seq=11 ttl=64 time=0.253 ms
  64 bytes from 192.168.100.1: icmp_seq=12 ttl=64 time=0.239 ms
  64 bytes from 192.168.100.1: icmp_seq=13 ttl=64 time=0.244 ms
  64 bytes from 192.168.100.1: icmp_seq=14 ttl=64 time=0.240 ms
  64 bytes from 192.168.100.1: icmp_seq=15 ttl=64 time=0.290 ms ^C
  --- 192.168.100.1 ping statistics ---
  15 packets transmitted, 6 received, 60% packet loss, time 14000ms rtt min/avg/max/mdev = 0.239/0.328/0.703/0.168 ms


Bridge Setup

  yum install -y bridge-utils

  systemctl disable NetworkManager
  rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
  rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
  rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'

  systemctl stop NetworkManager

  echo 'BRIDGE=brteam0' >> /etc/sysconfig/network-scripts/ifcfg-team0
  cat /etc/sysconfig/network-scripts/ifcfg-team0

  DEVICE=team0
  TEAM_CONFIG="{\"runner\": {\"name\": \"activebackup\"}}"
  DEVICETYPE=Team
  BOOTPROTO=dhcp
  DEFROUTE=yes
  PEERDNS=yes
  PEERROUTES=yes
  IPV4_FAILURE_FATAL=no
  IPV6INIT=yes
  IPV6_AUTOCONF=yes
  IPV6_DEFROUTE=yes
  IPV6_PEERDNS=yes
  IPV6_PEERROUTES=yes
  IPV6_FAILURE_FATAL=no
  NAME=team0
  UUID=75299245-c21f-4bfc-8c21-1728378d5a33
  ONBOOT=yes
  BRIDGE=brteam0


  cat /etc/sysconfig/network-scripts/ifcfg-team0-port1

  NAME=team0-port1
  UUID=68ee3568-bb1d-4f66-a2a2-31ea756da2f4
  DEVICE=ens10
  ONBOOT=yes
  TEAM_MASTER=team0
  DEVICETYPE=TeamPort

  cat /etc/sysconfig/network-scripts/ifcfg-team0-port2

  NAME=team0-port2
  UUID=0569a1de-2280-4087-b026-2e22afc11c79
  DEVICE=ens11
  ONBOOT=yes
  TEAM_MASTER=team0
  DEVICETYPE=TeamPort

  cat /etc/sysconfig/network-scripts/ifcfg-brteam0

  DEVICE=team0
  ONBOOT=yes
  TYPE=Bridge
  IPADDR0=192.168.100.100
  PREFIX0=24



  systemctl restart network


Bridge Interface Stays Down With No IP?

  4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever
  5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe7c:68d0/64 scope link
         valid_lft forever preferred_lft forever
  7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master brteam0 state UP
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever
  8: brteam0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff

Turn Up Interface And Still No IP?

  ip link set brteam0 up

  4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever
  5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe7c:68d0/64 scope link
         valid_lft forever preferred_lft forever
  7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master brteam0 state UP
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever
  8: brteam0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
      link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
      inet6 fe80::5054:ff:fe60:2623/64 scope link
         valid_lft forever preferred_lft forever


Bridge Shows Active Interfaces?

  brctl show

  bridge name     bridge id               STP enabled     interfaces
  brteam0         8000.525400602623       no              team0

答案1

  1. 您可能想要从 ifcfg-team0 中删除 ip 参数(BOOTPROTO,...),因为它们现在是在 ifcfg-brteam0 中定义的。

    ifcfg-team0 可以短至:

    DEVICE=team0
    TEAM_CONFIG="{\"runner\": {\"name\": \"activebackup\"}}"
    DEVICETYPE=Team
    NAME=team0
    UUID=75299245-c21f-4bfc-8c21-1728378d5a33
    ONBOOT=yes
    BRIDGE=brteam0
    
  2. 在ifcfg-brteam0中,应修改DEVICE值,例如:

    DEVICE=brteam0
    

    ifcfg-team0 已使用该值,而不是 OP 中的 team0。

相关内容