Categories
Linux Mastering Development

Route traffic from interface to real router

I’m trying to capture packets sent from my phone using my raspberry pi, basically a MITM kind of thing.

I have changed my phones wireless settings to use the raspberry pi’s ip address as the router then tried to make changes to the pi’s routing table, but I can’t get it to work. My phone says it’s not connected to the internet and a packet capture shows requests, but they never succeeded.

I’ve done the following:

ifconfig wlan0:1

ifconfig wlan0:1 192.168.0.100 netmask 255.255.255.0

echo 1 > /proc/sys/net/ipv4/ip_forward

route add default gw 192.168.0.1 wlan0:1

I’ve also added net.ipv4.ip_forward = 1 to /etc/sysctl.conf, and ran sysctl -p /etc/sysctl.conf.

Lastly, while googling for an answer I found some examples where they forward one or two ports. If possible, I’d like to forward all traffic.

Leave a Reply

Your email address will not be published. Required fields are marked *