S
S
Sergey Durnov2018-01-12 20:36:55
Computer networks
Sergey Durnov, 2018-01-12 20:36:55

How to get internet working after restarting Ubuntu Server 17.10 Netplan?

/etc/netplan/01-netcfg.yaml like this for static containers:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: no
      dhcp6: no
  bridges:
    lxdbr0:
      dhcp4: no
      interfaces:
        - enp1s0
      addresses:
        - 192.168.0.10/24
      gateway4: 192.168.0.1
      nameservers:
        addresses:
          - 192.168.0.1
          - 8.8.8.8
      parameters:
        stp: false
        forward-delay: 0

when executed, it sudo netplan --debug generateproduces in the last lines:
NetworkManager: definition lxdbr0 is not for us (backend 1)
NetworkManager: definition enp1s0 is not for us (backend 1)

when executed, sudo netplan applyeverything works, but after a reboot, the Internet does not work (while ping over the local network works). After completing the sudo netplan applyInternet starts working again
What am I missing?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Durnov, 2018-01-26
@Boyd_Rice

He asked himself - he answered.
In order for everything to rise, it is necessary not to create a bridge when initializing LXC, but to create its usual bridge br0 and add it to the netplan config instead of lxdbr0.
When initializing or reconfiguring LXC, you need to use the existing bridge and everything will be fine.
It may be worth installing the bridge-utils package before creating the bridge.

M
Mainbrain1, 2018-08-01
@Mainbrain1

Hello. Please explain what "create its normal bridge br0" means.
I needed a bridge without dhcp, and I created it with the help of this article.
https://github.com/lxc/lxd/issues/3329
But, nevertheless, I still have to do sudo netplan apply so that the ip address appears on the br0 interface.
Config:

spoiler
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp6s0:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [enp6s0]
dhcp4: false
dhcp6: false
addresses: [ 10.57.66.7/24 ]
gateway4: 10.57.66.1
nameservers:
addresses: [10.57.1.14]
parameters:
stp: false
forward-delay: 0

the ifconfig output is just after loading, the Internet does not work, there is no ip address on br0, while the machine inside the container is available!
spoiler
br0: flags=4163 mtu 1500
inet6 fe80::ec6d:7eff:feb6:ad89 prefixlen 64 scopeid 0x20
ether ee:6d:7e:b6:ad:89 txqueuelen 1000 (Ethernet)
RX packets 259 bytes 32598 (32.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 17 bytes 1230 (1.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp6s0: flags=4163 mtu 1500
ether 38:60:77:d0:d0:92 txqueuelen 1000 (Ethernet)
RX packets 178 bytes 32306 (32.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 98 bytes 5148 (5.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Локальная петля (Loopback))
RX packets 9016 bytes 541464 (541.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9016 bytes 541464 (541.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethMPMST3: flags=4163 mtu 1500
inet6 fe80::fcbf:7eff:fec9:e535 prefixlen 64 scopeid 0x20
ether fe:bf:7e:c9:e5:35 txqueuelen 1000 (Ethernet)
RX packets 81 bytes 3918 (3.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 198 bytes 33560 (33.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Output after netplan apply
It can be seen that an ip address has appeared on br0, the machine is accessible from the outside.
spoiler
br0: flags=4163 mtu 1500
inet 10.57.66.7 netmask 255.255.255.0 broadcast 10.57.66.255
inet6 fe80::ec6d:7eff:feb6:ad89 prefixlen 64 scopeid 0x20
ether ee:6d:7e:b6:ad:89 txqueuelen 1000 (Ethernet)
RX packets 273 bytes 33988 (33.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 21 bytes 1550 (1.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp6s0: flags=4163 mtu 1500
ether 38:60:77:d0:d0:92 txqueuelen 1000 (Ethernet)
RX packets 192 bytes 33892 (33.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 101 bytes 5378 (5.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Локальная петля (Loopback))
RX packets 9096 bytes 546264 (546.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9096 bytes 546264 (546.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethMPMST3: flags=4163 mtu 1500
inet6 fe80::fcbf:7eff:fec9:e535 prefixlen 64 scopeid 0x20
ether fe:bf:7e:c9:e5:35 txqueuelen 1000 (Ethernet)
RX packets 81 bytes 3918 (3.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 216 bytes 35466 (35.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
and I also want to understand what vethMPMST3 is, an interface that is created automatically and with different names.
I removed lxdbr0.
PS
In the end, everything was decided according to this article:
https://discuss.linuxcontainers.org/t/lxd-netplan-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question