LXC Containers - Exposing Ports & Port Forwarding

Subscribers:
22,800
Published on ● Video Link: https://www.youtube.com/watch?v=3f57PovdY44



Duration: 4:11
16,390 views
0


I sort of promised to make a networking port-forward video about LXC in my previous LXC & LXD video so, here it is!

Networking can be somewhat of a challenge in LXC. The (current) default use case for LXC & LXD is for use as internal containers in a virtual network. As such, you cannot easily port forward your containers as you can with Docker. Instead, you must change the nictype to make your containers publicly accessible. A side effect of this is since the container is no longer in a virtual network with the host, the host must use the router to connect to it.

Port forwarding can technically be achieved by using iptables, however, I think most people agree that iptables are cumbersome and are generally avoided by most users. Macvlan is a heavy-handed approach the technically exposes *all* ports to the router, which means you *must* have some kind of a firewall on your router or gateway if you want to keep your containers secured.

If you want to use your LXC container as a web server or game server (like I do), macvlan is arguably the best way to facilitate it.
~~
Support the channel! Becoming a Patron or Ko-fi supporter gives you access to the Egee video archive & good vibes for supporting my videos!

Ko-fi - https://ko-fi.com/egeeirl
Patreon - https://www.patreon.com/egeeirl 🤗

Use My Affiliate Links & Support The Channel! 🎁

Looking for a reliable & cost-effective VPS? Sign up with my friends at Linode with my link to get a $20 credit on your account! - https://linode.com/egee

Linux & Open Source Gear

Pre-Installed Linux Barebones & Mini-PC's - https://amzn.to/2rbjGYU 🐧
Unlocked LineageOS compatible devices - https://amzn.to/2OQQ50x 📲
Crouton compatible Chromebooks - https://amzn.to/383JuHB 💻

Recording Gear

My amazing microphone - https://amzn.to/364mvdM 🎙️
Linux compatible audio mixer - https://amzn.to/2Ln2vuG 🎧
The fire-breathing CPU for video editing - https://amzn.to/33NyDyf 🔥







Tags:
lxc
lxd
docker on ubuntu
linux container
lxc ubuntu
lxd ubuntu
containers on ubuntu
linux hypervisor
docker hypervisor
lxd hypervisor
lxd linux
linux
linux lxd
linux containers
linux lxc
lxd container
containers linux
lxc lxd
lxc linux
lxc port forwarding
lxd port forwarding
port forward lxc
port forward docker
lxc expose port
expose port lxd