Created
March 27, 2011 16:40
-
-
Save zygm0nt/889357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1st, release all DHCP address and remove all IP address associated | |
# with the original eth0 | |
#/sbin/dhcpcd -k | |
kill `pidof dhclient` | |
/sbin/ip addr flush eth0 | |
# then take the interface down so we can rename it | |
/sbin/ip link set eth0 down | |
# now rename the original eth0 to reth0 (Real ETH0) | |
nameif reth0 00:24:81:43:61:5b | |
# OK, bring the same interface (with new name though) back up | |
/sbin/ip link set reth0 up | |
# 2nd let's create a bridge called eth0 so other programs think they are | |
# talking to the same old interface (actually they will talk to the | |
# bridge which is a clone of the original eth0 - with name MAC addr) | |
/usr/sbin/brctl addbr eth0 | |
# then add both origianl eth0 and tap1 device to the bridge | |
/sbin/brctl addif eth0 tap1 | |
/usr/sbin/brctl addif eth0 reth0 | |
echo "showing bridge mac addresses" | |
/usr/sbin/brctl showmacs eth0 | |
# 3rd, we need to bring the newly created bridge UP | |
/sbin/ip link set eth0 up | |
# 4th, renew the DHCP address if possible | |
#/sbin/dhcpcd -n | |
dhclient eth0 | |
/sbin/ip addr show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment