Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Apr 2003 18:39:09 +0100
From:      "Jonathan" <jonathan@sirtis.org.uk>
To:        "'Steve Warwick'" <ukla@attbi.com>, <freebsd-questions@FreeBSD.ORG>
Subject:   RE: Netmasks: the truth is out there?
Message-ID:  <002f01c30e76$3d9bdb20$3aaa9bd9@workstation>
In-Reply-To: <BAD3FE56.49C3%ukla@attbi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----
From: owner-freebsd-questions@freebsd.org
[mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Steve Warwick
Sent: 29 April 2003 18:03
To: freebsd-questions@FreeBSD.ORG
Subject: Netmasks: the truth is out there?


Hi All, 

I know someone out there knows the truth about netmasks. All the
documentation I can find on the net talks about "masking off" part of
the IP address and how you can tell network from subnet and host ids.

However, I have knowledgeable friend who is telling me that the netmask
is also dependant on how the hosting company has set up their routing
tables and incorrect netmasking on my part can reduce or halt my
connection.

So the question is, who is right? Is it as simple as just masking off
the first three octets or does the netmask interact with the router?

-----End of Original Message-----

Hi Steve,

They are both correct...

Masking off the first three octets implies that the network address is
contained with those three octets and the network interfaces within are
addressed using the remaining octet.

There's a nice port called whatmask (/usr/ports/net/whatmask) which will
show you examples of how different netmasks are used.

I, for instance, get given 8 IPs by my provider, so my netmask is
255.255.255.248.

So, for the netmark you talk of (3 octets) you would see something like:

su-2.05a# whatmask 192.168.0.1/24

------------------------------------------------
           TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 192.168.0.1
CIDR = ........................: /24
Netmask = .....................: 255.255.255.0
Wildcard Bits = ...............: 0.0.0.255
------------------------------------------------
Network Address = .............: 192.168.0.0
Broadcast Address = ...........: 192.168.0.255
Usable IP Addresses = .........: 254
First Usable IP Address = .....: 192.168.0.1
Last Usable IP Address = ......: 192.168.0.254

For 8 IPs, like my setup...

su-2.05a# whatmask 192.168.0.1/29

------------------------------------------------
           TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 192.168.0.1
CIDR = ........................: /29
Netmask = .....................: 255.255.255.248
Wildcard Bits = ...............: 0.0.0.7
------------------------------------------------
Network Address = .............: 192.168.0.0
Broadcast Address = ...........: 192.168.0.7
Usable IP Addresses = .........: 6
First Usable IP Address = .....: 192.168.0.1
Last Usable IP Address = ......: 192.168.0.6

What you need to do is ask your provider what the size of the network is
for your particular setup.

There's more information at: http://www.hildrum.com/IPAddress.htm

And to answer your specific question - if your router is to control 256
IPs, yes, you use 255.255.255.0 as the netmask. If it's 128, you use
255.255.255.128, 64 = 255.255.255.192 etc etc.

I did a Google search for "netmask explanation" - YMMV.

HTH,

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002f01c30e76$3d9bdb20$3aaa9bd9>