From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master
Add script to setup external bridge
This script can be used to setup an external bridge
and add physical NIC to it so that one can expose
OSv IP on LAN.
This script would normally be executed before
scripts/run.py or scripts/firecracker.py which would
then receive name of the bridge (ie virbr1) as a -b
parameter.
Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
diff --git a/scripts/setup-external-bridge.sh
b/scripts/setup-external-bridge.sh
--- a/scripts/setup-external-bridge.sh
+++ b/scripts/setup-external-bridge.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# This script setup a bridge that binds physical NIC
+# to it and allows exposing OSv guest IP on external network
+
+if [[ $(whoami) != "root" ]]; then
+ echo "This script needs to be run as root!"
+ exit -1
+fi
+
+NIC_NAME=$1
+if [[ "$NIC_NAME" == "" ]]; then
+ echo "Usage: ./scripts/setup-external-bridge.sh <NIC_NAME> <BRIDGE_NAME>
(optional)"
+ exit -1
+fi
+
+BRIDGE_NAME=$2
+if [[ "$BRIDGE_NAME" == "" ]]; then
+ BRIDGE_NAME="virbr1"
+fi
+
+ip addr flush dev $NIC_NAME # Clear IP address on physical
ethernet device
+brctl addbr $BRIDGE_NAME # Create bridge
+brctl addif $BRIDGE_NAME $NIC_NAME # Add physical ethernet device to
bridge
+sysctl -q -w net.ipv6.conf.$BRIDGE_NAME.disable_ipv6=1
+dhclient -v $BRIDGE_NAME # Grab IP addres from DHCP server
+echo "Setup bridge: $BRIDGE_NAME"
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.