与第二个以太网端口共享网络 ubuntu 17.10

与第二个以太网端口共享网络 ubuntu 17.10

我想从 enp1s9 共享网络,第二个接口为 enp1s10。Windows 桥接适配器中具有相同的功能。我尝试使用桥接和绑定,但没有成功。由于 ubuntu 17.10,我正在使用 netplan。

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 ethernets:
  enp1s9:
   dhcp4: no
   dhcp6: no
   addresses: [192.168.0.100/24]
   gateway4: 192.168.0.1
   wakeonlan: true
   nameservers:
     addresses: [8.8.8.8,8.8.4.4]
  enp1s10:
   dhcp4: true
   dhcp6: true

我必须如何修改 netplan?

谢谢你的帮助。

答案1

您需要定义一座桥梁。正如 Ken Sharp 所说,这是文档

network:
version: 2
renderer: networkd
ethernets:
     enp1s9:
        dhcp4: false
     enp1s10:
        dhcp4: false
bridges:
    br0:
        interfaces: [ethernets]
        dhcp4: true
        parameters:
            stp: false
            forward-delay: 0

理论上这应该可行。我没有测试过,因为我手边没有可以安装 netplan 的盒子。

答案2

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 ethernets:
     enp1s9:
      dhcp4: false
      dhcp6: false
      addresses: [192.168.0.100/24]
      gateway4: 192.168.0.1
      wakeonlan: true
      nameservers:
       addresses: [8.8.8.8,8.8.4.4]
     enp1s10:
        dhcp4: true
 bridges:
      br0:
        interfaces: [enp1s9, enp1s10]
        dhcp4: true
        parameters:
            stp: false
            forward-delay: 0

相关内容