Last active
December 23, 2015 14:09
-
-
Save bageljp/6646693 to your computer and use it in GitHub Desktop.
ubuntu-network
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
| # This file describes the network interfaces available on your system | |
| # and how to activate them. For more information, see interfaces(5). | |
| # The loopback network interface | |
| auto lo | |
| iface lo inet loopback | |
| # The primary network interface | |
| auto wlan0 | |
| iface wlan0 inet dhcp | |
| # wireless-* options are implemented by the wireless-tools package | |
| wireless-mode managed | |
| wireless-essid peacefree | |
| auto eth0 | |
| iface eth0 inet dhcp |
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/bash | |
| addr=$1 | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: `basename $0` {ip-addr-4octet(ex. `basename $0` 101 is 172.31.0.101)}" | |
| exit 1 | |
| fi | |
| ethif="`/sbin/ifconfig -a | grep eth | awk '{print $1}'`" | |
| echo peace-giant`printf "%02d\n" ${addr}` > /etc/hostname | |
| cp -p /etc/network/interfaces /etc/network/interfaces.`date +'%Y%m%d_%H%M%S'` | |
| echo "# This file describes the network interfaces available on your system" > /etc/network/interfaces | |
| echo "# and how to activate them. For more information, see interfaces(5)." >> /etc/network/interfaces | |
| echo "" >> /etc/network/interfaces | |
| echo "# The loopback network interface" >> /etc/network/interfaces | |
| echo "auto lo" >> /etc/network/interfaces | |
| echo "iface lo inet loopback" >> /etc/network/interfaces | |
| echo "" >> /etc/network/interfaces | |
| echo "# The primary network interface" >> /etc/network/interfaces | |
| echo "#auto wlan0" >> /etc/network/interfaces | |
| echo "#iface wlan0 inet dhcp" >> /etc/network/interfaces | |
| echo " # wireless-* options are implemented by the wireless-tools package" >> /etc/network/interfaces | |
| echo " #wireless-mode managed" >> /etc/network/interfaces | |
| echo " #wireless-essid peacefree" >> /etc/network/interfaces | |
| echo "" >> /etc/network/interfaces | |
| echo "auto ${ethif}" >> /etc/network/interfaces | |
| echo "iface ${ethif} inet static" >> /etc/network/interfaces | |
| echo " address 172.31.0.${addr}" >> /etc/network/interfaces | |
| echo " netmask 255.255.255.0" >> /etc/network/interfaces | |
| echo " network 172.31.0.0" >> /etc/network/interfaces | |
| echo " broadcast 172.31.0.255" >> /etc/network/interfaces | |
| echo " #dns-nameservers 8.8.8.8 8.8.4.4" >> /etc/network/interfaces | |
| echo " #gateway 172.31.0.201" >> /etc/network/interfaces | |
| echo "" >> /etc/network/interfaces | |
| echo "#up route add default gw 172.31.0.201" >> /etc/network/interfaces | |
| echo -n "" > /etc/udev/rules.d/70-persistent-net.rules | |
| echo "### complete, new /etc/network/interfaces ###" | |
| cat /etc/network/interfaces | |
| echo -e "\n### Please, reboot. ###" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment