From 06e9c04359d9c0c0a16e89713d425aaaf01a6fbe Mon Sep 17 00:00:00 2001 From: volpol Date: Mon, 22 Apr 2019 18:18:01 +0200 Subject: [PATCH] nns.sh: fixes and improvements Fix bridge configuration (netmask / broadcast) Use static MAC for bridge and guest network interfaces --- nns.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nns.sh b/nns.sh index 74d2a4d..784f4f7 100755 --- a/nns.sh +++ b/nns.sh @@ -28,9 +28,15 @@ BASE_IF=vpn_tap1 GUEST_ADDR= GUEST_NET=192.168.30.0/24 +GUEST_MAC=FE:17:90:DF:24:4F + BRIDGE_IF=br0 BRIDGE_ADDR=192.168.30.3 +BRIDGE_BCAST=192.168.30.255 +BRIDGE_PLEN=24 +BRIDGE_MAC=FE:17:90:DE:23:4D + # List of nameservers to provide DNS in the new network namespace; # If empty, host resolv.conf will be used. @@ -136,10 +142,12 @@ start_nns() { # Create the new namespace, the veth cable and the bridge interface: $IP netns add $1 $IP link add $VETH_HOST type veth peer name $VETH_GUEST + $IP link set dev $VETH_GUEST address $GUEST_MAC $IP link add $BRIDGE_IF type bridge + $IP link set dev $BRIDGE_IF address $BRIDGE_MAC $IP link set $BASE_IF master $BRIDGE_IF $IP link set $VETH_HOST master $BRIDGE_IF - $IP addr add $BRIDGE_ADDR dev $BRIDGE_IF + $IP addr add $BRIDGE_ADDR/$BRIDGE_PLEN broadcast $BRIDGE_BCAST dev $BRIDGE_IF $IP link set dev $VETH_HOST up $IP link set dev $BRIDGE_IF up -- 2.30.2