0

I have the following configuration in my dnsmasq.conf:

dhcp-range=172.16.0.100,172.16.0.254,255.255.255.0,12h

From range 172.16.0.1-99 we assign static IP address to important servers and from 172.16.0.100-254 we assign dynamic addresses.

We started using OpenVPN some time ago and the server hosting the service created a lot of virtual interfaces, sometimes using all of the IP addresses the DHCP has, causing a mess in the network.

I wanted to change the network mask to 255.255.0.0, to increase the number of IP addresses and leave the static IP range untouched.

How can I achieve this using this dhcp-range attribute dnsmasq offers?

Ev.
  • 128
  • 3
  • 10
  • I'm not really familiar with dnsmasq, but couldn't you just make the network address 172.16.0.0 /16 and then just extend the dhcp range? Like this: dhcp-range=172.16.0.100, 172.16.255.254, 255.255.0.0, 12h(I'm assuming the 12h is the lease time and not something important) – McITGuy Jun 18 '18 at 14:23
  • Hmmm. I tried changing the network mask but forgot to change the range. Was wondering why it didn't work. Anyways, I thought it was possible to use multiple `dhcp-range` variants to setup the DHCP. I was hoping someone to help me with that. If that doesn't work I'll use your suggestion. – Ev. Jun 18 '18 at 14:58
  • Were you wanting to setup multiple discontiguous DHCP ranges using that syntax? for instance: (dhcp-range=172.16.0.100, 172.16.0.254, 255.255.255.0, 12h) and then (dhcp-range=172.16.1.100, 172.16.1.254, 255.255.255.0, 12h)? I don't see why you wouldn't be able to set as many dhcp ranges at whatever range you want. Unless the program itself stops you from doing this. But I've never had any problems setting up discontiguous DHCP pools on servers before myself. – McITGuy Jun 18 '18 at 16:05
  • Exactly. I'll try to do that. For now I have made the changes and we will wait to put into production next monday. You can answer the thread and if things go well after the test, I'll mark it as the answer to my problem. – Ev. Jun 19 '18 at 12:17
  • Alright, I'll just copy/paste my comments as answers then. – McITGuy Jun 19 '18 at 14:11

1 Answers1

2

I'm not really familiar with dnsmasq, but couldn't you just make the network address 172.16.0.0 /16 and then just extend the dhcp range? Like this: dhcp-range=172.16.0.100, 172.16.255.254, 255.255.0.0, 12h(I'm assuming the 12h is the lease time and not something important)

Were you wanting to setup multiple discontiguous DHCP ranges using that syntax? for instance: (dhcp-range=172.16.0.100, 172.16.0.254, 255.255.255.0, 12h) and then (dhcp-range=172.16.1.100, 172.16.1.254, 255.255.255.0, 12h)? I don't see why you wouldn't be able to set as many dhcp ranges at whatever range you want. Unless the program itself stops you from doing this. But I've never had any problems setting up discontiguous DHCP pools on servers before myself.

(comments converted to answer)

McITGuy
  • 218
  • 1
  • 4
  • 18
  • Some machines are already getting the new IP, however they don't have access to the internet. Any ideas? The default gateway is 172.16.0.254, however it has the old network mask 255.255.255.0. Can this be the reason why? – Ev. Jun 19 '18 at 15:58
  • 1
    if the machines are on a different subnet than the default gateway they won't be able to see it. This means hosts with an ip address on the 172.16.1.x /24 subnet won't be able to connect to the default gateway of 172.16.0.254 /24. To get around this you can use CIDR to "supernet" the network (ie, use my first suggestion of making one big subnet with a mask of 255.255.0.0) or you can use inter-vlan routing by putting each subnet in it's own VLAN and then setting up sub-interfaces on the router to facilitate communication between the VLANs – McITGuy Jun 19 '18 at 16:06
  • If I change the mask in the gateway, does this mean all machines using the old mask will lose connectivity? – Ev. Jun 19 '18 at 17:04
  • If they are on different subnets after the change then yes, they will lose connectivity. Either that or you will have other network issues caused by overlapping subnets on the same LAN. I would recommend changing your DHCP pools subnets with the Gateway. – McITGuy Jun 19 '18 at 17:25
  • Also, what kind of Router are you using? And I'm assuming the server running dnsmasq is also the dhcp server right? – McITGuy Jun 19 '18 at 17:26
  • Yes it was also the DHCP. I managed to make it work. I just had to change the netmask of the servers running static IP and give it some time for the ones on DHCP to update the netmask. It worked. Thanks. – Ev. Jun 25 '18 at 11:12