LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-22-2009, 06:09 AM   #1
hboosh
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Rep: Reputation: 0
automatically add to iptables?


hi,

i've written a client and server. the client broadcasts a message to servers on the subnet, and servers reply to the client.

this all works fine as long as iptables is disabled on the server machines. however, when it's enabled, iptables blocks the udp broadcasts.

running iptables -L shows lots of rules. that's fine. the rules it shows though include software like amanda, subversion, etc. i have never manually added any permit rules for iptables for these services.

so, how can i make my server automatically add an iptables permit rule when it loads? do i have to use a port in a certain range, or must it run as root so it can use the shell to insert a permit rule into iptables? i don't really want to take this last approach. it'd be great if there was a way of using a certain port, or editing a whitelist file (would adding the port to /etc/services do this) to permit the port.

does anyone know how i can achieve this?

thanks,
haz
 
Old 12-22-2009, 04:45 PM   #2
grantwnorman
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Rep: Reputation: 1
assuming you are running something of the centos/redhat flavor:::
edit the file @ /etc/sysconfig/iptables and I would copy a somewhat similar line and then edit that line accordingly. Once you are done do a service iptables restart and it should load your new rule immediately and on startup.

The other rules were probably created at installation time or if you are running a control panel, it may have added them as well. Good luck!


Edit: you can also specify a port range in these iptables ruleset, so you do not need to specify each port manually. Also, adding to /etc/services will not affect your iptables rules.

Last edited by grantwnorman; 12-22-2009 at 04:47 PM.
 
Old 12-23-2009, 03:00 AM   #3
hboosh
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Original Poster
Rep: Reputation: 0
ok, thanks. i'll do that.

cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script that will automatically add entries to the iptables file kaplan71 Linux - Security 2 12-10-2007 01:34 PM
vim add # automatically noir911 Linux - Software 11 09-13-2006 10:56 PM
add automatically icon for usb abd_bela Debian 2 01-29-2006 10:23 AM
automatically add route on boot? Loz Linux - Networking 1 11-22-2004 11:56 PM
Gnome 2.6: Automatically add games? technopasta Linux - Games 1 04-21-2004 08:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration