LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 04-29-2003, 12:37 PM   #1
Dek
LQ Newbie
 
Registered: Apr 2003
Distribution: RedHat 8.0 - Kernel 2.4.20-8
Posts: 28

Rep: Reputation: 15
iptables - source ? destination ? From where ?


Hi !

the question will sound stupid but in iptables, what is the point of reference for the "source" and "destination" feature.

I mean, you have your computer and internet.
You set
Accept packet if destination port is tcp 80.
Does it mean allow the packet that goes from my computer to internet on tcp 80
or
allow the packet that goes from internet to my computer on port tcp 80 ?

Thanks in advance !

Dek
 
Old 04-29-2003, 01:26 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
The effect of source and destination will vary depending whether it is in the INPUT or the OUTPUT chain. Just as an example, I allow FTP connections from within my LAN only and I use blocks on both chains. So on the INPUT chain I've got

iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 21 -j ACCEPT

In this case the rule only allows FTP if the source is 192.168.1.0/24 and it is heading to port 21 on my linux box. That could be modified to

iptables -A INPUT -p tcp -s 192.168.1.0/24 --sport 21 -j ACCEPT

in which case the traffic would be allowed only if it was coming from port 21 on one of my lan computers.

And then on the OUTPUT chain I've got

iptables -A OUTPUT -p tcp -d 192.162.1.0/24 --sport 21 -j ACCEPT

In this case the FTP connection is allowed only if it is going to my lan and it is coming from port 21 on my linux box. You could also do something like:

iptables -A OUTPUT -p tcp -d 192.168.1.0/24 ---dport 21 -j ACCEPT

in which case any traffic heading for port 21 on any machine on the lan would be allowed regardless of what port on the linux box is originating the connection.
 
1 members found this post helpful.
Old 04-29-2003, 03:50 PM   #3
Dek
LQ Newbie
 
Registered: Apr 2003
Distribution: RedHat 8.0 - Kernel 2.4.20-8
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks Hangdog42 ! I will keep your clear answer to refer each time i get a doubt on the question.

Thanks to you things start to make some sense with iptables.

Dek
 
Old 05-01-2003, 12:43 AM   #4
n.antonio
LQ Newbie
 
Registered: Apr 2003
Posts: 18

Rep: Reputation: 0
Basically you allow traffic from your computer to the internet, if you want to browse over the internet and you allow traffic from the internet to tcp port 80 if you a web pages in your LAN.
 
  


Reply


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
Change the destination URL by IPTABLES swmok Linux - Networking 4 09-14-2004 12:33 PM
iptables logging destination Strikeman Linux - Security 1 03-12-2004 01:45 PM
problem to print source address and destination address jooboo Programming 2 11-26-2003 04:24 PM
IPTABLES --to-destination muliple ip:port hawk4eye Linux - Networking 4 02-07-2003 05:59 AM
Martion Source/Destination bfloeagle Linux - Networking 2 06-13-2001 07:42 AM


All times are GMT -5. The time now is 07:58 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration