Skip to content

Instantly share code, notes, and snippets.

@tzuryby
Created May 16, 2011 11:56
Show Gist options
  • Save tzuryby/974319 to your computer and use it in GitHub Desktop.
Save tzuryby/974319 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from amsutils import common, confighelpers
from amsutils.common import shell
from amsutils.confighelpers import get_meta_config
lines = [
# take the bridge down
"ifconfig afik_br down",
"brctl delbr afik_br",
# recreate bridge
"brctl addbr afik_br",
"brctl addif afik_br eth0",
"brctl addif afik_tap",
# bring up interfaces
"ifconfig afik_br up",
"ifconfig eth0 up",
]
for iface in get_meta_config()['ams_ifaces']:
lines.append("ip addr add %(address)s brd + dev %(name)s" % iface)
if iface.get("gateway", None):
lines.append("route add default gw %(gateway)s dev %(name)s" % iface)
lines.append("amslocal start")
map(shell, lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment