[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 2 variables in R. Ziegler's book

On Tue, Apr 24, 2001 at 10:16:12AM +0100, Michael Boyd wrote:
> Hello,
> I am constructing my ipchains ruleset at the moment following
> the example in R. Ziegler's Linux Firewalls.  In the section
> on smurf attacks he uses 2 variables which seem not to be
> declared anywhere, $NETMASK and $NETWORK.
> Can anyone tell me what they are?  I presume NETMASK is fairly obvious
> but don't know what to enter for NETWORK.

They are not predefined.

I have not looked at that book, but he's probably just using
them (without stating it explicitly) to mean that you should
fill in your own network and netmask there.

An IP address of, along with a netmask of means the network address is  But,
with a netmask of, the network address would be  With a netmask of, the network address
would be  Get the idea? :)

Just take the binary representation of the IP address:
e.g. -> 10101100.00010001.00000101.00000011

and the binary representation of the netmask:
e.g. -> 11111111.11110000.00000000.00000000

Then just bitwise AND them together:

- ---------------------------------
- ---------------------------------

And you get the network address.

In this example,

Hope this helps :)

Michael Wood        | Tel: +27 21 762 0276 | http://www.kingsley.co.za/
wood@kingsley.co.za | Fax: +27 21 761 9930 | Kingsley Technologies

Reply to: