lxc / linuxcontainers.org

The linuxcontainers.org website
https://linuxcontainers.org
Other
96 stars 118 forks source link

edit getting-started.md: note that firewall can block container from receiving IP address #700

Closed zipperer closed 9 months ago

zipperer commented 9 months ago

I propose the Getting Started: IP Address section notes that a firewall may block container from receiving IP address.

In the commit on this pull request I provide example text. I ask the maintainers to rewrite the example text to their liking.

The example text I provide is likely over-specific. It refers to Ubuntu distribution in particular rather than Linux distributions generally.

The problem I encountered that motivates this pull request

I followed the instructions on https://linuxcontainers.org/lxc/getting-started/ through the steps in https://linuxcontainers.org/lxc/getting-started/#ip-address.

But I failed to get mycontainer to have an IP address.

What I did

I searched and found https://discuss.linuxcontainers.org/t/lxd-bridge-doesnt-work-with-ipv4-and-ufw-with-nftables/10034/17, including

sudo ufw allow in on lxdbr0
sudo ufw route allow in on lxdbr0
sudo ufw route allow out on lxdbr0

In those commands I replaced lxdbr0 with lxcbr0 -- the value for LXC_BRIDGE in /etc/default/lxc-net. After I executed

root@host:~# ufw allow in on lxcbr0
root@host:~# ufw route allow in on lxcbr0
root@host:~# ufw route allow out on lxcbr0
root@host:~# service lxc-net restart
root@host:~# lxc-stop --name mycontainer
root@host:~# lxc-destroy --name mycontainer
root@host:~# lxc-create --name mycontainer --template download -- --dist ubuntu --release jammy --arch amd64
root@host:~# lxc-start --name mycontainer

the container received an IP address.

Related issue

I found #639 , but I do not find that page on the site.

Thank you for looking into this.