Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables syntax

Reply
Thread Tools Display Modes

iptables syntax

 
 
Matt
Guest
Posts: n/a

 
      09-24-2003, 11:05 AM
I want to drop new connections from any host except two. Previously I was
accepting from one address range as follows (I've changed the range to a
private one for this post):

iptables -A INPUT -m state --state NEW -i eth0 -j DROP \! -s 172.16.4.0/24

How do I change it so that it drops any new connections except those from
172.16.4.0/24 or 172.16.200.0/24?

Cheers

M


 
Reply With Quote
 
 
 
 
Horst Knobloch
Guest
Posts: n/a

 
      09-24-2003, 11:17 AM
Matt <(E-Mail Removed)> wrote:

> I want to drop new connections from any host except two. Previously I
> was accepting from one address range as follows (I've changed the range
> to a private one for this post):
>
> iptables -A INPUT -m state --state NEW -i eth0 -j DROP \! -s
> 172.16.4.0/24


I guess this should read "... -j DROP -s \! 172.16.4.0/24"


>
> How do I change it so that it drops any new connections except those from
> 172.16.4.0/24 or 172.16.200.0/24?


iptables -A INPUT -m state --state NEW -i eth0 \
--src 172.16.4.0/24 -j ACCEPT
iptables -A INPUT -m state --state NEW -i eth0 \
--src 172.16.200.0/24 -j ACCEPT
iptables -A INPUT -m state --state NEW -i eth0 -j DROP


Ciao, Horst
--
»When pings go wrong (It hurts me too)« E.Clapton/E.James/P.Tscharn
 
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
valid email-adr syntax ? no-toppost@gmail.com Linux Networking 4 09-25-2009 04:49 PM
[/etc/network/interfaces]Syntax somewhere?? universalbitmapper Linux Networking 8 04-25-2006 06:32 AM
telnet syntax for ports hawat.thufir@gmail.com Linux Networking 5 01-18-2006 06:08 PM
Command syntax Invisible Windows Networking 0 02-12-2004 09:20 AM
Net Use syntax lynn Windows Networking 1 08-05-2003 10:49 PM



1 2 3 4 5 6 7 8 9 10 11