Skip to content

Instantly share code, notes, and snippets.

@voldy
Forked from ismell/setup-bridge.sh
Created June 13, 2016 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voldy/38d3d2a876eb55cd74fe20b8c6a3e028 to your computer and use it in GitHub Desktop.
Save voldy/38d3d2a876eb55cd74fe20b8c6a3e028 to your computer and use it in GitHub Desktop.
Scripts to re-create the docker0 bridge and setup a different ip subnet
#!/bin/bash -e
IFADDR="192.168.3.1/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
echo 1 > /proc/sys/net/ipv4/ip_forward
#!/bin/bash -e
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment