Summary: how to configure the netplan on a host machine to create a bridge (with a static IP address) that would be used on guest virtual machine (shall be accessible from a local lan).
I am using Ubuntu 17.10, 32 bit. nplan 0.32~17.10.1.
I am trying to configure a linux virtual container that should be accessible from the local network.
But I am failing to configure a bridge on host machine with the nplan.
I have tried to follow the following guide with no luck:
https://discuss.linuxcontainers.org/t/static-ip-for-containers-with-local-lan-access/817
The guide configures a host system with two NICs. My host machine has a single interface.
I am still dealing with the nplan configuration on my host machine. My nplan config on host machine is the following:
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
after 'netplan apply' on host machine I can resolve google.com, but I can not 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 Host Unreachable
ip a
1: lo ...
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether 00:01:2e:4c:4c:97 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.247/24 brd 10.0.0.255 scope global ens32
valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ba:5f:c3:f0:a8:bd brd ff:ff:ff:ff:ff:ff
inet 10.0.0.248/24 brd 10.0.0.255 scope global br0
valid_lft forever preferred_lft forever
When I remove the complete section 'bridges:' from the nplan config I have to reboot the computer to get rid of the bridge (netplan apply is not enough - why?).
After the reboot, I can ping google.com.
Any help with the nplan configuration (on host and also on virtual guest) would be very welcome.
Thank you.
I've tried another guide. The trick is not to assign eth0 a separate address. Just leave it without addresses and your host will share IP with bridge. But there's another problem. After reboot something break this config, the bridge loses its broadcast address and you don't have internet access unless you run
netplan apply
again.I think that it may be due to some override from LXD (I'm using lxd bridge).