Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # CC-BY-SA @maltejk 2014
- # powered by De:Bug Podcast
- # set static route on host for container, serves as lxc.network.script.up
- # only works if lxc.network.ipv4 is set
- # $@ is
- # container (footainer) section (net) context (up) net-type (empty/veth/macvlan/phys) host-side-device (vethF0O0)
- exec >> /var/lib/lxc/`basename $0`.log
- export container_name="$1"
- export container_netdev="$5"
- container_ipaddr=`grep -Po 'lxc\.network\.ipv4\s=\s\K.+' /var/lib/lxc/$container_name/config 2>/dev/null`
- test ! -z $container_ipaddr && (
- echo "`date` - container $container_name: adding route $container_ipaddr via $container_netdev"
- ip route add $container_ipaddr dev $container_netdev
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement