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

Netmasks unmasked (was Re: Need help w/ dhcpd )



Subnet masks:

If you take an IP address, such as 192.168.1.10, it has two parts, a
subnet, and a host, how do you know where one ends and the other
begins?  The subnet mask
IP             subnet mask      subnet           host
192.168.10.10   255.255.255.0    192.168.10.0    10
192.168.10.10   255.255.0.0      192.168.0.0     10.10
192.168.10.10   255.255.252.0    192.168.8.0     2.10


the trick is understanding what the 255 means.  Computers work in
binary, so an IP address is made up of 4 octets (8 bits)
11111111.11111111.11111111.11111111

binary 11111111 = decimal 255

so a subnet mask of 255.255.252.0 is the same as:
11111111.11111111.11111100.00000000

the ip address 192.168.10.10 is:
11000000.10101000.00001010.00001010

to determine the subnet and the host parts of the address, you use the
mask, all numbers that line up with a 1 are part of the subnet, all
numbers that line up with a 0 are part of the host:
IP    11000000.10101000.00001010.00001010  (192.168.10.10)
MASK  11111111.11111111.11111100.00000000  (255.255.252.0)
SUBNET11000000.10101000.00001000.00000000  (192.168.8.0)
HOST  00000000.00000000.00000010.00001010  (0.0.2.10)  

Using a simple subnet as an example (255.255.255.0) aka Class C.

each subnet has 256 available addresses 0-255, the first is known as
the network address 192.168.10.0, and the last is known as the
broadcast address 192.168.10.255 (broadcast simply means a packet
intended for all hosts) so you end up with 254 possible machine on a
255.255.255.0 network.  on a 255.255.0.0 network, you have 65023
possible hosts (255*255-2)
You can see a breakdown of most masks at:
http://nis.nsf.net/internet/documents/rfc/rfc1878.txt

Now, why does all this matter?
Here is a typical routing table:


#route -n
Destination   Gateway      Genmask       Flags Metric Ref    Use Iface
192.168.100.0 0.0.0.0      255.255.255.0   U     0      0        0 eth0
12.253.54.0   0.0.0.0      255.255.255.0   U     0      0        0 eth1
0.0.0.0       12.253.54.1  0.0.0.0         UG    0      0        0 eth1

the first one states anything intended for subnet 192.168.100.0 is
simply put out on eth0 
the second one states anything intended for subnet 12.253.54.0 is put
out on eth1
the third line states anything else (0.0.0.0) is sent to 12.253.54.1
for additional routing.

Hope this helps, if you have any specific questions or need
clarification, let me know.  For those of you that know it all, I did
leave out a few things in the interest of brevity and clarity.




I think your problem below is that the DHCP server needs to be on all
four subnets, so add a virtual interface for each subnet.

Brandon

--- Jeff Vincent <JVINCENT@novell.com> wrote:
> There are no other routers between the subnets that I know of. 
> 
> When we configure our machines statically, all use the same static
> route at address X.Y.D.254 (same as static route?) and all use the
> same
> subnet mask of 255.255.252.0 regardless of subnet and has been that
> way
> for nearly 2 years.  (netmasks have always been a bit of voodoo magic
> for me anyway (see question below)- ack!)  However, our IS dept. told
> us to use that subnet mask and additionally delegated us a domain and
> the 4 class C subnets for our testing use.  At least I thought they
> were
> class C address blocks:
> 
> X.Y.A.[0-255]
> X.Y.B.[0-255]
> X.Y.C.[0-255]
> X.Y.D.[0-255]
> 
> where the '0' is the network and '255' is the broadcast address.
> 
> Also, the dhcp server is also our dns server ( address: X.Y.D.252 )
> with a single NIC (eth0) and I can browse the web and ping anything
> in
> or out of our lab by name or address from this machine, so the
> interface
> seems to be working.
> 
> Regardless, I added the 'option routers' and 'option
> broadcast-address'
> to each subnet declaration as you suggested and still the same
> message:
> 
> 
>      Warning: subnet X.Y.B.0/22 conflicts with subnet X.Y.A.0/22
>      Address range X.Y.B.201 to X.Y.B.254 not on net
> X.Y.153.0/255.255.252.0!
>      exiting.

Net X.Y.153.0/22 (should be X.Y.152.0/22)
is all IP's from 

X.Y.152-155.N  network address is X.Y.152.0 and broadcast is
X.Y.155.255


> 
> If I change the netmask to 255.255.252.0 I get this message:
> 
>      No subnet declaration for eth0 (151.155.155.252).
>      Please write a subnet declaration in your dhcpd.conf file for
> the
>      network segment to which interface eth0 is attached.
>      exiting.
> 
> I then added an additional subnet declaration for <subnet4> inside
> the
> shared-network section but with no range (we don't want any of this
> subnet in the dhcp pool) and now it seems to work.  I am most
> confused. 
> Maybe I need to really figure out the netmask thing.  Is the netmask
> that is part of the subnet declaration different from the 'option
> subnet-mask' statement?
> 
> 
> 
> >>> Jeff <jcoppock1@attbi.com> 12/11/01 06:11PM >>>
> Jeff Vincent, 2001-Dec-11 17:16 -0700:
> > Our test lab has 4 class C address blocks assigned to it that are
> all
> on
> > the same wire (segment?) and we are finally getting around to
> installing
> > a dhcp server.  We have a Debian-woody (testing) server up, but
> when
> I
> > start it, it says:
> > 
> > Address range <subnet2>.201 to <subnet2>.254 not on net
> > <subnet2>.0/255.255.252.0
> 
> Have you configured the interface?  This usually occurs because
> the interface is not configured or is not up.
> 
> Also, I think your netmask is wrong.  A class C is 255.255.255.0
> 
> Also-also, I added two line to one of the subnets below in your
> config.  You should add these and duplicate it for each subnet.
> Since you are multinetting a single 'wire', it is important to
> make sure the broadcasts are unique for each subnet, especially
> for the dhcp service.  And, configuring the router is important.
> 
> > and then the server exits.  Here is my dhcpd.conf (specific
> addresses
> > ommitted for security reasons):
> > 
> > shared-network TestLab {
> > 	option routers <subnet4>.254;
> > 	option ntp-servers <subnet4>.252 , <subnet4>.253;
> > 	option domain-name-servers <subnet4>.252 , <subnet4>.253;
> > 	option domain-name "<mydomain>";
> > 
> > 	subnet <subnet1>.0 netmask 255.255.252.0 {
>  		range dynamic-bootp <subnet1>.201 <subnet1>.254;
> 		option broadcast <subnet1>.255;
> 		option router <subnet1>.1;
> > 		}
> > 	subnet <subnet2>.0 netmask 255.255.252.0 {
> > 		range <subnet2>.201 <subnet2>.254;
> > 		}
> > 	subnet <subnet3>.0 netmask 255.255.252.0 {
> > 		range <subnet3>.201 <subnet3>.254;
> > 		}
> > 	}
> > 
> > We statically allocate addresses 1-200 for <subnet1>, <subnet2>,
> > <subnet3> and all addresses in <subnet4>.  We now want to put the
> upper
> > 54 addresses of the first three subnets (e.g., 201-254) in the dhcp
> > pool.  What am I doing wrong?  I can't find (or didn't understand)
> the
> > correct use of the shared-network block.  
> > 
> > I also assume the netmask part of each subnet statement is the same
> > netmask we set on each statically allocated machine.
> > 
> > Thanks for any help.
> > 
> > Jeff
> 
> cya...jc
> 
> -- 
> Jeff Coppock		Systems Engineer
> Diggin' Debian		Admin and User
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com



Reply to: