Configure DHCP remote service with dnsmasq
Abiquo offers a DHCP remote service using dnsmasq, which overcomes some limitations of DHCP in a cloud environment.
Requirements
The DHCP remote service that uses dnsmasq runs version 2.76.
- The remote service requires:
- A Tomcat server that is compatible with Abiquo Remote Services
- To configure this service independently of the other remote services, you can start a separate Tomcat using another port on a Remote Services Server or on a separate server
- A service network interface that VMs can reach to obtain their IPs
- A Tomcat server that is compatible with Abiquo Remote Services
DHCP with dnsmasq requires an IP address in each network. By default, this is the last address in the network range. The platform will exclude this IP from the valid address range to assign to VMs for the network
To add existing networks in an existing datacenter, you will require an IP file as described in the procedure below
Install Dnsmasq remote service
Download the current version of the Abiquo Dnsmasq package and install it.
For example, to install a package with yum:yum install http://10.60.20.42/5.x/pkgs/el7/abiquo-dnsmasq-5.0.1-6018.el7.noarch.rpm
The Dnsmasq remote service package will install Ruby and ruby-devel and gems as required.
Configure Dnsmasq Remote Service in the datacenter
On the Remote Services server
Edit the abiquo.properties file and set the service interface, and if required, set the base directory (for the leases and other configuration) and the path to the scripts
abiquo.dnsmasq.serviceiface = eth1 abiquo.dnsmasq.basedir = /opt/abiquo/dhcp abiquo.dnsmasq.startscript = /opt/abiquo/scripts/dnsmasq-vlan-start.rb abiquo.dnsmasq.stopscript = /opt/abiquo/scripts/dnsmasq-vlan-stop.rb abiquo.dnsmasq.reloadscript = /opt/abiquo/scripts/dnsmasq-vlan-reload.rb
Restart the DHCP remote service that uses dnsmasq or the Tomcat server
In Abiquo, add the DHCP remote service that uses the dnsmasq with its IP address and with the port
The default port is 8009
When you create a new datacenter, select the new DHCP remote service. To use it with an existing datacenter, follow the instructions to configure Dnsmasq with existing datacenter networks.
Configure Dnsmasq with existing datacenter networks
If you have an existing datacenter with networks, use the restore scripts to register the IP addresses in dnsmasq and create leases for them at the datacenter or network level
To add the current network setup of the datacenter to dnsmasq
Create an IP file to map the CIDRs to DHCP network addresses to input to the restore process. The following example of the file format shows default private networks, an external network, and a public network.
192.168.0.0/24=192.168.0.254 192.168.111.0/24=192.168.111.254 30.30.30.0/24=30.30.30.254
Obtain the API ID of your datacenter (e.g. 14)
Run the datacenter restore command using the IP address and credentials of your MySQL server and your Dnsmasq Remote Services server
java -jar dnsmasq-restore-5.10.jar restore -db "jdbc:mysql://10.60.11.2/kinton?user=root&password=" -s "http://10.60.11.2:8009/dnsmasq" -dc 14 -ipfile myipfile
To add a given network to dnsmasq
- Obtain the API ID of your network (e.g. 10)
Run the network restore command using the IP address and credentials of your MySQL server and your Dnsmasq Remote Services server
java -jar dnsmasq-restore-5.1.0.jar restore -db "jdbc:mysql://10.60.11.2/kinton?user=root&password=" -s "http://10.60.11.2:8009/dnsmasq" -ip "192.168.0.254" -vlan 10
Related links
- Introduction to dnsmasq: https://en.wikipedia.org/wiki/Dnsmasq
- Troubleshooting DHCP with dnsmasq
Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved