LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptables question (https://www.linuxquestions.org/questions/linux-security-4/iptables-question-577520/)

pinoyskull 08-16-2007 06:46 AM

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?

muha 08-16-2007 06:54 AM

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 ..

pinoyskull 08-16-2007 06:59 AM

thanks for the quick reply muha

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

little by little im learning :)

muha 08-16-2007 07:30 AM

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.

pinoyskull 08-16-2007 07:32 AM

thanks for the link muha


All times are GMT -5. The time now is 07:01 AM.