通过 netplan 在 Ubuntu 17.10 上进行 NIC 组合

通过 netplan 在 Ubuntu 17.10 上进行 NIC 组合

尝试使用 netplan 在 Ubuntu 17.10 上进行 NIC 团队合作:

network:
    version: 2
    ethernets:
        switchports:
            match: 
                macaddress: 00:15:5d:ec:d3:07
                macaddress: 00:15:5d:ec:d3:08
            wakeonlan: true
    bridges:
        bond0:
            interfaces: [switchports]
            addresses: [172.30.1.10/18]
            gateway4: 172.30.0.1

应用后无法 ping 网关或从其他网络节点 ping Ubuntu 服务器。我的直觉是我遗漏了一些简单的东西,但阅读文档和其他示例后我不知所措 :/

这里是ip addr show

[...]
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:15:5d:ec:d3:07 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 00:15:5d:ec:d3:08 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ae:1e:0c:06:21:8c brd ff:ff:ff:ff:ff:ff
inet 172.30.1.10/18 brd 172.30.63.255 scope global bond0
    valid_lft forever preferred_lft forever
inet6 fe80::ac1e:cff:fe06:218c/64 scope link
    valid_lft_forever preferred_lft forever
[...]

更新 1:正如 Mark Wagner 指出的那样bridges进行更改。bonds:

现在 Ping 网关可以工作,但是 DNS 解析却不工作。

ping google.com
ping: google.com: Temporary failure in name resolution

尝试使用 netplan 手动设置名称服务器但仍然没有成功:

network:
    version: 2
....
        gateway4: 172.30.0.1
        nameservers: 
            addresses: [172.30.0.1, 8.8.8.8]

以下是 的内容cat /proc/net/bonding/bond0

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:15:5d:ec:d3:08
Slave queue ID: 0

更新 2:重启机器修复 DNS

答案1

这是我在 DL380 上为 4 个链路聚合设置的 /etc/netplan/01-netcfg.yaml。

network:
version: 2
renderer: networkd
ethernets:
  enp3s0f0:
    dhcp4: false
    dhcp6: false
  enp3s0f1:
    dhcp4: false
    dhcp6: false
  enp4s0f0: 
    dhcp4: false
    dhcp6: false
  enp4s0f1: 
    dhcp4: false
    dhcp6: false
bonds:
  bond0:
    dhcp4: false
    dhcp6: false
    interfaces: 
      - enp3s0f0
      - enp3s0f1
      - enp4s0f0
      - enp4s0f1
    addresses: [192.168.1.156/24]
    gateway4: 192.168.1.1
    parameters:
      mode: 802.3ad
    nameservers:
      addresses: [8.8.8.8,8.8.4.4,84.200.69.80,84.200.70.40]

答案2

需要三处修复:

  1. 变成。bridgesbonds
  2. 已添加名称服务器
  3. 为了实现真正的 NIC 组合弹性,将两个 NIC 拆分为 bond0 的单独接口

最终网络规划:

network:
    version: 2
    ethernets:
        eth0:
            match: 
                macaddress: 00:15:5d:ec:d3:07
            wakeonlan: true
        eth1:
            match:               
                macaddress: 00:15:5d:ec:d3:08
            wakeonlan: true
    bonds:
        bond0:
            interfaces: [eth0, eth1]
            addresses: [172.30.1.10/18]
            gateway4: 172.30.0.1
            nameservers:
                addresses: [172.30.0.1]

相关内容