Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 2004 13:53:51 +0200
From:      Arek Czereszewski <arek@wup-katowice.pl>
To:        freebsd-questions@freebsd.org
Subject:   Newbie: ipfw and my own DNS
Message-ID:  <4087B24F.6020607@wup-katowice.pl>

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

I have firewall based on rc.firewall:
#!/bin/sh
	fwcmd="/sbin/ipfw"
${fwcmd} -f flush

	${fwcmd} add 100 pass all from any to any via lo0
	${fwcmd} add 200 deny all from any to 127.0.0.0/8
	${fwcmd} add 300 deny ip from 127.0.0.0/8 to any


${fwcmd} -f flush

oif="fxp0"
iif="fxp1"
# Stop spoofing
#${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif}
#${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif}
# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}

# Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
# DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
# on the outside interface
${fwcmd} add deny all from any to 0.0.0.0/8 via ${oif}
${fwcmd} add deny all from any to 169.254.0.0/16 via ${oif}
${fwcmd} add deny all from any to 192.0.2.0/24 via ${oif}
${fwcmd} add deny all from any to 224.0.0.0/4 via ${oif}
${fwcmd} add deny all from any to 240.0.0.0/4 via ${oif}

#NAT
${fwcmd} add divert natd all from any to any via ${oif}

# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif}
${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}

# Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
# DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
# on the outside interface
${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif}
${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif}
${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif}
${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif}
${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif}

# Allow TCP through if setup succeeded
${fwcmd} add pass tcp from any to any established

# Allow IP fragments to pass through
${fwcmd} add pass all from any to any frag

# Allow setup of incoming email
${fwcmd} add pass tcp from any to me 25 setup

# Allow access to our DNS
${fwcmd} add pass tcp from any to me 53 setup
${fwcmd} add pass udp from any to me 53
${fwcmd} add pass udp from me 53 to any

# Allow access to our WWW
${fwcmd} add pass tcp from any to me 80 setup

# Allow access to our POP3S
${fwcmd} add pass tcp from any to me 995 setup

# Allow access to our SMTP
${fwcmd} add pass tcp from any to me 25 setup

# Reject&Log all setup of incoming connections from the outside
${fwcmd} add deny log tcp from any to any in via ${oif} setup

# Allow setup of any other TCP connection
${fwcmd} add pass tcp from any to any setup

# Allow DNS queries out in the world
${fwcmd} add pass udp from me to any 53 keep-state
${fwcmd} add pass udp from any to any 53 keep-state

last rule is default deny all any to any


And now problem:
when i try check something in dns i don't have connection:

[root@poczta ~]# nslookup poczta.wup-katowice.pl
*** Can't find  server name for adress 213.216.67.81: Time out

This IP is fxp1 on server.
sockstat show:
bind   named   588 20  udp4   213.216.67.81:53    *:*
bind   named   588 21  tcp4   213.216.67.81:53    *:*

Wher is error in rules?
If anybody can help me?

Thank you
Arek
-- 
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?4087B24F.6020607>