Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables: How to specify multiple address

Reply
Thread Tools Display Modes

iptables: How to specify multiple address

 
 
bolero92@yahoo.com
Guest
Posts: n/a

 
      07-10-2006, 09:16 AM
I have to MARK the packets which originates from 10.1.1.0/24 but NOT to
the destinations 192.168.1.0/24 and 172.16.1.0/24.

iptables -t mangle -A PREROUTING -s 10.1.1.0/24 -d ! 192.168.1.0/24 and
! 172.16.1.0/24 -j MARK --set-mark 0x4

Of course the above does not work.
How to specify two different subnet destinations with iptables?

 
Reply With Quote
 
 
 
 
Constant Meiring
Guest
Posts: n/a

 
      07-10-2006, 12:59 PM

(E-Mail Removed) wrote:
> I have to MARK the packets which originates from 10.1.1.0/24 but NOT to
> the destinations 192.168.1.0/24 and 172.16.1.0/24.
>
> iptables -t mangle -A PREROUTING -s 10.1.1.0/24 -d ! 192.168.1.0/24 and
> ! 172.16.1.0/24 -j MARK --set-mark 0x4
>
> Of course the above does not work.
> How to specify two different subnet destinations with iptables?


Jy mark the one range eg. 10.1.1.0/24. Thats it.

iptables -t mangle -A PREROUTING -s 10.1.1.0/24 -j MARK --set-mark 0x4

It will then only mark 10.1.1.0/24... I Think.

I don't really know what you are doing as I have never before needed to
use the mangle tables.

 
Reply With Quote
 
Ken Sims
Guest
Posts: n/a

 
      07-10-2006, 02:00 PM
Hi -

On 10 Jul 2006 02:16:20 -0700, (E-Mail Removed) wrote:

>I have to MARK the packets which originates from 10.1.1.0/24 but NOT to
>the destinations 192.168.1.0/24 and 172.16.1.0/24.
>
>iptables -t mangle -A PREROUTING -s 10.1.1.0/24 -d ! 192.168.1.0/24 and
>! 172.16.1.0/24 -j MARK --set-mark 0x4
>
>Of course the above does not work.
>How to specify two different subnet destinations with iptables?


The simplest way that comes to mind is to have -s 10.1.1.0/24 jump to
user chain.

In the user chain if -d 192.168.1.0/24 RETURN, if -d 172.16.1.0/24
RETURN, set the mark.

--
Ken
http://www.kensims.net/
 
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
iptables: using the same address lists against multiple ports Mark Hobley Linux Networking 9 11-04-2008 04:26 PM
iptables and multiple ip-addresses? Manuel Garcia Linux Networking 4 01-08-2007 06:29 PM
Multiple web servers behind iptables gaur_ms@yahoo.co.in Linux Networking 2 10-26-2005 07:59 PM
iptables with multiple links gaurms@hotmail.com Linux Networking 0 07-02-2005 03:18 PM
iptables, NAT and multiple subnets - how? ERACC Linux Networking 1 10-06-2003 11:43 PM



1 2 3 4 5 6 7 8 9 10 11