If you buy a new wifi router you can access it wirelessly at a predefined IP or URL without reconfiguring your local network. I want to achieve the same thing with the pi3. The aim is after configuring the pi once (in the factory) it should be able accessible always at the same address, no matter where it is used (independent from the wifi there). Basically, I want to run a GUI e.g. on localhost:8080 on the pi and make it accessible over some IP/URI.

And usually, a router has even a readable URI e.g. my router had http://speedport.ip. I guess they do it with redirecting you to an internal IP from the internet.


1) How can I make a localhost page of the pi accessible with a static IP?


I stumbled over that post but I didn't fully understand it but I think it may be related: Setting Raspberry PI 3 as wireless access point without internet access

Tutorial: https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/ (They talk about forwarding but I guess I need to follow the tutorial maybe to the half?)


I managed to setup a local address and customize it to somename.local . A web server on the pi is hosting a website on http://localhost:80.

As long as the pi is connected to the same network as my accessing device the local URL is browseable.

I configured the pi as an access point. Now it is possible to connect to the pi and access the page somename.local. But it has two downsides I'm not satisfied yet:

1) the use needs to disconnect its existing wifi

2) some devices notice that the hotspot has no valid internet connection and disconnect after a short period

  • 1
    Isn't RPi already available at raspberrypi.local? Nov 17, 2016 at 9:22
  • Edited the question: Surely, you didn't mean to comunicate with the Pi without any communication interface. You were aiming at avoiding any configuration effort regarding your local network, weren't you? Nov 17, 2016 at 9:49
  • Exactly, I don't want my end user to configure anything. The GUI shall be accessible plug and play. I think what Dimitry wrote is exactly what I was looking for, I will test it soon. howtogeek.com/167190/… howtogeek.com/167195/…
    – Andi Giga
    Nov 17, 2016 at 10:34
  • @Dmitry Grigoryev can only access it while I'm connected via wifi/cable. I will check out the solution below and report.
    – Andi Giga
    Nov 22, 2016 at 12:11
  • Well, you will always need a connection of some sort. Getting your setting to work without disconnecting the existing wifi, the Pi would have to hack into said wifi and override its settings.. Not very likely. Nov 22, 2016 at 15:18

4 Answers 4


Generally when you get a new router it is configured to dish out DHCP addresses. Part of the DHCP configuration that is handed out is the DNS server, which is normally pointing to the router itself.

For example, you connect to the router wifi, and get an IP address in the range, a gateway address of and a dns server address of You can check this on linux with ifconfig and on windows with ipconfig

Whenever you browse to the given static url (e.g. http://speedport.ip) your machine sends a DNS lookup to the DNS server (running on the router) which returns it's own address (

The router will also have a web server running, serving the configuration management pages.

If you do a nslookup speedport.ip you'll find it canot be resolved publicly (because it is only defined in the router).

So, what you'd need to do to achieve this on a Raspberry Pi is:-

  • Configure the Raspberry Pi wifi as an access point.
  • Run a DHCP server that servers out addresses, gateways and DNS servers (itself)
  • Run a DNS server with a zone configured for your desired static URL and an A record in that zone pointing to the Pi itself.
  • Run a web server with the pages you want to serve.

There should be plenty of tutorials for each of these steps.

Note: If you specifically want to server the page on a different port (http://speedport.ip:8080 instead of http://speedport.ip) then you could do a 301 redirect from the the site running on the default port.


DHCP method would be maybe ok but unluckily, fixed IP gives you the best approach. Because if you set and receive IP address by DHCP server, you might not know what raspberry IP address is. DHCP does not always give you the same address that you have used before.

So you manipulate manually in /etc/network/interface file.

#iface wlan0 inet manual
iface wlan0 inet static
address <Your IP address>
netmask <network mask>
gateway <your gateway address>
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

and this will set you the ip address that you want to use with wifi.

If you want to set with wired connection instead of wlan0, use eth0 (if you set your wired connection with eth0).


First, thx all for the answers combined they led me to this configuration ( I voted them all up).

Following, the different bash scripts I used for my setup:

Setup a custom local address

The dns.sh setup a custom local DNS entry. This entry enables devices within the network to access the device, the user does not need to know/type an IP address into his browser address bar.


function customDNS() {
  echo "starting local dns setup\n"
  #fixed local ip
  yes | apt-get install avahi-daemon
  sed -i 's/raspberrypi/somename/' /etc/hosts
  sed -i 's/raspberrypi/somename/' /etc/hostname
  echo "finished local dns setup\n"

  #access point
  apt-get install iw #Wireless tools
  sudo apt-get install hostapd #Host Access Point Daemon
  #config access point
  cat $1/wlan.config > /etc/hostapd/hostapd.conf
  chmod 600 /etc/hostapd/hostapd.conf
  #add to autostart
  echo DAEMON_CONF=\"/etc/hostapd/hostapd.conf\" >> /etc/default/hostapd
  #manual start with hostapd -dd /etc/hostapd/hostapd.conf

  #router functions
  Y | sudo apt-get install dnsmasq
  cat $1/dnmasq.config >> /etc/dnsmasq.conf


This is the configuration for the wifi hotspot. The user can connect to this wifi hotspot in order to be able to see the somename.local. This is important because both devices need to be in the same network to see each other.

# WLAN-Router


ssid=someName #name of the wifi
ignore_broadcast_ssid=0#1 is hidden, 0 visible



I'm not quite sure if this is required at all. I think it can be skipped. But I still have the problem, that my hotspot is not recognized as a valid hotspot. So some devices disconnect from it after a while. But this maybe because they try to address some IPs e.g.I read IOS devices check apple.com

#DHCP-Server activ for wifi interface

# DHCP-Server non active for existing network

# IPv4 & lease time


Setup a Local Server

I setup a local server with nodejs serving my website to localhost:80 this can be accessed via http://somename.local

Connecting to users wifi

I made a setup page where the user can enter his wifi credentials. These are then added to /etc/wpa_supplicant/wpa_supplicant.conf with

printf 'network={%s\n\tssid=\"#{wifi.name}\"%s\n\tpsk=\"#{wifi.pass}\"%s\n}' >> /etc/wpa_supplicant/wpa_supplicant.conf

At the same time the hotspot is deactivated, otherwise I guess the raspberry will not be able to connect to the wifi.

sed -i '/DAEMON_CONF/s/^/#/g' /etc/default/hostapd

I reboot the pi then and check if the wifi connection is active. I plan a rollback of the last steps if not.

When booting the server I send a message with websockets to the front end to notify the user about the successful reboot. The wifi is usually connected automatically by the device to the users original wifi (the hotspot no longer exists).

pros & Cons


  • No cables needed
  • users know how to connect to a wifi
  • users know how to fill input fields


  • devices are not connecting properly to the hotspot, they show it as no internet connection, or skip the connection after a while (I opened up a sperate thread for this issue: Open Splash Page After Connecting to Wifi Hotspot )
  • it's still a bit of setup to connect to a wifi hotspot first and then enter your credentials

Connect your raspberry pi to your router/wireless hotspot. Now access the default settings/configuration page of your hotspot by writing the IP (usually from a computer or laptop connected to same hotspot. On prompt, enter username, password. The default username and password is admin, admin. If not then see back side of your router. After opening the settings page of your router, go for Device info/DHCP clients list or similar option. There you will see the connected devices with your hotspot. Note the MAC address of raspberry pi. Now look for IP/Mac binding option in your router settings page. Add that MAC address of your pi against the IP address of your choice (That is commonly in range of to Click save and restart your router and pi. Done.... After Reboot, you can access your raspberry pi using the same IP address that you added earlier in router settings in remote desktop connection window of a windows machine or type the same url in browser to access pi server ( in case you have installed server in raspberry pi). You can also assign local static IP to your raspberry pi without accessing your router configuration. There are many tutorials available online for this....Hope it solves your querry..

  • Please format the text into the sections, as it is now it's unreadable!
    – MatsK
    Apr 22, 2018 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.