Having trouble setting up transparent proxy in containers

Been stuck on this for a couple of days now.

I have both containers setup though something is not right and can’t figure out what and don’t know how to troubleshoot to diagnose the problem.

Following this, which follows what is laid out in the mitmproxy manual but fleshes things out somewhat, but I am doing it with containers.

I am not sure what I am missing.

I have setup static ip for the internal network on the server and set the client container to point to it but there is still no connection on the client.

Data for the containers

NAME        STATE   AUTOSTART GROUPS IPV4                   IPV6 
mitm        RUNNING 0         -      xxx.xxx.xxx.xxx (internet address for eth0 which works), xxx.xxx.3.1 (internal address for eth1) -    
mitm-client RUNNING 0         -      xxx.xxx.3.10           -    

Dnsmasq is running on the server.

$ sudo systemctl status dnsmasq
● dnsmasq.service - A lightweight DHCP and caching DNS server
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-04-10 15:58:21 UTC; 1min 23s ago
     Docs: man:dnsmasq(8)
  Process: 83 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 88 (dnsmasq)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/dnsmasq.service
           └─88 /usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file

Apr 10 15:58:21 mitm dnsmasq[83]: dnsmasq: syntax check OK.
Apr 10 15:58:21 mitm systemd[1]: Started A lightweight DHCP and caching DNS server.
Apr 10 15:58:21 mitm dnsmasq[88]: started, version 2.79 cachesize 150
Apr 10 15:58:21 mitm dnsmasq[88]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DH
Apr 10 15:58:21 mitm dnsmasq[88]: DBus support enabled: connected to system bus
Apr 10 15:58:21 mitm dnsmasq-dhcp[88]: DHCP, IP range xxx.xxx.x.xxx -- xxx.xxx.x.xxx, lease ti
Apr 10 15:58:21 mitm dnsmasq[88]: reading /etc/resolv.conf
Apr 10 15:58:21 mitm dnsmasq[88]: using nameserver 84.200.69.80#53
Apr 10 15:58:21 mitm dnsmasq[88]: using nameserver 84.200.70.40#53
Apr 10 15:58:21 mitm dnsmasq[88]: read /etc/hosts - 1 addresses

Route for server

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         xxx.xxx.3.1        0.0.0.0         UG    0      0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth1
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth0
xxx.xxx.3.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

Ip route on client

# ip route
default via xxx.xxx.3.1 dev eth0 proto static
xxx.xxx.3.0/24 dev eth0 proto kernel scope link src xxx.xxx.3.10

I start mitmproxy as per the link on the server with mitmproxy -T --host but there is still no internet connection on the client when I try ping or wget.

Any ideas what is wrong?

I thought maybe the iptables config was wrong/not present. I am using ufw and added the data in ufw noted in that post and checked it was added to iptables and it was however still no change. The settings also disappeared when I rebooted. I know they do with iptables but I thought they would persist when put in before.rules. Anyhow that isn’t the root of this problem since they were surely active when I tried to access on the client and it still had not internet connection.