Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static ip configuration not supported #86

Open
samtap opened this issue Apr 3, 2017 · 5 comments
Open

Static ip configuration not supported #86

samtap opened this issue Apr 3, 2017 · 5 comments

Comments

@samtap
Copy link
Owner

samtap commented Apr 3, 2017

Wifi Client mode is only available with DHCP. Multiple users have requested support for setting a static IP address, i.e. in #60, #61 and on discord.

The cloud app only supports dhcp and originally my scripts were developed to simply mimic cloudapp behaviour. Therefore no support for static ip configuration is available.

Users can setup a static dhcp lease in their router as interim solution.

A proper solution will be implemented in the next version

  • Extend webif to support static ip, netmask, gateway and dns fields.
  • Figure out a way to apply it, probably running ifconfig in place of udhcpc
@Tommy032017
Copy link

Tommy032017 commented Apr 4, 2017

@samtap Thanks for your hints!
I got it working and I could set a static IP instead DHCP by selecting "Client mode" in network.
Switching back to cloud mode and DHCP is also working.
At the moment it only works without setting permanent a gateway. You could add a gateway by an additional line with
route add default gw IP-ADDRESS wlan0
, but after reboot gateway is lost again. I didn't find a solution to set the gateway permanent.
However, I am happy with this and without gateway you could be sure, that the camera will not communicate outside to the internet. Of course NTP sync does not work, but I do not need a correct time stamp.

What I did:
Change the the 01_network in /data/etc/scripts to:
You have to edit this 2 entries in the 01_network and change the addresses according to your own network:

...
if [ $rc -eq 0 ]; then
ifconfig wlan0 192.168.150.97 netmask 255.255.255.0 broadcast 192.168.150.1 2>&1
	     echo "nameserver 192.168.150.1" > /etc/resolv.conf 2>&1
	     				
		 #udhcpc -i wlan0 -p /var/run/udhcpc.pid -b 2>&1

and

...
else
    echo "Failed to start wpa_supplicant"
    return 1
  fi
 ifconfig wlan0 192.168.150.97 netmask 255.255.255.0 broadcast 192.168.150.1 2>&1
	  echo "nameserver 192.168.150.1" > /etc/resolv.conf 2>&1
    
      #udhcpc -i wlan0 -p /var/run/udhcpc.pid -b 2>&1

If you now click on "Wireless Client" the IP address will immediately changed to the new address (here 192.168.150.97). To go on and to "Apply" the setting permanent you have first renew the webpage to the new IP address: http://new_IP_address/cgi-bin/network (or ... status).
Select again the "Wireless Client", select SSID and enter the "Passphrase" and now you are able to "Apply" the settings.
To go back to DHCP, just select the wireless mode "Cloud" and "Apply".

image

@josej69git
Copy link

hi. how can i edit this file for static ip? access with ftp and telnet and not find 01_network in any directory. thanks for all.

@samtap
Copy link
Owner Author

samtap commented Aug 21, 2017

It's 01-network in /media/mmcblk0p2/data/etc/scripts Please have a Linux machine/vm with sd reader so you can revert changes offline (ext2 filesystem, you can't read it on Windows), in case it doesn't work and locks you out!

@Tommy032017
Copy link

@josej69git
Works exactly like samtap described. Use an explorer with root privilege, p.e. "sudo nemo ". Edit the 01-network as described above, put back sd card to camera (camera always unplugged from power while changing the sd card) and don't forget to apply the "Wireless Client" mode twice.

@josej69git
Copy link

thanks, actually using windows, will probe it in al linux pc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants