LXC container and default route

After I installed a new switch, attached to my router, I got some bizarre network problem with my server. The server that host this website, was not available from the Internet. I could browse the website from LAN, but not from outside the router.

I tried taking away the new switch, changing the port forward, upgrading the router firmware. Nothing helped. By a lucky shot, I tried to reach the Internet with ping from inside the LXC host. “No route to host”.

I imagine I have restarted the server earlier, and I assume that something must have set the default route earlier. But now I was not able to find any of this setting inside the LXC host. “grep -i “default gw” /etc/*” did not find anything.

So, simple fix:
add "route add default gw x.x.x.x" to /etc/rc.local
chmod +x /etc/rc.local

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>