Use dnsmasq to setup DNS server for TCP testing

In I introduced a tool to setup HTTP(s) proxy to test our new server. Our Android client is using HTTPS protocol, however our iOS client is using TCP protocol. mitmproxy is for HTTP(s) protocol only.

Found one tool for this purpose.

Follow steps on and to setup

  1. brew install dnsmasq
  2. mkdir -pv $(brew –prefix)/etc/
  3. echo ‘address=/.dev/’ > $(brew –prefix)/etc/dnsmasq.conf
  4. sudo cp -v $(brew –prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
  5. sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
  6. sudo mkdir -v /etc/resolver
  7. sudo bash -c ‘echo “nameserver” > /etc/resolver/dev’
  8. Configure hostname to IP address mapping via the local hosts file.
    1. Command: vim /etc/hosts
    2. This step can vary depending on how you have ‘dnsmasq’ configured, but with default configurations the software will look to the servers /etc/hosts file to serve as the hostname/ip registrar.
  9. System Preferences > Network > Wi-Fi (or whatever you use) > Advanced… > DNS > add to top of the list.
  10. Image Pasted at 2018-8-23 17-05.png