If I have a network that looks like this:
56.56.56.56 192.168.0.1/24
___________
---| Modem 1 |-----
| ___________ | ___________
11.22.33.44 ---| |--------| Machine |
| ___________ | ___________
---| Modem 2 |----- 192.168.0.3/24
___________
67.67.67.67 192.168.0.2/24
...where both modem 1 and modem 2 forward the ssh port to 192.168.0.3.
When I call tcpdump port ssh
on the machine at 192.168.0.3 and then ssh in from 11.22.33.44 to 56.56.56.56, the output looks something like this:
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
16:51:16.147870 IP 11.22.33.44.55936 > 192.168.0.3.ssh: Flags [S], seq 642687408, win 14600, options [mss 1460,sackOK,TS val 1631250991 ecr 0,nop,wscale 7], length 0
16:51:16.147957 IP 192.168.0.3.ssh > 11.22.33.44.55936: Flags [S.], seq 55101726, ack 642687409, win 28960, options [mss 1460,sackOK,TS val 1829635753 ecr 1631250991,nop,wscale 7], length 0
16:51:17.147444 IP 11.22.33.44.55936 > 192.168.0.3.ssh: Flags [S], seq 642687408, win 14600, options [mss 1460,sackOK,TS val 1631251992 ecr 0,nop,wscale 7], length 0
As you can see, tcpdump
appears only to give me the origin ip as the "source" ip and the "final" ip as the destination.
What command is needed to tell tcpdump
to print or filter by:
- the last hop (e.g. 192.168.0.1 or 192.168.0.2 in the diagram)
- the "public" ip (e.g. 56.56.56.56 or 67.67.67.67 in the diagram)
- the next hop (e.g. the modem used for packets going out instead of coming in)