# RDR trough NAT (PF)



## folivora (Oct 9, 2011)

Hi, 

I am having problems to redirect traffic from external_net to internal_net. 

Here is my pf. conf, the parts which are needed for redirecting. I don't mind to paste whole PF.conf.


```
extif = "em0
intif = "em1"  
tcp_services = "{ 22 113 58888 }"
intnet = "10.10.10.0/24"
natone  = "10.0.0.1"
set skip on lo0
 
scrub in all      
 
nat on $extif from $intif:network to any -> ($extif) static-port
 
rdr on $extif proto tcp from any to any port 113 -> $natone
 
rdr pass on $extif proto tcp from any to $extif port 56666 -> $natone port 56666  
 
pass in on $extif proto tcp from any to 10.0.0.1 port 113
 
pass in on $extif proto tcp from any to 10.0.0.1 port 56666
 
pass in quick on $intif proto {tcp, udp} from $intnet to ($intif) port $tcp_services keep state
pass in on $intif inet proto { tcp, udp } from $intnet to !<firewall> keep state
```

And here is the information from PF


```
Error when I am connecting:
 
pfctl -ss -->
 
all tcp 10.0.0.1:5666 <- xxx.xxx.34.64:56666 <- xxx.xxx.81.93:43981       CLOSED:SYN_SENT
all tcp xxx.xxx.81.93:43981 -> 10.0.0.1:5666       SYN_SENT:CLOSED
 
all tcp 10.0.0.1:5666 - xxx.xxx.34.64:56666 <- xxx.xxx.81.93:43981       CLOSED:SYN_SENT
all tcp xxx.xxx.81.93:43981 -> 10.0.0.1:56666      SYN_SENT:CLOSED
```

Any ideas why packets wont come back from internal_net properly? 

Best Regards 

- Folivora


----------



## SirDice (Oct 10, 2011)

Did you turn on routing?

Add to /etc/rc.conf:

```
gateway_enable="YES"
```


----------

