Simple script to automatically set up port forwarding for LXC containers
Shell
Switch branches/tags
Nothing to show
Latest commit ae4cbd7 Jul 22, 2017 @evanhempel evanhempel Merge pull request #1 from schtobia/master
Made lxc-portforward simpler, added logging to the helper script
Permalink
Failed to load latest commit information.
LICENSE
README.md
UNLICENSE
lxc-portforward
lxc-portforward-helper
lxc-portforward.conf

README.md

lxc-portforward

Simple script to automatically set up port forwarding for LXC containers

USAGE:

Copy lxc-portforward, lxc-portforward.conf, and lxc-portforward-helper to /etc/lxc.

In your container config set:

lxc.network.script.up = /etc/lxc/lxc-portforward
lxc.network.script.down = /etc/lxc/lxc-portforward

Edit lxc-portforward.conf to forward the ports you want forwarded

FILES:

Port forwarding information is stored in /etc/lxc/lxc-portforward.conf. Format is:

container_name:local_port:remote_port

IP addresses are stored in /var/run/lxc-portforward/ so when the container is stopped the proper iptables rules can be removed.