Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables: 127.0.0.1 != lo

Reply
Thread Tools Display Modes

iptables: 127.0.0.1 != lo

 
 
Timo Nentwig
Guest
Posts: n/a

 
      05-08-2005, 09:40 AM
Hi!

I have two network interfaces (eth0 and eth1) and the following rule:

--source 127.0.0.0/8 --in-interface !lo -j DROP

unfortunately that does drop local packages (from 127.0.0.1 to 127.0.0.1).

Why?
 
Reply With Quote
 
 
 
 
soulimane.mammar@gmail.com
Guest
Posts: n/a

 
      05-08-2005, 11:03 AM
hi !
this rule drops packets from source 127.0.0.1 comming from an interface
other than lo ....
Try
-A FORWARD -s 127.0.0.0/8 -j DROP
Good luck
S. MAMMAR

 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      05-08-2005, 03:56 PM
In article <d5kmqe$v5q$04$(E-Mail Removed)>,
Timo Nentwig <(E-Mail Removed)> wrote:
:Hi!
:
:I have two network interfaces (eth0 and eth1) and the following rule:
:
:--source 127.0.0.0/8 --in-interface !lo -j DROP
:
:unfortunately that does drop local packages (from 127.0.0.1 to 127.0.0.1).
:
:Why?

Two reasons:
1. The '!' character is sometimes special to the shell and would need
to be quoted if the above rule were part of a shell command.

2. Iptables requires the '!' character to be a separate argument.

Note that a '!' character standing alone is _not_ altered by the shell
and does not need to be quoted, but the string "!lo" invokes the
shell's history expansion mechanism. In your case, it unfortunately
expanded to something that still appeared legal to iptables, or else
you added that rule to /etc/sysconfig/iptables with an editor. You
are strictly on you own when you do that. Iptables presumes that
/etc/sysconfig/iptables was generated by iptables-save.

This should work as you expect:

iptables --source 127.0.0.0/8 --in-interface ! lo -j DROP

--
Bob Nichols AT comcast.net I am "rnichols42"
 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      05-08-2005, 04:08 PM
In article <d5lcqi$l4k$(E-Mail Removed)>, I wrote:
:
:This should work as you expect:
:
: iptables --source 127.0.0.0/8 --in-interface ! lo -j DROP

Oops -- typing a bit to hastily there. That command is incomplete and
doesn't specify where to put the rule. I'll leave that as an exercise
for the reader.

--
Bob Nichols AT comcast.net I am "rnichols42"
 
Reply With Quote
 
Timo Nentwig
Guest
Posts: n/a

 
      05-08-2005, 05:14 PM
Robert Nichols wrote:

> In article <d5lcqi$l4k$(E-Mail Removed)>, I wrote:
> :
> :This should work as you expect:
> :
> : iptables --source 127.0.0.0/8 --in-interface ! lo -j DROP
>
> Oops -- typing a bit to hastily there. That command is incomplete and
> doesn't specify where to put the rule. I'll leave that as an exercise
> for the reader.


Yes, that missing space was a typo, too. That's not the problem.
 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      05-09-2005, 01:25 AM
Note: E-mailed *and* posted.

In article <d5lheg$eeb$05$(E-Mail Removed)>,
Timo Nentwig <(E-Mail Removed)> wrote:
:Robert Nichols wrote:
:
:> In article <d5lcqi$l4k$(E-Mail Removed)>, I wrote:
:> :
:> :This should work as you expect:
:> :
:> : iptables --source 127.0.0.0/8 --in-interface ! lo -j DROP
:>
:> Oops -- typing a bit to hastily there. That command is incomplete and
:> doesn't specify where to put the rule. I'll leave that as an exercise
:> for the reader.
:
:Yes, that missing space was a typo, too. That's not the problem.

I don't know what's happening, then. When I insert the a rule with:

# iptables -I RH-Firewall-1-INPUT 1 -s 127.0.0.0/8 -i ! lo -j LOG

it does not log packets sent to 127.0.0.1 via the loopback interface.
(Yes, if I leave out the "!" it does log the packets.)

By any chance do you have some unusual routing that is sending 127.0/8
traffic over another interface? Try changing "DROP" to "LOG" and see
what gets logged.

--
Bob Nichols AT comcast.net I am "rnichols42"
 
Reply With Quote
 
Timo Nentwig
Guest
Posts: n/a

 
      05-10-2005, 06:50 PM
Robert Nichols wrote:

> By any chance do you have some unusual routing that is sending 127.0/8
> traffic over another interface? Try changing "DROP" to "LOG" and see


I have two network interfaces and use ifmetric...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
about iptables junaidaslam Linux Networking 3 08-29-2005 09:35 PM
Looking for iptables applications code (iptables.c) to run some rules to forward packets tvnaidu@yahoo.com Linux Networking 2 01-17-2005 05:01 PM
iptables Bernd Roth Linux Networking 5 01-16-2005 05:53 PM
iptables and nat Marcin Giedz Linux Networking 5 07-06-2004 07:05 AM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM



1 2 3 4 5 6 7 8 9 10 11