摘要:如何在主机上配置 netplan 以创建将在来宾虚拟机(应可从本地局域网访问)上使用的网桥(具有静态 IP 地址)。
我使用的是 32 位 Ubuntu 17.10。计划 0.32~17.10.1。
我正在尝试配置一个应该可以从本地网络访问的 linux 虚拟容器。但是我无法使用 nplan 在主机上配置网桥。
我尝试遵循以下指南但没有成功:
https : //discuss.linuxcontainers.org/t/static-ip-for-containers-with-local-lan-access/817
该指南配置了一个带有两个 NIC 的主机系统. 我的主机只有一个接口。
我仍在处理主机上的 nplan 配置。我在主机上的 nplan 配置如下:
network:
version: 2
renderer: networkd
ethernets:
ens32:
dhcp4: no
dhcp6: no
addresses: [10.0.0.247/24]
gateway4: 10.0.0.138
nameservers:
addresses: [10.0.0.138,8.8.8.8,8.8.4.4]
bridges:
br0:
interfaces: [ens32]
dhcp4: no
dhcp6: no
addresses: [10.0.0.248/24]
parameters:
stp: false
forward-delay: 0
Run Code Online (Sandbox Code Playgroud)
在主机上执行“netplan apply”后,我可以解析 google.com,但无法 ping:
ping google.com
PING google.com (172.217.22.174) 56(84) bytes of data.
From fileserver (10.0.0.247) icmp_seq=1 Destination …Run Code Online (Sandbox Code Playgroud)