LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 09-16-2004, 11:56 PM   #1
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Rep: Reputation: 30
iptables


never used iptables before, start trying out.

-------------------------
Have two computer on a network with IP (192.168.0.12 and 192.168.0.44) respectively

on the 192.168.0.12 computer I input:
iptables -A FORWARD -i ethx -s 192.168.0.44 -j REJECT

why can computer with 192.168.0.44 still ping 192.168.0.12?
-------------------------------------------------------------------------------
 
Old 09-17-2004, 03:51 AM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
If that truely is an "x" in your IPTABLES line, then you've just shot yourself in the foot. Make sure it is set to eth0 or eth1 respectfully.

If it is set to the number, then I think you want to change REJECT to DROP. Not entirely sure on that, but I was thinking REJECT isn't a legit statement, meaning that it works but wasn't syntackfully correct.

Someone will likely set me either correct or wrong on the reject thing.
 
Old 09-17-2004, 04:45 AM   #3
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
Re: iptables

Quote:
Originally posted by blackzone
never used iptables before, start trying out.

-------------------------
Have two computer on a network with IP (192.168.0.12 and 192.168.0.44) respectively

on the 192.168.0.12 computer I input:
iptables -A FORWARD -i ethx -s 192.168.0.44 -j REJECT

why can computer with 192.168.0.44 still ping 192.168.0.12?
-------------------------------------------------------------------------------
surely it must ping
u must prefer one of the followings to block packets which come from 192.168.0.44 on computer with 192.168.0.12 ip.
iptables -A INPUT -s 192.168.0.44 -j DROP
or
iptables -A INPUT -s 192.168.0.44 -j REJECT

 
Old 09-17-2004, 04:46 AM   #4
mardanian
Member
 
Registered: Mar 2004
Distribution: Fedora
Posts: 254

Rep: Reputation: 30
try this if you only wana block ping .12 from .44


iptables -A INPUT -p icmp -s 192.168.0.44 -j REJECT


if you want to block everything from .44 then tries this

iptables -A FORWARD -s 192.168.0.44 -j DROP



regards
 
Old 09-17-2004, 05:36 AM   #5
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Original Poster
Rep: Reputation: 30
what's the different between input chain and forward chain?

Quote:
if you want to block everything from .44 then tries this
Quote:
iptables -A FORWARD -s 192.168.0.44 -j DROP
Since your blocking from .44 shouldn't it be "iptables -A INPUT -s 192.168.0.44 -j DROP" ?
 
Old 09-17-2004, 05:46 AM   #6
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Quote:
Originally posted by blackzone
what's the different between input chain and forward chain?




Since your blocking from .44 shouldn't it be "iptables -A INPUT -s 192.168.0.44 -j DROP" ?
Your incoming packets destined to your computer are checked against the rules in the INPUT chain. But FORWARD chain is for packets that comes to your computer but not destined to your computer; ie. willing to be forwarded. For example in a gateway computer; FORWARD chain can be used to control incoming/outgoing traffic. And yes, it should be INPUT chain in the example mardanian gave. Packets that related with forwarding goes _only_ through FORWARD chain, not both FORWARD and INPUT chains.
 
Old 09-17-2004, 01:52 PM   #7
mardanian
Member
 
Registered: Mar 2004
Distribution: Fedora
Posts: 254

Rep: Reputation: 30
If you want to learn more about iptables, then please read this nice tutorial

http://iptables-tutorial.frozentux.n...-tutorial.html
 
Old 09-21-2004, 09:05 PM   #8
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Original Poster
Rep: Reputation: 30
I was hoping there is a iptables tutorial for dummy

what does it mean by masquerade, ip contrack, mangle packet, TOS

I also saw Prerouting and Postrouting chains, can those be viewed? When I type iptables -L I only saw 3
 
Old 09-22-2004, 02:40 AM   #9
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
iptables -nvL
iptables -t nat -nvL
iptables -t mangle -nvL
 
Old 09-22-2004, 03:27 AM   #10
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Quote:
Originally posted by blackzone
I was hoping there is a iptables tutorial for dummy

what does it mean by masquerade, ip contrack, mangle packet, TOS

I also saw Prerouting and Postrouting chains, can those be viewed? When I type iptables -L I only saw 3
Masquerading is letting the internal network computers access to internet via a gateway that has a dynamic ip address. When an internal computer requests some data from the Internet; gateway changes the source address and do the request as it's coming from him and do the reverse when the reply come back.

conntrack is a iptables module that is used for doing connection tracking. Connection tracking is tracking a packet's connection that it is coming for or going out. For example you can block all SSH traffic or block SSH traffic that isn't belonging to an already established connection. Latter can be done by conntrack

packet mangling is a general term and means altering packet data. For example, when doing source nat and destination nat we alter the packets headers.

I know TOS as Type of Service, but i am not sure.
 
Old 09-22-2004, 12:06 PM   #11
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
this page links to some good scripts you can learn from, as well as faqs and howtos:

http://www.linuxguruz.com/iptables/
 
  


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
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

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

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