LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-16-2007, 07:46 AM   #1
pinoyskull
Member
 
Registered: Jan 2005
Location: server farm
Distribution: CentOS 5.7
Posts: 59

Rep: Reputation: 15
iptables question


Im just learning iptables and I need a quick fix on a small problem that I have

this rule obviously allow port 587
Code:
$IPT -A FORWARD -i $LOCAL_IFACE -o $INET_IFACE1 -p tcp -s $LOCAL_NET --dport 587 -j ACCEPT
I want to customize it to bind on a specific ip address only, not the whole network

how would i do that?
 
Old 08-16-2007, 07:54 AM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 38
From where i'm sitting this looks like a scripting thing that is unrelated to iptables.
The script (you are using) will have a definition for $LOCAL_NET
I'd suggest either substituting '-s $LOCAL_NET' with '-s 117.234.23.123' (replace the ip you want to use)

If you want to re-use the same ip you can define it in the script like:
LOCAL_IP_NR_1="117.234.23.123"
And then use that variable in the line with; '-s $LOCAL_IP_NR_1'
You get the idea ..
 
Old 08-16-2007, 07:59 AM   #3
pinoyskull
Member
 
Registered: Jan 2005
Location: server farm
Distribution: CentOS 5.7
Posts: 59

Original Poster
Rep: Reputation: 15
thanks for the quick reply muha

i tried changing -s $LOCAL_NET with my ip address and it work.

little by little im learning
 
Old 08-16-2007, 08:30 AM   #4
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 38
If you need more info have a look in the bookmarks section on iptables:
http://www.linuxquestions.org/bookmarks/tags/iptables

And try to concentrate on the syntax that you would use to feed those commands into iptables buy hand.
What you need to realize that your script will actually perform this command (depending on your setup the interfaces eth0/1 differ):
Code:
iptables -A FORWARD -i eth0 -o eth1 -p tcp -s 117.234.23.123 --dport 587 -j ACCEPT
First start by learning to execute these commands by hand, and then later write scripts to execute these same commands.
 
Old 08-16-2007, 08:32 AM   #5
pinoyskull
Member
 
Registered: Jan 2005
Location: server farm
Distribution: CentOS 5.7
Posts: 59

Original Poster
Rep: Reputation: 15
thanks for the link muha
 
  


Reply

Tags
iptables


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 09:20 PM
Question on Iptables jspsandhu Linux - Security 3 06-04-2005 09:09 PM
iptables question Ipolit Slackware 2 06-01-2005 04:27 PM
iptables question enrique_arong Linux - Newbie 9 09-27-2004 03:53 PM
IPtables Question jacovds Linux - Security 10 11-17-2003 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:18 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