Question

I have a Pi that runs hostapd and dhcpd on arch linux to create it's own land with the Pi's (routers) IP being 10.0.0.1. This uses the wlan0 interface and it only serves as a standalone router running a web server.

Once I connect to the Pi, I use 10.0.0.1 to display the web pages, but I want to use a hostname such as firepi. I have tried using dnsmasq, but I haven't been successful. Any help would be greatly appreciated especially if you can give me some detailed examples as I am a novice.

The purpose of this system is that I have created a web app that you can use to ignite fireworks over WiFi at a safe distance. I would just like the convenience of using a hostname instead of the IP address.

I must add that I will more than likely be using an iPhone to connect to the server, should this affect anything.

Was it helpful?

Solution

Not too sure how or why but this is what I did and it is successfully working now, so this is just for future users who may need a similar setup to mine.

First I installed hostapd and dhcpd and made sure they were working. Next I changed '/etc/hostname' to firepi and the '/etc/hosts' and added '10.0.0.1 firepi'. Then I installed dnsmasq, and set the interface to wlan0, and finally added '10.0.0.1 firepi' to '/etc/resolv.conf'.

After a full reboot, I joined the network on my iPhone, navigated to firepi and sure enough, it worked!

Thanks to the other users for their advice and tips.

OTHER TIPS

You can use avahi on Arch as well to resolve your hostname:

sudo pacman -S avahi nss-mdns

Start the avahi daemon:

sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service

Edit /etc/nsswitch.conf

sudo vim /etc/nsswitch.conf

Change the line:
hosts: files myhostname dns
to
hosts: files myhostname mdns_minimal [NOTFOUND=return] dns

Reboot

Note: don't forget to add .local to your hostname.

See also: http://blog.pixxis.be/post/77285636682/resolve-hostname-with-arch-linux-on-a-raspberry-pi

If you just want to be able to use "firepi" as hostname to connect to it, you can simply add it to your /etc/hosts file using the syntax "IP host". To make it as easy as possible, run this command as root:

echo "10.0.0.1 firepi" >> /etc/hosts

That'll do the trick.

Can you try avahi ?

sudo apt-get install avahi-daemon and

sudo apt-get install avahi-browse

I've successfully used that on Raspian. Unless you change the hostname using

sudo raspi-config you will access via raspberrypi.local

Note that if you plan to access the RPi from Windows you will need to install Bonjour Service first(if you have iTunes intalled, you might have those, run services.msc and check if the Bonjour Service is started)

Another note: On a friend's iphone I've installed a generic vnc client and had x11vnc running on the RPi and succesfully managed to connect to the RPi (since avahi-daemon was installed)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top