ubuntu 22.04 使用 netplan 设置网桥

  • 添加/编辑 /etc/netpaln/br0.yaml
  • 动态IP
network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [eno1]
      dhcp4: true
      parameters:
        stp: false
      dhcp6: false
  • 静态IP
network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [eno1]
      dhcp4: false
      addresses: [192.168.0.13/24]
      routes:
        - to: default
          via: 192.168.0.1
      nameservers:
        addresses: [114.114.114.114]
      parameters:
        stp: false
      dhcp6: false
  • 启用配置
sudo netplan apply

更多配置:https://netplan.io/examples#integration-with-a-windows-dhcp-server