I’ve set up a transparent proxy on my Mac OS 10.13 High Sierra. And when I set the mitmproxy host as client’s Gateway and Primary DNS I got no internet on the client device(Android 8.1). When I open Wireshark on the host machine I see that when client attempts to resolve any host, it receives an ICMP packet with destination unreachable.
I had the same issue on a linux machine few months ago and what I did is to install dnsmasq with some rules for the interface and address which incoming DNS requests need to be processed. Unfortunately the same solution doesn’t work in this situation. So most likely I’m missing something
I’ve read the Transparent proxy setup documentation several times and I don’t see anything about dnsmasq usage. So I guess that I do it in the wrong way, however, a similar setup with this small DSN server worked on linux few months ago.
So my question is, does the mitmproxy support DNS resolution? Or the DNSMasq is a good choice.
I do tried with disabled firewall and the same issue was observed. What do you think I’m missing?
And when I set the mitmproxy host as client’s Gateway and Primary DNS I got no internet on the client device(Android 8.1).
Why would you like to change your primary DNS? If you configure mitmproxy in transparent mode, it is enough to make sure that your traffic goes through the mitmproxy machine, there is no DNS reconfiguration necessary.
Because the latest versions of both Android and iOS require DNS to be inputted when you want to modify the network settings manually. That’s why I thought that I have to set the DNS 1 as well
Also when I set the default DNS to the mobile clients, I see that they send DNS A requests, but no response is returned to them. That’s why mobile devices show “No internet connection”. This is the second reason to configure custom DNS server.
So it seems that my machine is blocking the outgoing traffic to/from TCP port 53(DNS)
Ah, I see. Let’s clear this up: mitmproxy does not run a DNS server. You have to enter your regular DNS server here, or a publicly available one such as 8.8.8.8.
Ok, I removed the DNSMasq and flushed the DNS of the host machine in order to return to the default DNS settings of the OS.
I’m exactly following the Transparent Proxying guide, but my client device has no internet. When I open Wireshark on the host machine I see incoming DNS A requests from the client device, but no response to them. Which I think is the cause of the missing connectivity on the client’s device.
I tried with the default DNS which works when the default gateway is assigned to the device over DHCP and also tried the Google’s DNS 8.8.8.8. None of them are working when I set the host machine to be client’s gateway.
So I think that my host machine is blocking the traffic to the client device. I tried to enable/disable the firewall, but w/o success.
I’m running Mac OS High Sierra and $ mitmproxy --version
Mitmproxy: 3.0.4
Python: 3.6.5
OpenSSL: OpenSSL 1.0.2o 27 Mar 2018
Platform: Darwin-17.5.0-x86_64-i386-64bit
I’m still missing something, but I can’t figure it out what’s exactly.