Hello,
First, I run
, with ipfw_nat built as module and ipfw(4) built-in kernel:
Here is my rc.conf:
What I need is simple: block any new incoming traffic on all ports, allow incoming on some ports (SSH, HTTP, HTTPS), and make all traffic from OpenVPN (tun interface, 10.8.0.0/24 network) NAT on the external interface em0.
Currently, I have this configuration:
After losing me in man-pages and searching on the Internet, I found different configurations with the natd daemon (isn't that ugly?) and IPFW nat configurations without any success.
Does someone could explain me how to setup that configuration and how it -should- work?
Oh and, a little subsidiary question: why, at rule numbered 0002, if I don't tell out for keep-state, all incoming traffic is allowed?
Thanks.
First, I run
Code:
FreeBSD next 10.0-STABLE FreeBSD 10.0-STABLE #31 r270258
Code:
options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
Here is my rc.conf:
Code:
gateway_enable="YES"
firewall_enable="YES"
firewall_type=open
firewall_script="/etc/ipfw.rules"
What I need is simple: block any new incoming traffic on all ports, allow incoming on some ports (SSH, HTTP, HTTPS), and make all traffic from OpenVPN (tun interface, 10.8.0.0/24 network) NAT on the external interface em0.
Currently, I have this configuration:
Code:
ipfw -q -f flush
cmd="ipfw add"
pif="em0"
tif="tun0"
tnet="10.8.0.0/24"
$cmd 0001 allow tcp from any to any established
$cmd 0002 allow ip from any to any out keep-state
$cmd 0005 allow all from any to any via lo0
$cmd 0006 allow all from any to any via $tif
$cmd 0010 check-state
$cmd 0011 allow tcp from any to any 22 in via $pif
$cmd 0110 allow tcp from any to any 22 in via $pif
$cmd 0120 allow tcp from any to any 80 in via $pif
$cmd 0130 allow tcp from any to any 443 in via $pif
$cmd 0140 allow tcp from any to any 51413 in via $pif
$cmd 0150 allow udp from any to any 51413 in via $pif
$cmd 0160 allow icmp from any to any in via $pif
#ipfw nat 1200 config if $pif deny_in
#$cmd 1201 nat 1200 all from ${tnet} to any out via $pif keep-state
#$cmd 1202 nat 1200 all from any to any in via $pif keep-state
$cmd 9999 deny all from any to any in via $pif
After losing me in man-pages and searching on the Internet, I found different configurations with the natd daemon (isn't that ugly?) and IPFW nat configurations without any success.
Does someone could explain me how to setup that configuration and how it -should- work?
Oh and, a little subsidiary question: why, at rule numbered 0002, if I don't tell out for keep-state, all incoming traffic is allowed?
Thanks.