iptables FORWARD curiosity

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 180

PostPosted: Thu Mar 24, 2011 11:51    Post subject: iptables FORWARD curiosity Reply with quote
I'm using a Buffalo WZR-HP-G300NH with the "official" Buffalo v2.4 14998 firmware. I've encountered a weird problem related to my iptables commands that I could use some input on.

I want to block incoming connections based on a fairly wide range of IP addresses (private server, so anywhere I don't travel to gets blocked). Here's an example in my firewall commands (all one line):

Code:
iptables -I FORWARD -m iprange --src-range 77.0.0.0-95.255.255.255 -j logdrop


With that set, indeed nobody in that port range can connect in. So far, so good.

*But*, now I also can't browse to anything in that range. For example, this very site happens to be hosted at an 83.141.4.210 address, and with the above line in my firewall, I can't connect.

After more reading, I thought replacing "FORWARD" with "INPUT" might do the trick, but while I can now connect out, everybody can connect in. So that command seems to do nothing at all.

What am I missing?

Brad.
Sponsor
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 180

PostPosted: Thu Mar 24, 2011 12:27    Post subject: Reply with quote
A bit more experimentation:

Code:
iptables -I FORWARD -s 83.0.0.0/8 -j logdrop

or
Code:
iptables -I FORWARD -s 83.0.0.0/8 -j DROP


exhibits the same behavior.
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Thu Mar 24, 2011 18:15    Post subject: Reply with quote
If you want to prevent them from initiating connections to you but still allow yourself to initiate connections to them then add this to the rule:

-m state --state NEW

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
bpsmicro
DD-WRT User


Joined: 07 Oct 2010
Posts: 180

PostPosted: Thu Mar 24, 2011 18:20    Post subject: Reply with quote
Thanks for that. A quick test indicates that I can connect out with that added. I'll add it to all my rules, and then monitor for incoming connections to make sure it's working (not that I doubt you, of course).

I'll report the confirmation back here.

Brad.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum