Created
August 7, 2014 18:30
-
-
Save wmhaynes/e67abc4b100bdd56360f to your computer and use it in GitHub Desktop.
set wan and lan ports on initial x86 openwrt boot
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 | |
interfaces=$(ip link show | grep ": eth" | cut -d ':' -f2 | awk -F: '{print $0}' | awk '{print $1}'); | |
for x in $interfaces; do | |
echo $x > /tmp/wan; | |
echo $interfaces > /tmp/ports; | |
sed -i "s/$x //g" /tmp/ports; | |
uci set network.wan.ifname="$(cat /tmp/wan)"; | |
uci set network.lan.ifname="$(cat /tmp/ports)"; | |
break; | |
done | |
uci commit | |
/etc/init.d/network restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment