LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-04-2009, 03:18 AM   #1
gubak
Member
 
Registered: Jul 2004
Posts: 332

Rep: Reputation: 30
More than one source IP in IPTABLES


Hi!

My question is about iptables:
Is it possible to specify more than one ip in -s (source)?
For example:
I want to drop all packets except those who coming from 5.2.2.2 and 5.2.2.11:

iptables -A FORWARD -i eth1 -s ! 5.2.2.2,5.2.2.11 -j DROP

But it does't work!

Can somebody help me?

Thanks
 
Old 11-04-2009, 03:31 AM   #2
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Unless you can arrange to have the accepted IPs in one subnet, you'll have to list them seperately, reversing the logic:
Code:
iptables -A FORWARD -i eth1 --src 5.2.2.2/32 -j ACCEPT
iptables -A FORWARD -i eth1 --src 5.2.2.11/32 -j ACCEPT
iptables -A FORWARD -i eth1 -j DROP
 
  


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
iptables dnat working, but server logs local source IP instead of original source IP Nothsa Linux - Server 3 02-14-2008 05:34 PM
Mangle ip source with iptables spank Linux - Networking 1 02-02-2008 12:34 AM
iptables (changing source address) rickthemick Linux - Networking 12 11-05-2004 07:43 AM
iptables: source range Carlee Linux - Security 8 09-01-2003 01:38 PM
iptables - source ? destination ? From where ? Dek Linux - Networking 3 04-30-2003 11:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:40 PM.

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