Re: [lxc-users] LXC containers networking
Bhangui, Avadhut Upendra wrote: Hello, I’m pretty new to using LXC containers. I have a requirement that the solution running inside the container should be able to communicate to services in public cloud and also with some services on the host machine. 1. How do I setup the networking of this container? 2. When it will try to communicate to the service on the host machine, will request be routed to machine over the physical network? Good bit of information about this found here... https://github.com/lxc/lxd/issues Good starting points... https://github.com/lxc/lxd/issues/2534 https://github.com/lxc/lxd/issues/3977 Keep in mind LXD 3.0 will likely change some of this information. Another problem area - the current move of many Distros from old network config files to Netplan config files. This change breaks all tools used to auto generate /etc/network/interfaces type files, so keep this in mind if you have an automated process for mass container creation. ___ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users
[lxc-users] LXC containers networking
On 06/04/18 03:33, Bhangui, Avadhut Upendra wrote: > I have a requirement that the solution running inside the container > should be able to communicate to services in public cloud and also > with some services on the host machine. > > 1. How do I setup the networking of this container? 2. When it will > try to communicate to the service on the host machine, will request > be routed to machine over the physical network? IMHO the simplest solution is to provide a "bridge" connection to your eth device (wifi won't work) on your host. This way your containers will get an IP from your LAN router and be available from every other device on your internal LAN. If you then port forward to one of the container IPs from your router then it's live on the 'net. If using *buntu then make sure the bridge-utils package is installed and if using a normal host desktop with NetworkManager then try these two config files (change enp4s0f1 to your eth device, and address1)... ~ cat /etc/NetworkManager/system-connections/lxdbr0 [connection] id=lxdbr0 uuid=2140d6a8-fb95-4d93-9488-58b64e216b81 type=bridge interface-name=lxdbr0 permissions= [bridge] stp=false [ipv4] address1=192.168.X.XX/24,192.168.X.1 dns=1.1.1.1; dns-search=local.lan; method=manual [ipv6] addr-gen-mode=stable-privacy dns-search= method=ignore ~ cat /etc/NetworkManager/system-connections/enp4s0f1 [connection] id=bridge-slave-enp4s0f1 uuid=f9691217-52c2-499e-b310-d5ccd7e1373f type=ethernet interface-name=enp4s0f1 master=lxdbr0 permissions= slave-type=bridge [ethernet] auto-negotiate=true mac-address=80:FA:5B:00:2C:48 mac-address-blacklist= [ipv4] dns-search= method=link-local [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto OR... if using systemd-networkd then try these... ~ cat /etc/systemd/network/MyBridge.netdev [NetDev] Name=lxdbr0 Kind=bridge ~ cat /etc/systemd/network/MyBridge.network [Match] Name=lxdbr0 [Network] #DHCP=ipv4 Address=192.168.X.XX/24 Gateway=192.168.X.XX DNS=1.1.1.1 ~ cat /etc/systemd/network/MyEth.network [Match] Name=e* [Network] Bridge=lxdbr0 pEpkey.asc Description: application/pgp-keys ___ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users
Re: [lxc-users] LXC containers networking
Greetings, Bhangui! > I’m pretty new to using LXC containers. > > I have a requirement that the solution running inside the container should > be able to communicate to services in public cloud and also with some > services on the host machine. That's a rather common requirement. > How do I setup the networking of this container? However you want. For most intents and purposes, LXC/LXD container is a complete running system. Just without real hardware. > When it will try to communicate to the service on the host machine, will > request be routed to machine over the physical network? However you configure it. It's all up to you. Macvlans support everything and more. -- With best regards, Andrey Repin Friday, April 6, 2018 03:29:23 Sorry for my terrible english... ___ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users
Re: [lxc-users] LXC containers networking
On 2018-04-06 02:33, Bhangui, Avadhut Upendra wrote: Hello, I'm pretty new to using LXC containers. I have a requirement that the solution running inside the container should be able to communicate to services in public cloud and also with some services on the host machine. * How do I setup the networking of this container? * When it will try to communicate to the service on the host machine, will request be routed to machine over the physical network? I'd say best to attach two NICs to the container, with two network bridges: - one with a public IP (assuming the container needs a public IP) - one to a NIC with internal network only If the container doesn't need a public IP, then one NIC attached to the internal network should be enough. Tomasz Chmielewski https://lxadm.com ___ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users
[lxc-users] LXC containers networking
Hello, I'm pretty new to using LXC containers. I have a requirement that the solution running inside the container should be able to communicate to services in public cloud and also with some services on the host machine. 1. How do I setup the networking of this container? 2. When it will try to communicate to the service on the host machine, will request be routed to machine over the physical network? /Avadhut. ___ lxc-users mailing list lxc-users@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-users