Add more output to help debugging network setup

This commit is contained in:
Vincent Legoll 2017-08-11 11:58:56 +02:00 committed by nachoparker
parent 43dd8c3dd5
commit 93ddde5a03
1 changed files with 9 additions and 0 deletions

View File

@ -77,14 +77,23 @@ EOF
IPFW=$( sysctl net.ipv4.ip_forward | cut -d= -f2 ) IPFW=$( sysctl net.ipv4.ip_forward | cut -d= -f2 )
sysctl net.ipv4.ip_forward=1 sysctl net.ipv4.ip_forward=1
echo "Getting routes for interface: $IFACE"
ROUTES=$( ip route | grep $IFACE ) ROUTES=$( ip route | grep $IFACE )
echo "Changing those routes to bridge interface: $BRIDGE"
BRROUT=$( echo "$ROUTES" | sed "s=$IFACE=$BRIDGE=" ) BRROUT=$( echo "$ROUTES" | sed "s=$IFACE=$BRIDGE=" )
echo "Creating new bridge: $BRIDGE"
brctl addbr $BRIDGE brctl addbr $BRIDGE
echo "Adding $IFACE interface to bridge $BRIDGE"
brctl addif $BRIDGE $IFACE brctl addif $BRIDGE $IFACE
echo "Setting link up for: $BRIDGE"
ip link set up dev $BRIDGE ip link set up dev $BRIDGE
echo "Flusing routes to interface: $IFACE"
ip route flush dev $IFACE ip route flush dev $IFACE
echo "Adding IP address to bridge: $BRIDGE"
ip address add $IP dev $BRIDGE ip address add $IP dev $BRIDGE
echo "Adding routes to bridge: $BRIDGE"
echo "$BRROUT" | tac | while read l; do ip route add $l; done echo "$BRROUT" | tac | while read l; do ip route add $l; done
echo "Routes to bridge $BRIDGE added"
precreationg=$(ip tuntap list | cut -d: -f1 | sort) precreationg=$(ip tuntap list | cut -d: -f1 | sort)
ip tuntap add user $USER mode tap ip tuntap add user $USER mode tap