Introduction

If you want to connect to your local environment from other devices on the same network, such as Android emulators or iPhone devices, you can use dnsmasq. Follow this guide for the necessary configuration steps to enable this functionality for your local Nhost project running on your machine.

Make sure to install dnsmasq. If you’re using another OS, please refer to the dnsmasq website.

Terminal
brew install dnsmasq

Configure dnsmasq for Android

These steps are necessary when running on both an Android emulator or physical Android device
1

Configure dnsmasq

Configure dnsmasq to resolve nhost service urls to your machine’s special loopback address 10.0.2.2

Terminal
sudo dnsmasq -d \
  --address=/local.auth.nhost.run/10.0.2.2 \
  --address=/local.graphql.nhost.run/10.0.2.2 \
  --address=/local.storage.nhost.run/10.0.2.2 \
  --address=/local.functions.nhost.run/10.0.2.2 
2

Restart dnsmasq

If you’re using another OS, please refer to the dnsmasq website.

Terminal
sudo brew services restart dnsmasq
3

Configure the android device/emulator's DNS settings

  1. Edit your network settings: Settings > Network & Internet > Internet > AndroidWifi
  2. set IP settings to Static
  3. set DNS 1 and DNS 2 to 10.0.2.2
  4. Save

Configure dnsmasq for iOS

These steps are only necessary when running on physical iOS device, the iOS simulator uses the host machine’s network, so no additional configuration is typically needed.
1

Inspect your machine's IP address on your network

Terminal
ipconfig getifaddr en0
2

Configure dnsmasq

Configure dnsmasq to resolve nhost service urls to your machine’s ip address.

Make sure to replace every occurrence of [your-machine-s-up-address] with the address printed in Step 1

Terminal
sudo dnsmasq -d \
  --address=/local.auth.nhost.run/[your-machine-s-up-address] \
  --address=/local.graphql.nhost.run/[your-machine-s-up-address] \
  --address=/local.storage.nhost.run/[your-machine-s-up-address] \
  --address=/local.functions.nhost.run/[your-machine-s-up-address]
3

Restart dnsmasq

If you’re using another OS, please refer to the dnsmasq website.

Terminal
sudo brew services restart dnsmasq
4

Configure the iPhone's DNS settings

  1. Select the wifi you’re connected and select Configure DNS
  2. Select Manual
  3. Click on Add server and type your local machine’s IP address printed in Step 1
  4. Save