mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 15:55:28 +00:00
Update howto-transparent-vms.md for newer versions (#3597)
Update howto-transparent-vms.md for newer versions
This commit is contained in:
parent
965dd3cfb5
commit
7ef91f46a3
@ -14,9 +14,13 @@ Internal Network* setup can be applied to other setups.
|
||||
|
||||
## 1. Configure Proxy VM
|
||||
|
||||
On the proxy machine, **eth0** is connected to the internet. **eth1** is
|
||||
connected to the internal network that will be proxified and configured
|
||||
to use a static ip (192.168.3.1).
|
||||
First, we have to find out under which name Ubuntu has mapped our network interfaces. You can find this information with:
|
||||
|
||||
{{< 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
|
||||
|
||||
@ -65,6 +69,7 @@ Replace **/etc/dnsmasq.conf** with the following configuration:
|
||||
{{< highlight none >}}
|
||||
# Listen for DNS requests on the internal network
|
||||
interface=eth1
|
||||
bind-interfaces
|
||||
# Act as a DHCP server, assign IP addresses to clients
|
||||
dhcp-range=192.168.3.10,192.168.3.100,96h
|
||||
# Broadcast gateway and dns server information
|
||||
@ -93,10 +98,11 @@ IP address via DHCP:
|
||||
|
||||
## 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:
|
||||
|
||||
{{< 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 443 -j REDIRECT --to-port 8080
|
||||
{{< / highlight >}}
|
||||
|
Loading…
Reference in New Issue
Block a user