Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 scripts/setup-external-bridge.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 scripts/setup-external-bridge.sh

diff --git a/scripts/setup-external-bridge.sh b/scripts/setup-external-bridge.sh
new file mode 100755
index 00000000..13fc5394
--- /dev/null
+++ 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"
-- 
2.19.1

-- 
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.

Reply via email to