niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » Linux » networking
iptables DNS port
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Baho Utot
*nix forums Guru Wannabe


Joined: 15 Mar 2005
Posts: 123

PostPosted: Tue Feb 08, 2005 11:36 pm    Post subject: iptables DNS port Reply with quote

I have the following rules for DNS (bind 9 running as caching server)
are the following correct?

Comments please.

#
# DNS Name Server TCP 53/UDP 25
#
$IPTABLES -A OUTPUT -o $INTERNET -p udp \
--sport $UNPRIVPORTS \
-d $NAMESERVER --dport 53 \
-m state --state NEW -j ACCEPT
$IPTABLES -A OUTPUT -o $INTERNET -p tcp \
--sport $UNPRIVPORTS \
-d $NAMESERVER --dport 53 \
-m state --state NEW -j ACCEPT
if [ $DNS_CACHE = "1" ]; then
# DNS CACHE LAN clients to private server (53)
$IPTABLES -A INPUT -i $LAN -p udp \
--sport $UNPRIVPORTS \
-d $LAN_ADDR --dport 53 \
-m state --state NEW -j ACCEPT
$IPTABLES -A INPUT -i $LAN -p tcp \
--sport $UNPRIVPORTS \
-d $LAN_ADDR --dport 53 \
-m state --state NEW -j ACCEPT
else
$IPTABLES -A FORWARD -o $INTERNET -p udp \
--sport $UNPRIVPORTS \
-d $NAMESERVER --dport 53 \
-m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -o $INTERNET -p tcp \
--sport $UNPRIVPORTS \
-d $NAMESERVER --dport 53 \
-m state --state NEW -j ACCEPT
fi

Also will the following rule log all port 53 packets (from internet
interface)?

$IPTABLES -A INPUT -i $INTERNET -p tcp -d $INTERNET_IPADDR --dport 53 -j LOG
Back to top
Baho Utot
*nix forums Guru Wannabe


Joined: 15 Mar 2005
Posts: 123

PostPosted: Sat Feb 12, 2005 5:00 pm    Post subject: Re: iptables DNS port Reply with quote

On Mon, 14 Feb 2005 12:07:30 -0500, Robert wrote:

Quote:
On Wed, 09 Feb 2005 00:36:16 +0000, Baho Utot wrote:

I have the following rules for DNS (bind 9 running as caching server)
are the following correct?

Comments please.

I would do something like this;

# IPTABLES New Chain DNS
# ----------------------
$IPTABLES -N LOG_DNS
$IPTABLES -A LOG_DNS -j LOG --log-tcp-options --log-ip-options --log-prefix "[DNS] : "
$IPTABLES -A LOG_DNS -j ACCEPT


if [ $DNS_CACHE = "1" ]; then
# DNS CACHE LAN clients to private server (53)
$IPTABLES -A INPUT -i $LAN -p udp -d $LAN_ADDR --dport 53 -m state --state NEW -j LOG_DNS
$IPTABLES -A INPUT -i $LAN -p tcp -d $LAN_ADDR --dport 53 -m state --state NEW -j LOG_DNS
else
$IPTABLES -A FORWARD -o $INTERNET -p udp -d $NAMESERVER --dport 53 -m state --state NEW -j LOG_DNS
$IPTABLES -A FORWARD -o $INTERNET -p tcp -d $NAMESERVER --dport 53 -m state --state NEW -j LOG_DNS
fi


The top part creates a new chain that the bottom part jumps to to log all
NEW DNS connections.

Thankyou I'll try that and see if it will help.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 8:59 am | All times are GMT
navigation Forum index » *nix » Linux » networking
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts changing port in vsftp henk@oegema.com Suse 2 Fri Jul 21, 2006 10:42 am
No new posts does squid 2.6 support setting cache_peer port in redirec... Victor Tsang Squid 0 Fri Jul 21, 2006 8:16 am
No new posts IPtables front end Stephen Allen Debian 13 Thu Jul 20, 2006 1:30 pm
No new posts Local forwarding with "iptables" gives "invalid arguments" newsfuzzy@geekmail.de networking 0 Wed Jul 19, 2006 2:47 pm
No new posts Iptables and kernel 2.6.17 phelp needed Chavdar Videff Debian 8 Wed Jul 19, 2006 6:30 am

Loans | Reptile Supplies | Customer services | Credit Counseling | Best Credit Card Deals
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1676s ][ Queries: 16 (0.0986s) ][ GZIP on - Debug on ]