Created
March 8, 2018 17:10
-
-
Save bjoern-r/f7f273bed7e3e7fa8ed11150f2763f14 to your computer and use it in GitHub Desktop.
script to configure all unconfigured interfaces for dhcp and bring them up. Ubuntu-16.04
This file contains 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 | |
# Author: bri | |
# Will add all interfaces in state DOWN to /etc/network/interfaces.d/auto.cfg | |
# with option dhcp | |
## for iface in `ls /sys/class/net/`; do | |
/sbin/ip -br l | awk '/DOWN/{print $1}' | | |
while read dev | |
do | |
echo "*** found device $dev" | |
printf "auto %s\niface %s inet dhcp\n\n" $dev $dev | tee -a /etc/network/interfaces.d/auto.cfg | |
done | |
echo "*** Bringing all interfaces up..." | |
ifup -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment