Ubuntu使用netplan创建网桥

方法一:手动修改配置文件

vi /etc/netplan/00-installer-config.yaml

network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [eno1]
      dhcp4: false
      addresses: [192.168.1.245/24]
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [114.114.114.114, 202.106.0.20]
      parameters:
        stp: false
      dhcp6: false

应用修改:

netplan apply

方法二:使用 virsh 命令

#创建网桥
virsh iface-bridge eno1 br0
# 查看网桥,需要安装 bridge-utils
brctl show

Related Posts