Skip to content

Instantly share code, notes, and snippets.

Created September 24, 2013 19:11
Show Gist options
  • Save anonymous/6689764 to your computer and use it in GitHub Desktop.
Save anonymous/6689764 to your computer and use it in GitHub Desktop.
Setup docker0 bridge
#!/bin/bash
IFADDR="192.168.3.0/24"
if [[ ! ip link show docker0 ]]; then
ip link add docker0 type bridge
ip addr add "$IFADDR" dev docker0
ip link set docker0 up
iptables -t nat -A POSTROUTING -s "$IFADDR" ! -d "$IFADDR" -j MASQUERADE
fi
cat 1 > /proc/sys/net/ipv4/ip_forward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment