Computing.Net > Forums > Linux > IPTABLES internal/external nic

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

IPTABLES internal/external nic

Reply to Message Icon

Name: Kvetch
Date: August 19, 2004 at 12:04:03 Pacific
OS: RH E3
CPU/Ram: 2.4 XEON
Comment:

I can't seem to figure out what I am doing wrong with my IPTABLES rules. I have 2 nics on this machine. I wanted to trust everything from eth0 and deny everything but port 80 on external nic.

# iptables -F
# iptables -A INPUT -i eth1 -s 192.168.1.0/24 -j REJECT - I want to reject spoofed addresses pretending to be my internal nic
# iptables -A INPUT -i lo -j ACCEPT - accept everything on the loopback
# iptables -A INPUT -i eth0 -j ACCEPT - except everything on the internal nic
# iptables -A INPUT -p tcp --dport www -j ACCEPT - is limiting this to the eth1 needed?
# iptables -A INPUT -j LOG -m limit
# iptables -A INPUT -j REJECT
# service iptables save

I restart iptables but then I am unable to ssh into eth0.
Any ideas what is wrong in my config?



Sponsored Link
Ads by Google

Response Number 1
Name: 3Dave
Date: August 20, 2004 at 01:13:57 Pacific
Reply:

FYI you can protect yourself against IP sppofing with:
# echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter



0

Response Number 2
Name: Kvetch
Date: August 20, 2004 at 06:24:03 Pacific
Reply:

Thanks - I didn't mention that but I already set that.
Thanks


0

Response Number 3
Name: 3Dave
Date: August 20, 2004 at 06:44:55 Pacific
Reply:

You can probably leave out the "iptables -A INPUT -i eth1 -s 192.168.1.0/24 -j REJECT - I"

Why have the -I (I take it the "- I" is a typo for "-I") without a chain name when the rule is the first to be set? It looks as though eth1 will reject everything coming from 192.168.1.0/24 even if its eth0. If you want to use that rule you might want to add a destination pointing at you local lan...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: IPTABLES internal/external nic

Port forwarding www.computing.net/answers/linux/port-forwarding/18291.html

iptables with several NIC's www.computing.net/answers/linux/iptables-with-several-nics/28444.html

NAT issue www.computing.net/answers/linux/nat-issue/9826.html