opkg update opkg install fping opkg install net-tools-arp
nano /root/getip.sh
#!/bin/ash SERVERMACADDRESS="00:19:b9:22:ae:4a" IP=`ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` NETMASK=`ifconfig eth1 | grep 'inet addr:' | cut -d: -f4` PREFIX=`/bin/ipcalc.sh $IP $NETMASK |grep 'PREFIX=' |sed 's/\(.\{7\}\)//'` NETWORK=`/bin/ipcalc.sh $IP $NETMASK |grep 'NETWORK=' |sed 's/\(.\{8\}\)//'` fping -c 1 -g $NETWORK/$PREFIX > /dev/null 2>&1 SERVERIP=`/usr/bin/arp -n | grep -i $SERVERMACADDRESS | awk '{print $1}'` echo $SERVERIP | tee /root/serverip.txt
chmod 755 /root/getip.sh
/root/getip.sh
SERVERMACADDRESS="00:19:b9:22:ae:4a" is Yun's server
/root/serverip.txt hold server ip address at Yun's client
eth1: ethernet
wlan0: wifi
Comments powered by CComment