tools/deployment/libvirt/setup_network.sh
Michel Thebeau 503a9417de deployment: libvirt: correct internal/external net
The INTERNAL and EXTERNAL networks configured by destroy and setup
network scripts are inverted with reference to the default
config_controller selections as well as the wiki
StarlingX/Installation_Guide_Virtual_Environment/Controller_Storage.

The most pressing concern in this is that what was actually the internal
management network was being nat'd.

Also, under normal testing it is not recommended to address the internal
management network from the virtualization host.  There are unlikely to be
configurations that will have external devices addressing the management
network.

Delete what was "EXTERNAL", actually internal, and rename "INTERNAL" to
be EXTERNAL.

Related-Bug: #1790716

Change-Id: I08f9e7712fed120001c864903880e13e9478764d
Signed-off-by: Michel Thebeau <michel.thebeau@windriver.com>
2018-09-10 10:30:28 -04:00

39 lines
876 B
Bash
Executable File

#!/usr/bin/env bash
usage() {
echo "$0 [-h]"
echo ""
echo "Options:"
# echo " -i: StarlingX ISO image"
echo ""
}
while getopts "i:" o; do
case "${o}" in
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
EXTERNAL_NETWORK=${EXTERNAL_NETWORK:-10.10.10.0/24}
EXTERNAL_IP=${EXTERNAL_IP:-10.10.10.1/24}
if [[ -r /sys/class/net/${BRIDGE_INTERFACE}1 ]]; then
echo "${BRIDGE_INTERFACE}1 exists, cowardly refusing to overwrite it, exiting..."
exit 1
fi
for i in {1..4}; do
sudo brctl addbr ${BRIDGE_INTERFACE}$i
done
sudo ifconfig ${BRIDGE_INTERFACE}1 $EXTERNAL_IP up
sudo ifconfig ${BRIDGE_INTERFACE}2 up
sudo ifconfig ${BRIDGE_INTERFACE}3 up
sudo ifconfig ${BRIDGE_INTERFACE}4 up
sudo iptables -t nat -A POSTROUTING -s $EXTERNAL_NETWORK -j MASQUERADE