我想为三个容器创建一个桥接网络,具有静态 IP 地址并通过主机的以太网卡连接到互联网。
例如,使用名为的桥letce0
和名为的容器的虚拟接口backchan0
,运行该命令ifconfig
应该返回类似的内容
我知道,如果我没记错的话,我必须先通过 Netplan 创建桥接网络。在/etc/netplan我有文件01-网络管理器-全部.yaml包含:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
这是我的接口的情况:
andrea@andrea-System-Product-Name:~$ ifconfig
enp4s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether bc:ae:c5:32:64:b5 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17
enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 131.114.55.127 netmask 255.255.252.0 broadcast 131.114.55.255
inet6 fe80::519f:be0a:dcba:2f09 prefixlen 64 scopeid 0x20<link>
inet6 2001:760:2c0c:701:1197:2c47:bb0e:4ee2 prefixlen 64 scopeid 0x0<global>
inet6 2001:760:2c0c:701:1520:ef2c:7e1b:4008 prefixlen 64 scopeid 0x0<global>
ether bc:ae:c5:32:64:b6 txqueuelen 1000 (Ethernet)
RX packets 139573 bytes 17012757 (17.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5793 bytes 862761 (862.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 18
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Loopback locale)
RX packets 1148 bytes 100637 (100.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1148 bytes 100637 (100.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lxcbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.3.1 netmask 255.255.255.0 broadcast 0.0.0.0
ether 00:16:3e:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:ee:91:fe txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp6s0
以太网卡连接到互联网在哪里。
我找到了几个教程,但发现针对的是以前版本的 Ubuntu(像这样:https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/configure-bridged-networking-for-kvm-on-ubuntu-14-10.html)。
有人能帮助我吗?
非常感谢!!
安德里亚