Setting a static IP

How does the Wink Hub do what it does? What's stored in the database? What does the aprond daemon do? what does aprontest communicate with? What is the ultimate question?
paulv888
Posts: 1
Joined: Wed Sep 09, 2015 10:49 pm

Setting a static IP

Postby paulv888 » Wed Sep 09, 2015 11:44 pm

I managed to set a static IP in the following and thought I should share.

Edit the wpa_actions.sh file

Code: Select all

nano /root/wifi/wpa_action.sh

Comment following line:

Code: Select all

#    udhcpc -i $IFACE -t 15 -b & 

Then add these lines:

Code: Select all

ifconfig $IFACE 192.168.2.121 netmask 255.255.255.0
    route add default gw 192.168.2.1
    echo "nameserver 192.168.2.1 # wlan0" > /tmp/resolv.conf


Further I commented this line in:

Code: Select all

nano /etc/init.d/S41wireless
#/root/wifi/check_wifi.sh &


This prevents falling back to ap_mode. Since the /tmp/isalive is never created

qwiksilver96
Posts: 3
Joined: Fri Feb 05, 2016 7:35 pm

Re: Setting a static IP

Postby qwiksilver96 » Fri Feb 05, 2016 8:16 pm

The changes listed above did not work on my rooted hub. I made some slight tweaks shown below and now I have a working static IP. FYI, I am on firmware 2.49 (just released today on 2/5/2016).

NOTE!: Make a backup of your wpa_action.sh file by using this command (prior to changing your file):
cp /root/wifi/wpa_action.sh /root/wifi/wpa_action.sh_bak

After the file is saved, you can test the script by running the following:
sh /root/wifi/wpa_action.sh wlan0 CONNECTED
ifconfig


#!/bin/bash
IFACE=$1
EVENT=$2

case $EVENT in

CONNECTED) logger -p notice -s "Received event: $EVENT"
set_rgb 127 83 0 0 0 0 flash 500000
echo "ATTEMPTING_TO_GET_IP" > /tmp/connection_status
# udhcpc -i $IFACE --retries 15 --timeout 3 --syslog --tryagain 10 -R
ifconfig $IFACE 192.168.0.97 netmask 255.255.255.0
route add default gw 192.168.0.1
echo "nameserver 192.168.0.50 # wlan0" > /tmp/resolv.conf
echo "1" > /tmp/isalive #THIS IS REQUIRED TO KEEP THE HUB FROM ENTERING AP MODE (WIFI CONFIGURATION MODE)
;;

DISCONNECTED) logger -p notice -s "Received event: $EVENT"
source /usr/sbin/terminate_verify
# Kill udhcpc gently so it releases our IP (the -R option must be specified at startup)
terminate_verify udhcpc
set_rgb 127 127 0 0 0 0 flash 250000
echo "DISCONNECTED" > /tmp/connection_status
;;

*) logger -p error -s "Strange event: $EVENT"
;;

esac

exit $?


Return to “How does it work?”

Who is online

Users browsing this forum: No registered users and 2 guests