Sponsored Content
Full Discussion: iptables & port 53 (DNS)
Operating Systems Linux Red Hat iptables & port 53 (DNS) Post 302625071 by Duffs22 on Tuesday 17th of April 2012 08:34:24 AM
Old 04-17-2012
iptables & port 53 (DNS)

Hi,

I have a newly built RHEL5 OS that is unable to talk to the DNS server. I am unable to telnet resolv.conf entry over port 53 but apparently this port has been opened.

Code:
# telnet 209.212.96.1 53

and.....

Code:
# dig www.google.com
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> www.google.com
;; global options: printcmd
;; connection timed out; no servers could be reached

I can only assume therefore that this is a server issue.

So, I have added the following entry to my iptables:

Code:
# iptables -A INPUT -s 41.181.59.124/29 -d 209.212.96.1 -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
 
# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination 
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0 
ACCEPT tcp -- 41.181.59.120/29 0.0.0.0/0 state NEW tcp dpt:53 
ACCEPT tcp -- 41.181.59.120/29 209.212.96.1 state NEW tcp dpt:53

But still unable to telnet to the nameserver over port 53.

Can anybody provide any pointers to what I can try next?

R,
D.

Last edited by Duffs22; 04-17-2012 at 09:42 AM..
 

10 More Discussions You Might Find Interesting

1. IP Networking

Resolving port 8080 in DNS

Hi I have my DNS servers (BIND 8) running on two Solaris 8 boxes. I need to be able to resolve an address blah.xxx.net to an IP address followed by :8080 - (for Tomcat). I tried doing this in my zone file but it failed. Can someone give me a pointer on where this configuration should be done?... (1 Reply)
Discussion started by: korfnz
1 Replies

2. UNIX for Advanced & Expert Users

LINUX 9 IPTABLES and DNS

I have installed a linux 9 router/firewall and have issues with outside DNS queries making it in. here are my IPTABLE rules, can anyone make some suggestions? ETH1 is my outside facing Interface, ETH0 is my inside facing interface. Accept If input interface is not eth1 Accept If protocol is... (1 Reply)
Discussion started by: frankkahle
1 Replies

3. Linux

LINUX 9 IPTABLES and DNS

I have installed a linux 9 router/firewall and have issues with outside DNS queries making it in. here are my IPTABLE rules, can anyone make some suggestions? ETH1 is my outside facing Interface, ETH0 is my inside facing interface. Accept If input interface is not eth1 Accept If protocol... (6 Replies)
Discussion started by: frankkahle
6 Replies

4. UNIX for Dummies Questions & Answers

FTP, DNS & BIND

Hi GURUs, I have two queries. 1)I know I can use FTP clients for my File transfer needs, but I want to learn FTP thru command line, any one can point me to some good online resource available to learn FTP command line with examples, of course free except UNIX man pages. 2) Our company has... (4 Replies)
Discussion started by: patras
4 Replies

5. Solaris

OS Problems -no DNS & SSH not working

I just installed Solaris 6/10 without any problems but I didn't connect the network cable when I installed it. Here are my problems: -I can access webpages using IP addrsses but not with domain names -ssh is installed but it is not running ('ps -e | grep sshd' didn't show it) I have been... (4 Replies)
Discussion started by: kungpow
4 Replies

6. UNIX for Dummies Questions & Answers

DNS & DHCP configuration

Hi to all. Sorry for my bad english. For pure self-educational, not professional, purposes, I am studying how to configure a server with several services operating on it. For my experiment I'm using VirtualBox 3.1.4 on a WinXP host with 3 FreeBSD guests; one acts as a DHCP + DNS server; the... (0 Replies)
Discussion started by: marboxer
0 Replies

7. Solaris

Bind9 DNS on Solaris 10 x4270 & CPU usage

I have configured a Bind9 DNS on a X4270 machine with Solaris10 I am excuting some repformance tests with DNSPERF tool and maximun CPU usage is 23%. I have seen with prstat -L -p PID that named process usses only 2 of the 8 available CPU at the same time although threads for all CPUs exist.... (2 Replies)
Discussion started by: parisph
2 Replies

8. Red Hat

DHCP & DNS - Clients get IP but don't register in DNS

I am trying to setup a CentOS 6.2 server that will be doing 3 things DHCP, DNS & Samba for a very small office (2 users). The idea being this will replace a very old Win2k server. The users are all windows based clients so only the server will be Linux based. I've installed CentOS 6.2 with... (4 Replies)
Discussion started by: FireBIade
4 Replies

9. IP Networking

OS X & VPN DNS Issue

I'll try and be brief and detailed. I have a Macbook Pro Retina running Mavericks. When on my network at the office (work) everything local works just fine. Local servers are resolved through our internal DNS settings. For example, we have a fileserver at "fs01". I can connect to it with... (1 Reply)
Discussion started by: jbhardman
1 Replies

10. Linux

Domain registrars & DNS servers

I have read many tutorials on bind and i understand the A,MX, CNAME records. Internally, on a LAN we can install bind and create all these records and we can tell all PC and servers to use this bind as DNS server.that's fine. On the Internet, when we have purchased a valid domain like... (5 Replies)
Discussion started by: coolatt
5 Replies
IPTables::ChainMgr(3pm) 				User Contributed Perl Documentation				   IPTables::ChainMgr(3pm)

NAME
IPTables::ChainMgr - Perl extension for manipulating iptables and ip6tables policies SYNOPSIS
use IPTables::ChainMgr; my $ipt_bin = '/sbin/iptables'; # can set this to /sbin/ip6tables my %opts = ( 'iptables' => $ipt_bin, # can specify 'ip6tables' hash key instead 'iptout' => '/tmp/iptables.out', 'ipterr' => '/tmp/iptables.err', 'debug' => 0, 'verbose' => 0, ### advanced options 'ipt_alarm' => 5, ### max seconds to wait for iptables execution. 'ipt_exec_style' => 'waitpid', ### can be 'waitpid', ### 'system', or 'popen'. 'ipt_exec_sleep' => 1, ### add in time delay between execution of ### iptables commands (default is 0). ); my $ipt_obj = new IPTables::ChainMgr(%opts) or die "[*] Could not acquire IPTables::ChainMgr object"; my $rv = 0; my $out_ar = []; my $errs_ar = []; # check to see if the 'CUSTOM' chain exists in the filter table ($rv, $out_ar, $errs_ar) = $ipt_obj->chain_exists('filter', 'CUSTOM'); if ($rv) { print "CUSTOM chain exists. "; ### flush all rules from the chain $ipt_obj->flush_chain('filter', 'CUSTOM'); ### now delete the chain (along with any jump rule in the ### INPUT chain) $ipt_obj->delete_chain('filter', 'INPUT', 'CUSTOM'); } # set the policy on the FORWARD table to DROP $ipt_obj->set_chain_policy('filter', 'FORWARD', 'DROP'); # create new iptables chain in the 'filter' table $ipt_obj->create_chain('filter', 'CUSTOM'); # translate a network into the same representation that iptables or # ip6tables uses (e.g. '10.1.2.3/24' is properly represented as '10.1.2.0/24', # and '0000:0000:00AA:0000:0000:AA00:0000:0001/64' = '0:0:aa::/64') $normalized_net = $ipt_obj->normalize_net('10.1.2.3/24'); # add rule to jump packets from the INPUT chain into CUSTOM at the # 4th rule position $ipt_obj->add_jump_rule('filter', 'INPUT', 4, 'CUSTOM'); # find rule that allows all traffic from 10.1.2.0/24 to 192.168.1.2 ($rv, $rule_num) = $ipt_obj->find_ip_rule('10.1.2.0/24', '192.168.1.2', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1}); # find rule that allows all TCP port 80 traffic from 10.1.2.0/24 to # 192.168.1.1 ($rv, $rule_num) = $ipt_obj->find_ip_rule('10.1.2.0/24', '192.168.1.2', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1, 'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # add rule at the 5th rule position to allow all traffic from # 10.1.2.0/24 to 192.168.1.2 via the INPUT chain in the filter table ($rv, $out_ar, $errs_ar) = $ipt_obj->add_ip_rule('10.1.2.0/24', '192.168.1.2', 5, 'filter', 'INPUT', 'ACCEPT', {}); # add rule at the 4th rule position to allow all traffic from # 10.1.2.0/24 to 192.168.1.2 over TCP port 80 via the CUSTOM chain # in the filter table ($rv, $out_ar, $errs_ar) = $ipt_obj->add_ip_rule('10.1.2.0/24', '192.168.1.2', 4, 'filter', 'CUSTOM', 'ACCEPT', {'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # append rule at the end of the CUSTOM chain in the filter table to # allow all traffic from 10.1.2.0/24 to 192.168.1.2 via port 80 ($rv, $out_ar, $errs_ar) = $ipt_obj->append_ip_rule('10.1.2.0/24', '192.168.1.2', 'filter', 'CUSTOM', 'ACCEPT', {'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # for each of the examples above, here are ip6tables analogs # (requires instantiating the IPTables::ChainMgr object with # /sbin/ip6tables): find rule that allows all traffic from fe80::200:f8ff:fe21:67cf # to 0:0:aa::/64 ($rv, $rule_num) = $ipt_obj->find_ip_rule('fe80::200:f8ff:fe21:67cf', '0:0:aa::/64', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1}); # find rule that allows all TCP port 80 traffic from fe80::200:f8ff:fe21:67c to 0:0:aa::/64 ($rv, $rule_num) = $ipt_obj->find_ip_rule('fe80::200:f8ff:fe21:67cf', '0:0:aa::/64', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1, 'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # add rule at the 5th rule position to allow all traffic from # fe80::200:f8ff:fe21:67c to 0:0:aa::/64 via the INPUT chain in the filter table ($rv, $out_ar, $errs_ar) = $ipt_obj->add_ip_rule('fe80::200:f8ff:fe21:67cf', '0:0:aa::/64', 5, 'filter', 'INPUT', 'ACCEPT', {}); # add rule at the 4th rule position to allow all traffic from # fe80::200:f8ff:fe21:67c to 0:0:aa::/64 over TCP port 80 via the CUSTOM chain # in the filter table ($rv, $out_ar, $errs_ar) = $ipt_obj->add_ip_rule('fe80::200:f8ff:fe21:67cf', '0:0:aa::/64', 4, 'filter', 'CUSTOM', 'ACCEPT', {'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # append rule at the end of the CUSTOM chain in the filter table to # allow all traffic from fe80::200:f8ff:fe21:67c to 0:0:aa::/64 via port 80 ($rv, $out_ar, $errs_ar) = $ipt_obj->append_ip_rule('fe80::200:f8ff:fe21:67cf', '0:0:aa::/64', 'filter', 'CUSTOM', 'ACCEPT', {'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); # run an arbitrary iptables command and collect the output ($rv, $out_ar, $errs_ar) = $ipt_obj->run_ipt_cmd( '/sbin/iptables -v -n -L'); DESCRIPTION
The "IPTables::ChainMgr" package provides an interface to manipulate iptables and ip6tables policies on Linux systems through the direct execution of iptables/ip6tables commands. Although making a perl extension of libiptc provided by the Netfilter project is possible (and has been done by the IPTables::libiptc module available from CPAN), it is also easy enough to just execute iptables/ip6tables commands directly in order to both parse and change the configuration of the policy. Further, this simplifies installation since the only external requirement is (in the spirit of scripting) to be able to point IPTables::ChainMgr at an installed iptables or ip6tables binary instead of having to compile against a library. FUNCTIONS
The IPTables::ChainMgr extension provides an object interface to the following functions: chain_exists($table, $chain) This function tests whether or not a chain (e.g. 'INPUT') exists within the specified table (e.g. 'filter'). This is most useful to test whether a custom chain has been added to the running iptables/ip6tables policy. The return values are (as with many IPTables::ChainMgr functions) an array of three things: a numeric value, and both the stdout and stderr of the iptables or ip6tables command in the form of array references. So, an example invocation of the chain_exists() function would be: ($rv, $out_ar, $errs_ar) = $ipt_obj->chain_exists('filter', 'CUSTOM'); If $rv is 1, then the CUSTOM chain exists in the filter table, and 0 otherwise. The $out_ar array reference contains the output of the command "/sbin/iptables -t filter -v -n -L CUSTOM", which will contain the rules in the CUSTOM chain (if it exists) or nothing (if not). The $errs_ar array reference contains the stderr of the iptables command. As with all IPTables::ChainMgr functions, if the IPTables::ChainMgr object was instantiated with the ip6tables binary path, then the above command would become "/sbin/ip6tables -t filter -v -n -L CUSTOM". create_chain($table, $chain) This function creates a chain within the specified table. Again, three return values are given like so: ($rv, $out_ar, $errs_ar) = $ipt_obj->create_chain('filter', 'CUSTOM'); Behind the scenes, the create_chain() function in the example above runs the iptables command "/sbin/iptables -t filter -N CUSTOM", or for ip6tables "/sbin/ip6tables -t filter -N CUSTOM". flush_chain($table, $chain) This function flushes all rules from chain in the specified table, and three values are returned: ($rv, $out_ar, $errs_ar) = $ipt_obj->flush_chain('filter', 'CUSTOM'); The flush_chain() function in the example above executes the command "/sbin/iptables -t filter -F CUSTOM" or "/sbin/ip6tables -t filter -F CUSTOM". set_chain_policy($table, $chain, $target) This function sets the policy of a built-in chain (iptables/ip6tables does not allow this for non built-in chains) to the specified target: ($rv, $out_ar, $errs_ar) = $ipt_obj->set_chain_policy('filter', 'FORWARD', 'DROP'); In this example, the following command is executed behind the scenes: "/sbin/iptables -t filter -P FORWARD DROP" or "/sbin/ip6tables -t filter -P FORWARD DROP". delete_chain($table, $jump_from_chain, $chain) This function deletes a chain from the specified table along with any jump rule to which packets are jumped into this chain: ($rv, $out_ar, $errs_ar) = $ipt_obj->delete_chain('filter', 'INPUT', 'CUSTOM'); Internally a check is performed to see whether the chain exists within the table, and global jump rules are removed from the jump chain before deletion (a chain cannot be deleted until there are no references to it). In the example above, the CUSTOM chain is deleted after any jump rule to this chain from the INPUT chain is also deleted. find_ip_rule($src, $dst, $table, $chain, $target, %extended_info) This function parses the specified chain to see if there is a rule that matches the $src, $dst, $target, and (optionally) any %extended_info criteria. The return values are the rule number in the chain (or zero if it doesn't exist), and the total number of rules in the chain. Below are four examples; the first is to find an ACCEPT rule for 10.1.2.0/24 to communicate with 192.168.1.2 in the INPUT chain, and the second is the same except that the rule is restricted to TCP port 80. The third and forth examples illustrate ip6tables analogs of the first two examples with source IP fe80::200:f8ff:fe21:67cf/128 and destination network: 0:0:aa::/64 ($rulenum, $chain_rules) = $ipt_obj->find_ip_rule('10.1.2.0/24', '192.168.1.2', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1}); if ($rulenum) { print "matched rule $rulenum out of $chain_rules rules "; } ($rulenum, $chain_rules) = $ipt_obj->find_ip_rule('10.1.2.0/24', '192.168.1.2', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1, 'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); if ($rulenum) { print "matched rule $rulenum out of $chain_rules rules "; } ($rulenum, $chain_rules) = $ipt_obj->find_ip_rule('fe80::200:f8ff:fe21:67cf/128', '0:0:aa::/64', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1}); if ($rulenum) { print "matched rule $rulenum out of $chain_rules rules "; } ($rulenum, $chain_rules) = $ipt_obj->find_ip_rule('fe80::200:f8ff:fe21:67cf/128', '0:0:aa::/64', 'filter', 'INPUT', 'ACCEPT', {'normalize' => 1, 'protocol' => 'tcp', 's_port' => 0, 'd_port' => 80}); if ($rulenum) { print "matched rule $rulenum out of $chain_rules rules "; } add_ip_rule($src, $dst, $rulenum, $table, $chain, $target, %extended_info) This function inserts a rule into the running iptables chain and table at the specified rule number. Return values are success or failure along with the iptables stdout and stderr. append_ip_rule($src, $dst, $table, $chain, $target, %extended_info) This function appends a rule at the end of the iptables chain in the specified table. Return values are success or failure along with the iptables stdout and stderr. delete_ip_rule($src, $dst, $table, $chain, $target, %extended_info) This function searches for and then deletes a matching rule within the specified chain. Return values are success or failure along with the iptables stdout and stderr. add_jump_rule($table, $from_chain, $rulenum, $to_chain) This function adds a jump rule (after making sure it doesn't already exist) into the specified chain. The $rulenum variable tells the function where within the calling chain the new jump rule should be placed. Here is an example to force all packets regardless of source or destination to be jumped to the CUSTOM chain from the INPUT chain at rule 4: ($rv, $out_ar, $errs_ar) = $ipt_obj->add_jump_rule('filter', 'INPUT', 4, 'CUSTOM'); normalize_net($net) This function translates an IP/network into the same representation that iptables or ip6tables uses upon listing a policy. The first example shows an IPv4 network and how iptables lists it, and the second is an IPv6 network: print $ipt_obj->normalize_net('10.1.2.3/24'), " " # prints '10.1.2.0/24' print $ipt_obj->normalize_net('0000:0000:00AA:0000:0000:AA00:0000:0001/64'), " " # prints '0:0:aa::/64' run_ipt_cmd($cmd) This function is a generic work horse function for executing iptables commands, and is used internally by IPTables::ChainMgr functions. It can also be used by a script that imports the IPTables::ChainMgr extension to provide a consistent mechanism for executing iptables. Three return values are given: success(1) or failure(0) of the iptables command (yes, this backwards from the normal exit status of Linux/*NIX binaries), and array references to the iptables stdout and stderr. Here is an example to list all rules in the user-defined chain "CUSTOM": ($rv, $out_ar, $errs_ar) = $ipt_obj->run_ipt_cmd('/sbin/iptables -t filter -v -n -L CUSTOM'); if ($rv) { print "rules: "; print for @$out_ar; } SEE ALSO
The IPTables::ChainMgr extension is closely associated with the IPTables::Parse extension, and both are heavily used by the psad and fwsnort projects to manipulate iptables policies based on various criteria (see the psad(8) and fwsnort(8) man pages). As always, the iptables(8) man page provides the best information on command line execution and theory behind iptables. Although there is no mailing that is devoted specifically to the IPTables::ChainMgr extension, questions about the extension will be answered on the following lists: The psad mailing list: http://lists.sourceforge.net/lists/listinfo/psad-discuss The fwsnort mailing list: http://lists.sourceforge.net/lists/listinfo/fwsnort-discuss The latest version of the IPTables::ChainMgr extension can be found on CPAN and also here: http://www.cipherdyne.org/modules/ Source control is provided by git: http://www.cipherdyne.org/git/IPTables-ChainMgr.git http://www.cipherdyne.org/cgi-bin/gitweb.cgi?p=IPTables-ChainMgr.git;a=summary CREDITS
Thanks to the following people: Franck Joncourt <franck.mail@dthconnex.com> Grant Ferley Darien Kindlund AUTHOR
The IPTables::ChainMgr extension was written by Michael Rash <mbr@cipherdyne.org> to support the psad and fwsnort projects. Please send email to this address if there are any questions, comments, or bug reports. COPYRIGHT AND LICENSE
Copyright (C) 2005-2012 Michael Rash. All rights reserved. This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. More information can be found here: http://www.perl.com/perl/misc/Artistic.html This program is distributed "as is" in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. perl v5.14.2 2012-03-05 IPTables::ChainMgr(3pm)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy