0

My network looks as follows:

PC1 >––––– [Router1 (Wlan)] ––––––––– [Router2] –––––––––> Internet
                                ^         |
                                x         +––––––< PC2

On PC 1 everything works fine except that I don't get any «226 Transfer complete.» responses via FTP. This does not happen on PC 2. (Actually the same machine.)

What I want to do (also to get a better understanding of the topic) is to put my laptop between Router1 and Router2 and play proxy. To see if the 226 packet would actually arrive at Router1.

Attempt so far looks as follows (Laptop at position demarked by the x)

ifconfig eth0 192.168.1.33 netmask 255.255.255.0 up # Goes to Router2
ifconfig eth1 192.168.2.2  netmask 255.255.255.0 up
route add default gw 192.168.1.1 dev eth0
echo "1" > /proc/sys/net/ipv4/ip_forward

Router2 configuration:

Static IP: 192.168.2.4/24
Gateway:   192.168.2.2
DNS:       192.168.2.2

Now when pinging any address on the WWW I get a Destination Host Unreachable. How do I configure my laptop (and the router) correctly in order to have the traffic proxied through so I can examine it with e.g. Wireshark?

3
  • Do you have an old Hub handy?
    – joeqwerty
    Oct 17, 2012 at 21:04
  • @joeqwerty Nope, just a switch. The hub would share all traffic with all ports, right? thinking about where to get one just for fun Oct 18, 2012 at 5:40
  • 1
    Right, which would simplify the setup. Just plug the relevant links and the laptop into the hub and watch all the traffic with no further configuration needed.
    – joeqwerty
    Oct 18, 2012 at 13:47

1 Answer 1

3

Through the miracle of brctl. This sets up Linux bridges, and is what you need to do what you're looking for. A command sequence would look like:

brctl addbr snooper
brctl addif snooper eth0 eth1
ifconfig snooper up 

This turns your laptop into a 2-port switch, and works best if the WLAN router and the WAN router are connected directly to your laptop. Packets come one one port and out the other. You can sniff on either interface.

For extra fun, you can even use iptables rules on the bridge to filter packets!

1
  • Thanks a lot! This worked. Very cool. Unfortunately it also seems that the 226 response gets eaten away somewhere else because I could not capture it between the two routers. But that's a different story :) Oct 18, 2012 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .