Configuration of a bridge with a static IP with the netplan to be used with linux container

by milanBart   Last Updated January 13, 2018 01:02 AM

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.



Related Questions



How to connect to two VPNs at the same time?

Updated July 16, 2015 16:00 PM

ifup returns an unknown interface error

Updated December 09, 2017 00:02 AM

KvmWithBridge: primary network interface (wi-fi)

Updated November 23, 2017 11:02 AM