Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2004 15:03:44 +0200
From:      Arek Czereszewski <arek@wup-katowice.pl>
To:        freebsd-questions@freebsd.org
Subject:   natd (again) :(
Message-ID:  <407E8830.2080100@wup-katowice.pl>

next in thread | raw e-mail | index | archive | help
Hi,

I'm newbie in ipfw and natd.


Config like this:
fxp0 - IP public (to my ISP)
fxp1 - IP public 213.216.67.81 (on this IP work www, mail, dns and ftp)
and 10 workstations with public IP conected
fxp1_alias - 192.168.0.1
fxp1 conect to LAN (in LAN 10 workstations from my subnet 
213.216.67.80/28 and 150 from 192.168.0.0/24).

In /etc/rc.conf:
...
gateway_enable="YES"
firewall_enable="YES"
#firewall_type="OPEN"
firewall_script="/etc/fwrules"
natd_enable="YES"
natd_interface="fxp0" // is this correct??
natd_flags="-f /etc/natd.conf"
...


/etc/fwrules

fwcdm="/sbin/ipfw"

$fwcdm -f flush

# lo0

$fwcdm add 40 pass all from any to any via lo0
$fwcdm add 41 deny all from any to 127.0.0.0/8
$fwcdm add 42 deny all from 127.0.0.0/8 to any

$fwcdm add 50 divert natd all from any to any via fxp0
$fwcdm add 51 allow tcp from any to me 53 setup
$fwcdm add 52 allow udp from any to me 53
$fwcdm add 53 allow tcp from any to me 80 setup
$fwcdm add 54 allow tcp from any to me 25 setup
$fwcdm add 55 allow tcp from any to me 995 setup


$fwcdm add 60 allow tcp from 192.168.0.0/24 to any 53 setup
$fwcdm add 61 allow udp from 192.168.0.0/24 to any 53 keep-state
$fwcdm add 62 allow tcp from 192.168.0.0/24 to any 80 setup
$fwcdm add 63 allow tcp from 192.168.0.0/24 to any 8074 setup
$fwcdm add 64 allow tcp from 192.168.0.0/24 to me 25 setup
$fwcdm add 65 allow tcp from 192.168.0.0/24 to me 995 setup
$fwcdm add 66 fwd 213.216.67.91,8080 tcp from 192.168.0.0/24 to any 80
$fwcdm add 67 deny all from 192.168.0.0/24 to any

$fwcdm add 80 allow tcp from 213.216.67.80/28 to any 53 setup
$fwcdm add 81 allow udp from 213.216.67.80/28 to any 53 keep-state
$fwcdm add 82 allow tcp from 213.216.67.80/28 to any 80 setup
$fwcdm add 83 allow tcp from 213.216.67.80/28 to any 8074 setup
$fwcdm add 84 allow tcp from 213.216.67.80/28 to me 25 setup
$fwcdm add 85 allow tcp from 213.216.67.80/28 to me 995 setup
$fwcdm add 86 allow tcp from any to 213.216.67.92 113 setup
$fwcdm add 87 allow tcp from 213.216.67.92 to 150.254.64.64 6667
$fwcdm add 88 deny all from 213.216.67.80/28 to any

$fwcdm add 65000 deny log ip from any to any

And now question:
Is this rules OK?

I don't connect server to internet before check rules.
So if anybody can tell me what could i change, i do this. Or is this 
correct, and i can put server to internet.

All man and how-to talk about 1 public and 1 private IP so i don't know 
what put in rules.
Is anybody can help me?

Thank you,
Arek

P.S.
My english is awful, sorry.

-- 
Arek Czereszewski       | jid: aro(at)chrome.pl
arek(at)wup-katowice.pl |  gg: 1349941
"*nix is like a wigwam:
no windows, no gates, apache inside."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?407E8830.2080100>