Last active
August 29, 2015 14:04
-
-
Save alsanchez/27ca3bfaaec3f1f865eb to your computer and use it in GitHub Desktop.
Generate /etc/network/interfaces for your OVH virtual machines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 <dedicated-server-ip> <virtual-machine-ip>" | |
exit 1 | |
fi | |
GATEWAY=`echo $1 | awk -F . '{print $1"."$2"."$3".254"}'` | |
IP="$2" | |
echo "auto lo" | |
echo "iface lo inet loopback" | |
echo | |
echo "auto eth0" | |
echo "iface eth0 inet static" | |
echo " address $IP" | |
echo " netmask 255.255.255.255" | |
echo " broadcast $IP" | |
echo " post-up route add $GATEWAY dev eth0" | |
echo " post-up route add default gw $GATEWAY" | |
echo " pre-down route del $GATEWAY dev eth0" | |
echo " pre-down route del default gw $GATEWAY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment