Skip to content

Instantly share code, notes, and snippets.

@wmhaynes
Created August 7, 2014 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmhaynes/e67abc4b100bdd56360f to your computer and use it in GitHub Desktop.
Save wmhaynes/e67abc4b100bdd56360f to your computer and use it in GitHub Desktop.
set wan and lan ports on initial x86 openwrt boot
#!/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