Update howto-transparent-vms.md for newer versions (#3597)

Update howto-transparent-vms.md for newer versions
This commit is contained in:
Nirusu 2019-09-30 11:41:49 +02:00 committed by Thomas Kriechbaumer
parent 965dd3cfb5
commit 7ef91f46a3

View File

@ -14,9 +14,13 @@ Internal Network* setup can be applied to other setups.
## 1. Configure Proxy VM ## 1. Configure Proxy VM
On the proxy machine, **eth0** is connected to the internet. **eth1** is First, we have to find out under which name Ubuntu has mapped our network interfaces. You can find this information with:
connected to the internal network that will be proxified and configured
to use a static ip (192.168.3.1). {{< highlight bash >}}
ip link
{{< / highlight >}}
Usually with Ubuntu and Virtualbox, **eth0** or **enp0s3** (Ubuntu 15.10 and newer) is connected to the internet and **eth1** or **enp0s8** (Ubuntu 15.10 and newer) is connected to the internal network that will be proxified and configured to use a static ip (192.168.3.1). If the names differ, use the ones you got from the *ip link* command.
### VirtualBox configuration ### VirtualBox configuration
@ -65,6 +69,7 @@ Replace **/etc/dnsmasq.conf** with the following configuration:
{{< highlight none >}} {{< highlight none >}}
# Listen for DNS requests on the internal network # Listen for DNS requests on the internal network
interface=eth1 interface=eth1
bind-interfaces
# Act as a DHCP server, assign IP addresses to clients # Act as a DHCP server, assign IP addresses to clients
dhcp-range=192.168.3.10,192.168.3.100,96h dhcp-range=192.168.3.10,192.168.3.100,96h
# Broadcast gateway and dns server information # Broadcast gateway and dns server information
@ -93,10 +98,11 @@ IP address via DHCP:
## 3. Redirect traffic to mitmproxy ## 3. Redirect traffic to mitmproxy
To redirect traffic to mitmproxy, we need to add two iptables To redirect traffic to mitmproxy, we need to enable IP forwarding and add two iptables
rules: rules:
{{< highlight bash >}} {{< highlight bash >}}
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080 sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080 sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080
{{< / highlight >}} {{< / highlight >}}