0

Using the guide found at http://imti.co/post/145442415333/raspberry-pi-3-wifi-station-ap, I have a successfully working AP that is also connected to my home wifi, and passes thru internet -- I'm connected to the Pi right now, not my home wifi.

However, I can't utilize it's hostname to connect (ssh, nginx/web, etc), I must use the IP address.

I've tried restarting avahi daemon.

Pi has hostname altoid.

If I do host altoid from my local (connected) machine, I get 127.0.1.1.

Can I preserve this setup, and instead have it resolve to the IP I am using for ssh, etc?

EDIT: Adding file contents

/etc/hosts

127.0.0.1   localhost
::1     localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

127.0.1.1   altoid

/etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
auto eth0
auto wlan0
auto uap0

iface lo inet loopback

iface eth0 inet dhcp

allow-hotplug wlan0


iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface uap0 inet static
  address 192.168.50.1
  netmask 255.255.255.0
  network 192.168.50.0
  broadcast 192.168.50.255
  gateway 192.168.50.1

/etc/dnsmasq.conf

interface=lo,uap0
no-dhcp-interface=lo,wlan0
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=192.168.50.50,192.168.50.150,12h

/etc/hostapd/hostapd.conf

interface=uap0
ssid=Inconspicuous Rock
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
  • The Pi is getting an IP from my home wifi. Ideally, the altoid name would point at that IP address. Currently that's 192.168.1.181, which is what I use to ssh to the Pi, ping it, etc. – guest834508 Jun 9 '17 at 15:06
  • Hark! It looks like I was able to see a response from altoid.local. It didn't appear to be working last night, so I am going to see if I can consistently repro, either way. – guest834508 Jun 9 '17 at 15:18
  • I was not -- but discovered something. My avahi-daemon service is not starting on boot. After manually starting it, I am able to access the Pi via altoid.local. – guest834508 Jun 9 '17 at 15:51
0

When you troobleshoot your hostname, you must check some points :

  • cat /etc/hostname should show your hostname.

  • In /etc/samba/smb.conf file (if you use samba), netbios name should also point to your hostname.

You must also check that your hostname doen'nt contain invalid characters. Try to use one with only alphanumerics characters.

You may also try these commands, made for live hostname edition :

echo "Hostname">/etc/hostname
sudo hostname "MyHostname"
sudo /etc/init.d/networking restart
sudo systemctl daemon-reload
sudo /etc/init.d/samba restart
  • cat /etc/hostname correctly returns altoid. – guest834508 Jun 9 '17 at 14:44
  • To my knowledge, I don't use Samba. Haven't configured it, or touched it, and otherwise this is a new Pi Zero W. – guest834508 Jun 9 '17 at 14:46
0

You may have been able to use the hostname, before enabling host AP mode, because you had the DHCPv4 client running that was registering withnyour LAN's default gateway that may also be running a DHCP and DNS proxy server. Now that you've disabled dhcpcd, your Pi doesn't get registered anymore with its name. A lot of platforms and applications only use DNS, but not mDNS (avahi), unless explicitly enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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