Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Reed Xia
Hi all,

I'm trying to set up DHCP for ipv4 and ipv6, and met the problem of "subnet_number():inet.c:45: Addr/mask length mismatch", I tried to google for days but did not get proper solution, could someone please help look into it? Appreciate every comment and reply, thanks!

Environment:
  • PC with Ubuntu 14.04, connected to a homeware device.
  • Internet Systems Consortium DHCP Server 4.3.4


My steps and log:

//It worked well when I started dhcpd for ipv4:

root@johw-Lenovo:/etc# /root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0 start
Internet Systems Consortium DHCP Server 4.3.4
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: dhcpd.conf
Database file: /var/db/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 0 leases to leases file.

No subnet declaration for start (no IPv4 addresses).
** Ignoring requests on start.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface start is attached. **

Listening on LPF/eth0/8c:89:a5:ba:66:0a/192.168.6.0/24
Sending on   LPF/eth0/8c:89:a5:ba:66:0a/192.168.6.0/24
Sending on   Socket/fallback/fallback-net

//Got error when it's for ipv6

root@johw-Lenovo:/etc# /root/dhcp-4.3.4/server/dhcpd -6 -cf dhcp6.conf eth0 start
Internet Systems Consortium DHCP Server 4.3.4
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/db/dhcpd6.leases
PID file: /var/run/dhcpd6.pid
Wrote 0 NA, 0 TA, 0 PD leases to lease file.
subnet_number():inet.c:45: Addr/mask length mismatch.

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging..

exiting.
root@johw-Lenovo:/etc# 

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

file content of dhcpd.conf

ddns-update-style none;

subnet 192.168.6.0 netmask 255.255.255.0 {

  range 192.168.6.10 192.168.6.20;

  option domain-name-servers 192.168.6.6;
  option broadcast-address 192.168.6.255;
  option routers 192.168.6.1;

  default-lease-time 320;
  max-lease-time 720;
  option domain-name "test_redhat.com";
}

next-server 192.168.6.3;

file content of dhcpd6.conf

ddns-update-style none;
subnet6 2001::/64 {
  range6 2001::10 2001::20;
  option dhcp6.name-servers 2001::6;
  option dhcp6.domain-search "test.example.com";
  default-lease-time 320;
  max-lease-time 720;
}
next-server 2001::3;


--
Thanks,
- Reed

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Simon Hobson
Reed Xia <[hidden email]> wrote:

> root@johw-Lenovo:/etc# /root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0 start
> ...
> No subnet declaration for start (no IPv4 addresses).

Can't help with the query itself, but you are starting the server incorrectly. "start" would be a command for your service management/init system - eg "service isc-dhcp-server [ start | stop ]". When starting the server directly as you are doing, omit the start - just executing it implies start !
As it is, dhcpd is trying to interpret start as the name of an interface, hence the error it's spitting out.

It's possible that this is the cause of your main issue - I've no idea on that but it's worth eliminating the "start" error first.

BTW - in general it's best to use the scripts to start the service. While manually starting it is easy for testing, it may not result in the same environment as when using the scripts - which can result in you getting something working, only for it to fail to start/work properly at boot time.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Reed Xia
Hi Simon,

At very beginning, I put the dhcp-4.3.4.tar.gz file in /root and installed it as README file said(./configure -> make -> make install), and I launched the service by "/root/dhcp-4.3.4/server/dhcpd", I guess I might not install dhcp well.(sorry I just started to use dhcpd a few day ago)

May I ask, as you said, I guess I shall launch the service by "service isc-dhcp-server start"?

I just tired it in my terminal, but it failed "isc-dhcp-server: unrecognized service".

And I can run "dhcpd", it will output logs as ones as I launched dhcpd for ipv4.

Thanks for your time!!

On Thu, May 26, 2016 at 5:28 PM, Simon Hobson <[hidden email]> wrote:
Reed Xia <[hidden email]> wrote:

> root@johw-Lenovo:/etc# /root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0 start
> ...
> No subnet declaration for start (no IPv4 addresses).

Can't help with the query itself, but you are starting the server incorrectly. "start" would be a command for your service management/init system - eg "service isc-dhcp-server [ start | stop ]". When starting the server directly as you are doing, omit the start - just executing it implies start !
As it is, dhcpd is trying to interpret start as the name of an interface, hence the error it's spitting out.

It's possible that this is the cause of your main issue - I've no idea on that but it's worth eliminating the "start" error first.

BTW - in general it's best to use the scripts to start the service. While manually starting it is easy for testing, it may not result in the same environment as when using the scripts - which can result in you getting something working, only for it to fail to start/work properly at boot time.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users



--
Thanks,
- Reed

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Simon Hobson
Reed Xia <[hidden email]> wrote:

> At very beginning, I put the dhcp-4.3.4.tar.gz file in /root and installed it as README file said(./configure -> make -> make install), and I launched the service by "/root/dhcp-4.3.4/server/dhcpd", I guess I might not install dhcp well.(sorry I just started to use dhcpd a few day ago)
>
> May I ask, as you said, I guess I shall launch the service by "service isc-dhcp-server start"?
>
> I just tired it in my terminal, but it failed "isc-dhcp-server: unrecognized service".

Ah, if you didn't install using the OS package manager then you might not have the init scripts installed - in that case "service ..." won't know about it.
Just leave off the "start" from the end of the command line, it'll clear the error about unknown interface "start".

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Graham Clinch
In reply to this post by Reed Xia
Hi Reed,

There seems to be some copy-paste confusion here with the various file names and command lines.

For IPv4
> root@johw-Lenovo:/etc#/root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0 start
[...]
> Config file: dhcpd.conf
[...]
> *file content of dhcpd.conf*


but for IPv6:
> root@johw-Lenovo:/etc#/root/dhcp-4.3.4/server/dhcpd -6 -cf dhcp6.conf eth0 start
[...]
> Config file: /etc/dhcpd.conf
[...]
> *file content of dhcpd6.conf*

So for IPv4, your command line is to read from 'dhcpd.conf', and dhcpd outputs that it's reading from that path, and then you report the content of (presumably) that file.

But for IPv6, you command line is to read from 'dhcp6.conf', dhcpd outputs that it's reading from /etc/dhcpd.conf (a different path - the default one compiled into the dhcpd binary?), and you report the content of a file named 'dhcpd6.conf' (note additional d).

I suggest you start by rechecking all the file names and command lines, since dhcpd is definitely not opening a file with a '6' in the name.

Graham
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Reed Xia
Hi Graham,

Thanks for helping look into my problem!

You remind me that dhcpd only refer to the file /etc/dhcpd.conf, while dhcpd6.conf was not used actually.

After trying for times, I think I may resolve this problem in a weird way..

1. Write the following texts to /etc/dhcpd.conf

ddns-update-style none;
subnet6 2001::/64 {
  range6 2001::10 2001::20;
  option dhcp6.name-servers 2001::6;
  option dhcp6.domain-search "test.example.com";
  default-lease-time 320;
  max-lease-time 720;
}
#next-server 2001::3;

2. Cd to /etc, and execute the following:

/root/dhcp-4.3.4/srver/dhcpd -6 -cf dhcpd.conf eth0

And will have logs:

Internet Systems Consortium DHCP Server 4.3.4
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/db/dhcpd6.leases
PID file: /var/run/dhcpd6.pid
Wrote 0 NA, 0 TA, 0 PD leases to lease file.
Bound to *:547
Listening on Socket/5/eth0/2001::/64
Sending on   Socket/5/eth0/2001::/64
No subnet6 declaration for dhcp.conf (no IPv6 addresses).
** Ignoring requests on dhcp.conf.  If this is not what
   you want, please write a subnet6 declaration
   in your dhcpd.conf file for the network segment
   to which interface dhcp.conf is attached. **

No subnet6 declaration for –cf (no IPv6 addresses).
** Ignoring requests on –cf.  If this is not what
   you want, please write a subnet6 declaration
   in your dhcpd.conf file for the network segment
   to which interface –cf is attached. **

3. Replace /etc/dhcpd.conf with the following content:

ddns-update-style none;
subnet 192.168.6.0 netmask 255.255.255.0 {
  range 192.168.6.10 192.168.6.20;
  option domain-name-servers 192.168.6.6;
  option broadcast-address 192.168.6.255;
  option routers 192.168.6.1;
  default-lease-time 320;
  max-lease-time 720;
  option domain-name "test_redhat.com";
}
next-server 192.168.6.3;

4. cd to /etc and execute the following 

/root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0

5. Will have logs:

Internet Systems Consortium DHCP Server 4.3.4
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: dhcpd.conf
Database file: /var/db/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 1 leases to leases file.
Listening on LPF/eth0/8c:89:a5:ba:66:0a/192.168.6.0/24
Sending on   LPF/eth0/8c:89:a5:ba:66:0a/192.168.6.0/24
Sending on   Socket/fallback/fallback-net

My ubuntu with this DHCP is connected to a homeware device, I checked the device's console and can see it works, it get both of IPv4 address and IPv6.

On Thu, May 26, 2016 at 9:00 PM, Graham Clinch <[hidden email]> wrote:
Hi Reed,

There seems to be some copy-paste confusion here with the various file names and command lines.

For IPv4
> root@johw-Lenovo:/etc#/root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0 start
[...]
> Config file: dhcpd.conf
[...]
> *file content of dhcpd.conf*


but for IPv6:
> root@johw-Lenovo:/etc#/root/dhcp-4.3.4/server/dhcpd -6 -cf dhcp6.conf eth0 start
[...]
> Config file: /etc/dhcpd.conf
[...]
> *file content of dhcpd6.conf*

So for IPv4, your command line is to read from 'dhcpd.conf', and dhcpd outputs that it's reading from that path, and then you report the content of (presumably) that file.

But for IPv6, you command line is to read from 'dhcp6.conf', dhcpd outputs that it's reading from /etc/dhcpd.conf (a different path - the default one compiled into the dhcpd binary?), and you report the content of a file named 'dhcpd6.conf' (note additional d).

I suggest you start by rechecking all the file names and command lines, since dhcpd is definitely not opening a file with a '6' in the name.

Graham
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users



--
Thanks,
- Reed

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Bjørn Mork
Reed Xia <[hidden email]> writes:

> /root/dhcp-4.3.4/srver/dhcpd* -6* -cf dhcpd.conf eth0
> /root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0

See the difference?  Eliminate all the unnecessary ones.

(I don't think it is advisable to use random file names as command line
options....)



Bjørn
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

glenn.satchell
On Fri, May 27, 2016 5:51 pm, Bjørn Mork wrote:
> Reed Xia <[hidden email]> writes:
>
>> /root/dhcp-4.3.4/srver/dhcpd* -6* -cf dhcpd.conf eth0
>> /root/dhcp-4.3.4/server/dhcpd -cf dhcpd.conf eth0
>
> See the difference?  Eliminate all the unnecessary ones.
>
> (I don't think it is advisable to use random file names as command line
> options....)

Hi Reed

I think it would be better to create two separate config files, one for
ipv4 and one for ipv6, eg:

/root/dhcp-4.3.4/server/dhcpd -6 -cf /etc/dhcpd6.conf eth0

/root/dhcp-4.3.4/server/dhcpd -cf /etc/dhcpd.conf eth0

regards,
-glenn

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem to set up DHCP for ipv6 - subnet_number():inet.c:45: Addr/mask length mismatch

Graham Clinch
In reply to this post by Reed Xia
Hi Reed,

> /root/dhcp-4.3.4/srver/dhcpd -6 -cf dhcpd.conf eth0
>
> And will have logs:
>
>     Internet Systems Consortium DHCP Server 4.3.4
>     Copyright 2004-2016 Internet Systems Consortium.
>     All rights reserved.
>     For info, please visit https://www.isc.org/software/dhcp/
>     Config file: /etc/dhcpd.conf
>     Database file: /var/db/dhcpd6.leases
>     PID file: /var/run/dhcpd6.pid
>     Wrote 0 NA, 0 TA, 0 PD leases to lease file.
>     Bound to *:547
>     Listening on Socket/5/eth0/2001::/64
>     Sending on   Socket/5/eth0/2001::/64
>     No subnet6 declaration for dhcp.conf (no IPv6 addresses).
>     ** Ignoring requests on dhcp.conf.  If this is not what
>        you want, please write a subnet6 declaration
>        in your dhcpd.conf file for the network segment
>        to which interface dhcp.conf is attached. **
>
>     No subnet6 declaration for –cf (no IPv6 addresses).
>     ** Ignoring requests on –cf.  If this is not what
>        you want, please write a subnet6 declaration
>        in your dhcpd.conf file for the network segment
>        to which interface –cf is attached. **

This is very strange because dhcpd isn't parsing the '-cf' argument.  My
best guess is that you've copied the command line from a fancy text
editor and ended up with a subtly different dash character (an en-dash?)
rather than the standard hyphen.

This might be a red herring, but when I copy the characters from the
above log message into 'od -t xC' (which outputs the hex bytes that make
up that character), I get:

for the '-' in '2004-2016': 0x2d
for the '–' in 'declaration for –cf': 0xe2  0x80  0x93

0x2d is the 'old school' ASCII 'HYPHEN-MINUS',
0xe28093 is the Unicode 'EN DASH'.

It'd really help if you could copy and paste the exact command line
you're running - the lack of an e in 'srver' is making me believe you're
retyping them, but that makes it much harder for us to spot these sorts
of character substitution errors.

Perhaps you could try copying and pasting these, which are what's
running in production here...

dhcpd -user dhcpd -group dhcpd -f -4 -cf /etc/dhcp/dhcpd.conf

dhcpd -user dhcpd -group dhcpd -f -6 -cf /etc/dhcp/dhcpd6.conf

Graham
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users