Advertisement
Guest User

Untitled

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