Created
June 10, 2018 17:07
-
-
Save yanniszark/cb9a1116d56512cf1fe5074db2bb63d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# | |
# net_setup.sh | |
# | |
# Creates a virtual bridge | |
# | |
# ... Must be run with root priviledges ... | |
BRIDGE="virtbr0" | |
LOCAL_ETH_IF="enp7s1" | |
TAP_IF="tap0" | |
# Create Virtual Bridge "virbr0" | |
ip link add $BRIDGE type bridge | |
# Add local interface to switch by setting its master to "virbr0" | |
# Note: clear ip address before connecting | |
ip addr flush dev $LOCAL_ETH_IF | |
ip link set $LOCAL_ETH_IF master $BRIDGE | |
# Bring up the local interface and virtual bridge | |
ip link set dev $BRIDGE up | |
ip link set dev $LOCAL_ETH_IF up | |
# Make local interface the default route for outgoing packets | |
ip addr add 0.0.0.0 dev $LOCAL_ETH_IF | |
# Assign IP Address to the Virtual Bridge | |
dhclient $BRIDGE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment