LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Wrong netmask for dhcpd ? (https://www.linuxquestions.org/questions/linux-networking-3/wrong-netmask-for-dhcpd-322038/)

michaelsanford 05-10-2005 01:06 PM

Wrong netmask for dhcpd ?
 
I always manage to ruin my netmask in dhcpd... 255.255.0.0 worked when the only wlan network I had was 10.0.0.0 (note that I always had the 192.168 network too, and it worked).

Code:

/etc/dhcpd.conf line 12: subnet 10.0.1.0 netmask 255.255.0.0: bad subnet number/mask combination.
subnet 10.0.1.0 netmask 255.255.0.0
                                  ^
Configuration file errors encountered -- exiting

Why isn't this ok ?
Code:

wlan0    Link encap:Ethernet  HWaddr 00:12:17:0D:39:23
          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:30739 errors:0 dropped:0 overruns:0 frame:0
          TX packets:181778 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5090507 (4.8 Mb)  TX bytes:257826621 (245.8 Mb)
          Memory:f5001000-f50017ff

wlan0:1  Link encap:Ethernet  HWaddr 00:12:17:0D:39:23
          inet addr:10.0.1.1  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:f5001000-f50017ff

Code:

net 192.168.1.0 netmask 255.255.255.0 {
        option routers 192.168.1.1;
        option domain-name-servers 206.47.244.12, 206.47.244.42;
        option ip-forwarding on;
        range 192.168.1.100 192.168.1.254;
}

subnet 10.0.1.0 netmask 255.255.0.0 {
        option routers 10.0.1.1;
        option domain-name-servers 206.47.244.12, 206.47.244.42;
        option ip-forwarding on;
        range 10.0.1.2 10.0.1.255;
}

subnet 10.0.0.0 netmask 255.255.0.0 {
        option routers 10.0.0.1;
        option domain-name-servers 206.47.244.12, 206.47.244.42;
        option ip-forwarding on;
#      range 10.0.0.10 10.0.0.19;

        host michael {
                hardware ethernet 00:30:65:21:A9:E3;
                fixed-address 10.0.0.11;
        }
}


fr_laz 05-11-2005 07:01 AM

Hi,

A netmask is (in binary) composed of 2 sets of bits.
The first is made only of bits set to 1
The second is made only of bits set to 0

Bits set to 1 indicate what part of the IP address refers to the network address
Bits set to 0 indicate what part of the IP address refers to the host address

So this config :
10.0.1.34 255.255.0.0 (11111111.11111111.00000000.00000000)

means that you're the host number 1.34 in the 10.0.0.0 network

Thus in your conf there are 2 problems :

1/ IP config of interfaces :
WLAN0 : inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
WLAN0.1 : inet addr:10.0.1.1 Bcast:10.255.255.255 Mask:255.0.0.0

both interfaces are in the same subnet : 10.0.0.0 255.0.0.0
they should be in different subnets : 10.0.0.0 255.255.255.0 and 10.0.1.0 255.255.255.0

2/ DHCPD config :
subnet 10.0.1.0 netmask 255.255.0.0
subnet 10.0.0.0 netmask 255.255.0.0

first that doesn't match your interfaces config (255.0.0.0) and second you've got 2 instances of the same subnet : 10.0.1.0 255.255.0.0 is included in 10.0.0.0 255.255.0.0 just like all 10.0.x.x addresses.

so, as for the interfaces, you've got to use 255.255.255.0 netmask.




I'm not sure whether I made myself clear... since the difference between your 2 subnets is in the 3rd byte of the address, the mask _MUST_ be 3 times 255 and then 0.

Remark : the default mask for 10. networks is 255.0.0.0, and the default one for 192 networks is 255.255.255.0, that's why your interfaces are configured with these masks.
But that's not a problem, you can use other masks, but, if so, then you have to specify the mask you'll use :

ifconfig eth0 192.168.0.3 will give a 192.168.0.3 255.255.255.0 config
ifconfig eth0 192.168.0.3 netmask 255.255.0.0 will overide the default mask and give a 192.168.0.3 255.255.0.0 config

Good luck,

scowles 05-11-2005 07:16 AM

As fr_laz mentioned on his post, change you netmask to a 24 bit mask (255.255.255.0) -or- another option would be to change your network address to use the second octet. i.e.

10.0.0.0 - 255.255.0.0
10.1.0.0 - 255.255.0.0

michaelsanford 05-11-2005 10:15 AM

I've always had an issue with the binary netmask idea...I'll get it eventually hehe.

Thanks very much for both your replies; very clear!


All times are GMT -5. The time now is 05:43 AM.