I’ve got a box I setup about 8 months ago, and starting to realize I never documented the full end-to-end steps to recreate (not good if I have an issue with the box)
sources :
I was trying at first to start with just a cleaner setup than my first post… but getting stuck. Once I setup the basic bridge… and modify the yaml file my VM running kubuntu 20.04 loses all internet connectivity… Should I have run the lxd init and THEN added a bridge for my containers?
Hi. Networking is not my thing, but I am wondering why you have no ip address (with dhcp set to ‘no’) and no gateway listed - it’s no wonder you can’t find the internet if there’s no gateway? I have these entries in my network file (but I use networkd not NetworkManager):
in my original attempt (which is still up and running) I never entered a gateway… but you’ve rightly pointed out an error… I’ve updated that file now to the following
vim /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s2:
dhcp4: no
bridges:
br0:
dhcp4: yes
interfaces:
- enp0s2
Hopefully I am almost there…! thanks for checking in
Hmmm unfortunately I’ve seemed to have created a bridge which still just grabs a private NAT address under 10.0.1.19/24 CIDR
not my expected 192.168.0.0…
but at least I can reach from the host of the LXD machine now … and the internet works… but might need to redo the configuration to get full DHCP working
beeng googling and fiddling… does it help to say I am hosting this linux host within a QEMU VM?? I’ve tried moving things around in the 01-network-manager-all.yaml
it seems I never can get a IP from my router … could my host OS (mac mini) be blocking something here?
Soyou likely need more help than I can give. Acouple of points: LXD will create abridge that uses a virtual lan it controls. There are several ways you can make yourcontainers accessible via your router and/or visible on your lan. A simple one is usign macvlan on lxd. It’s easy (google it), but it has a snag: containers will not be able to talk to the host via this method (it’s a feature I think - but sometimes an inconveneient one). Another way is to create your own bridge and assign that to containers as you need. Here’s mine, conveniently or confusingly called br0:
lxc profile show br0
config: {}
description: “”
devices:
eth0:
nictype: bridged
parent: br0
type: nic
root:
path: /
pool: default
type: disk
name: br0
That’s what I do. So I keep the default br0 bridge as some of my containers do not need lan access (so I keep them isolated by using the lxd bro), but those that do need easy access via the lan, I just assign my new br0 bridge to it using a single comnand:
lxc profile assign container-name br0
restart the container, and it will grab an ip from dhcp - my lan. And in this case, it can be accessed from the lan or even the host (unlike the macvlan method).
Keep going and good luck - you will get there. Lots of postings on here which google will find for you with some patience.
Andrew
I’ve infact created a bridge yes… and it seems to be okay some of the time, all except for the fact it’s not getting IPs from the router… and according to a link there’s a snag with macvlan when you’re hosted inside of a VM (which my linux LXD host is)
but I will try again… maybe I just need to get qemu/kvm host to allow promiscious mode and I will be through… thanks @Andrew_Wilson
I think I will try in the next few weeks to reinstall my base OS from scratch… and on bare metal re-attempt the macvlan bridge when outside of a VM… if it works I will be happy… if not well I at least can confirm that the issue is not my being in a vm …
I can confirm in fact the bare metal box I installed LXD on… never got IP’s from the DHCP router either… I was mistaken in my original assumption…