View Single Post
  #1   (View Single Post)  
Old 19th June 2019
junk's Avatar
junk junk is offline
Port Guard
 
Join Date: Jun 2018
Posts: 17
Default NAT source address translation

Hello,

Could anyone help me please?

I'm trying to connect from 192.168.0.3 to 192.168.0.1:8080 and send that to 192.168.1.2:80 as if it were coming from 192.168.1.1.

Pretty silly but I don't know how. I've tried the following:

Code:
int_if1 = 192.168.0.1 #re0
int_if2 = 192.168.1.1 #re1
client = 192.168.0.3
server = 192.168.1.2

pass in on $int_if1 inet proto tcp from $client to $int_if1 port 8080 rdr-to $server port 80
pass out on $int_if1 inet proto tcp to $server port 80 received-on $int_if1 nat-to $int_if2
Code:
test# tcpdump -n -i re0 port 8080
tcpdump: listening on re0, link-type EN10MB
18:15:39.895350 192.168.0.3.44971 > 192.168.0.1.8080: S 4258345521:4258345521(0) win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 3319586456 0> (DF)
18:15:40.156961 192.168.0.3.47237 > 192.168.0.1.8080: S 1293923870:1293923870(0) win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 786111235 0> (DF)
18:15:45.892088 192.168.0.3.44971 > 192.168.0.1.8080: S 4258345521:4258345521(0) win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 3319586468 0> (DF)
18:15:46.152135 192.168.0.3.47237 > 192.168.0.1.8080: S 1293923870:1293923870(0) win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 786111247 0> (DF)
Code:
test# tcpdump -n -i re1 port 80  
tcpdump: listening on re1, link-type EN10MB
18:18:11.386568 192.168.0.3.7444 > 192.168.1.2.80: S 1435489758:1435489758(0) win 16384 <mss 1440,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 2917288379 0>
18:18:11.649978 192.168.0.3.21710 > 192.168.1.2.80: S 500167953:500167953(0) win 16384 <mss 1440,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 459285197 0>
18:18:17.378744 192.168.0.3.7444 > 192.168.1.2.80: S 1435489758:1435489758(0) win 16384 <mss 1440,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 2917288391 0>
18:18:17.648712 192.168.0.3.21710 > 192.168.1.2.80: S 500167953:500167953(0) win 16384 <mss 1440,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 459285209 0>

Last edited by junk; 22nd June 2019 at 01:31 PM.
Reply With Quote