1

I got a webserver running on my Mac on localhost:3000 and I am trying to set a local DNS with dnsmasq and to be able to access that DNS from local devices (iPhone / iPad) for test purpose.

I followed this previous post: iPhone: add entry to /etc/hosts without jailbreaking

I am looking to redirect all *.localhost here

dnsmasq.conf:

.conf

/etc/resolver/localhost:

/etc/resolver/localhost

dig google.com:

dig google.com

The Mac Network DNS config:

Mac Network DNS config

On my phone, on the same network, adding the Mac Local IP as DNS:

Wi-Fi is connected to xxxxxx and has the IP address 192.168.1.11.

phone DNS

I am able to connect to myapp.localhost:3000 successfully on the Mac but getting Server cannot be found on the iPhone.

Must be missing something there.


EDIT #0: 2021/07/08

netstat -anvp tcp | grep '\b192.168.1.11.53\b' output:

enter image description here

Florian Ldt
  • 1,125
  • 3
  • 13
  • 31
  • Your router should already have a DNS server (at least, any sold within the last decade do). You don't need a DNS server to access `http://192.168.1.11:3000` over the LAN anyway – OneCricketeer Sep 30 '21 at 06:21

1 Answers1

0

open a terminal and use netstat to check if your dnsmasq is open on 192.168.1.11

if the result is similar to

root@dns-01:~# sudo netstat -tnlp
  
tcp        0      0 127.0.0.1:53         0.0.0.0:*               OUÇA       13376/dnsmasq   

it means that it will only accept queries from the local machine, not from your network.

to query from your network you must see something like

tcp        0      0 192.168.1.11:53      0.0.0.0:*               OUÇA       13376/dnsmasq   

or

tcp        0      0 0.0.0.0:53           0.0.0.0:*               OUÇA       104287/dnsmasq     
RASG
  • 5,988
  • 4
  • 26
  • 47