Non-standard netmask in dhcp server not shown by print

Hi.

Just thought I could share the experience of a network debugging session I’ve just gone through, in case somebody has a similar problem in future. The example concerns RouterBoard 433AH, RouterOS 4.10.

As part of the configuration of a DHCP server, I had defined a network:

/ip dhcp-server network
add address=192.168.0.0/16 dns-server=192.168.0.250 gateway=192.168.0.254 netmask=16

which was shown as:

[root@router] /ip dhcp-server network> print
# ADDRESS    GATEWAY         DNS-SERVER  WINS-SERVER DOMAIN                                                                                                    
0 192.168.0.0/16 192.168.0.254   192.168.0.250

Several months later I decided to divide the network into subnets of netmask 24. So it looked like the only things that had to be changed were “address” and “gateway”:

/ip dhcp-server network
set 0 address=192.168.1.0/24 gateway=192.168.1.254

Unfortunately, this doesn’t change the “netmask” option, which is easy to overlook, because it’s not shown by the “print” command. Remember about this, or always use “print detail” instead:

[root@router] /ip dhcp-server network> print detail 
0 address=192.168.1.0/24 gateway=192.168.1.254 dns-server=192.168.0.250 netmask=16

There’s no need to set the netmask length if you’re going to use the same length as defined on the server network instance. At that point just changing the address is sufficient.

netmask (integer: 0..32; Default: 0) The actual network mask to be used by DHCP client. If set to ‘0’ - netmask from network address will be used.

http://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server#Networks