Forwarding another host

Rodrique Heron swygue at gmail.com
Wed Jan 9 09:00:15 PST 2008


Good Day-

I'm running FreeBSD 6.2 and I want to know if forwarding to a external 
host is supported by PF. I want to forward all incoming traffic to port 
22 to another host, but it does not work, forwarding to a Jail works 
though. Here are my configs:


### /etc/rc.conf
ifconfig_em0="inet 192.168.2.14 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
ifconfig_em0_alias0="inet 192.168.2.18 netmask 255.255.255.255"  ## JAIL IP
gateway_enable="YES"

pf_enable="YES"                 # Enable PF (load module if required)
pf_rules="/etc/pf.conf"         # rules definition file for pf
pf_flags=""                     # additional flags for pfctl startup
pflog_enable="YES"              # start pflogd(8)
pflog_logfile="/var/log/pflog"  # where pflogd should store the logfile
pflog_flags=""                  # additional flags for pflogd startup


###  /etc/pf.conf
ext_if = "em0"
int_if = "lo0"

host_ip = "192.168.2.14"
jail_ip = "192.168.2.18"
external_host = "192.168.2.27"

rdr on $ext_if proto tcp from any to $host_ip port 22 -> $external_host 
port 22
rdr on $ext_if proto tcp from any to $host_ip port 26 -> $jail_ip port 22

pass in quick all
pass out quick all

Thanks




More information about the freebsd-pf mailing list