Networking Forums

Networking Forums > Computer Networking > Linux Networking > Howto set an IP address range into rules of iptables

Reply
Thread Tools Display Modes

Howto set an IP address range into rules of iptables

 
 
Terry Ho
Guest
Posts: n/a

 
      08-25-2003, 08:30 AM
I tried the following instructions:

iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p tcp -j ACCEPT
iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p udp -j ACCEPT
iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p tcp -j ACCEPT
iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p udp -j ACCEPT

It appears error. Error message is:

iptables v1.2.5: host/network `192.168.0.200-192.168.0.240' not found
Try `iptables -h' or 'iptables --help' for more information.

Would you tell me how to set an IP address range into rules of iptables?
Thank you very much!


 
Reply With Quote
 
 
 
 
Saikat Guha
Guest
Posts: n/a

 
      08-25-2003, 09:16 AM
Terry Ho wrote:

> iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p tcp -j ACCEPT
> iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p udp -j ACCEPT
> iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p tcp -j ACCEPT
> iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p udp -j ACCEPT


You need to specify using the address/mask format

try
192.168.0.200/29 (for 200 - 207)
192.168.0.208/28 (for 208 - 223)
192.168.0.224/28 (for 224 - 239)
192.168.0.240/32 (for 240 - 240)

So each of your lines above will result in 4 lines -- one for each of the
above address/mask combinations

-- Saikat
 
Reply With Quote
 
Terry Ho
Guest
Posts: n/a

 
      08-25-2003, 10:03 AM
Thank you very much! But I have one question.
You wrote:
> 192.168.0.200/29 (for 200 - 207)
> 192.168.0.208/28 (for 208 - 223)
> 192.168.0.224/28 (for 224 - 239)
> 192.168.0.240/32 (for 240 - 240)


I understand
> 192.168.0.200/29 (for 200 - 207)
> 192.168.0.208/28 (for 208 - 223)
> 192.168.0.240/32 (for 240 - 240)


But I don't understand
> 192.168.0.224/28 (for 224 - 239)

Why use network mask 28 bits? I think the network mask is 27 bits. Is it
right? ^-^

"Saikat Guha" <(E-Mail Removed)>
??????:bick74$jsg$(E-Mail Removed)...
> Terry Ho wrote:
>
> > iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p tcp -j

ACCEPT
> > iptables -A FORWARD -s 192.168.0.200-192.168.0.240 -d 0/0 -p udp -j

ACCEPT
> > iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p tcp -j

ACCEPT
> > iptables -A FORWARD -s 0/0 -d 192.168.0.200-192.168.0.240 -p udp -j

ACCEPT
>
> You need to specify using the address/mask format
>
> try
> 192.168.0.200/29 (for 200 - 207)
> 192.168.0.208/28 (for 208 - 223)
> 192.168.0.224/28 (for 224 - 239)
> 192.168.0.240/32 (for 240 - 240)
>
> So each of your lines above will result in 4 lines -- one for each of the
> above address/mask combinations
>
> -- Saikat



 
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
HELP, Need quick iptables rules akak01000101@gmail.com Linux Networking 5 03-03-2008 07:45 PM
Removing iptables rules Augustus SFX van Dusen Linux Networking 7 06-05-2006 04:05 PM
Iptables and rules from database ? snowi@ras.pl Linux Networking 0 10-16-2005 11:20 AM
Looking for iptables applications code (iptables.c) to run some rules to forward packets tvnaidu@yahoo.com Linux Networking 2 01-17-2005 05:01 PM
iptables rules for vonage Rob Ristroph Linux Networking 0 10-02-2003 06:44 AM



1 2 3 4 5 6 7 8 9 10 11