Blocking third-party DHCP on Cisco via DHCP Snooping

On the test, I configure DHCP Snooping on the Cisco Catalyst 6509-E to block third-party DHCP servers, on the other Cisco switches, the configuration is basically the same.

After connecting to the device immediately go to the configuration mode:

enable
configure

Continue reading “Blocking third-party DHCP on Cisco via DHCP Snooping”

Configuring FreeRADIUS DHCP for ABillS

Suppose you installed FreeRADIUS 2 as written in this article – Installation and configuration of the ABillS billing system
Now copy the dhcp.conf file into the FreeRADIUS configuration:

sudo cp /usr/abills/misc/freeradius/v2/dhcp.conf /usr/local/freeradius/etc/raddb/sites-enabled/

Continue reading “Configuring FreeRADIUS DHCP for ABillS”

How to fix error “dhcpd self-test failed. Please fix the config file”

I noticed once in the syslog:

dhcpd self-test failed. Please fix the config file

Isc-dhcp-server was installed on the server.

To check the correctness of the configuration file, use the command:

dhcpd -t
dhcpd -t -cf /dir/dhcpd.conf
/usr/sbin/dhcpd -t

The command should tell which line the error is, but noted that if it is not critical, it may not.
The key “t” executes the configuration test, and “cf” allows you to specify the path to the configuration file if it is not standard.

In my case, in the configuration file /etc/dhcp/dhcpd.conf, someone made a typo, in the line below (there was an extra letter):

authorivtative;

Because of this, an error occurred, but despite the error dhcp worked.
Although there were also some critical errors, such as an incorrectly written mac address, DHCP did not start because of this error.

Installing and using dhcping

dhcping – a utility for checking DHCP-servers using unicast packages.

In Ubuntu, you can install dhcping with the command:

sudo apt-get install dhcping

First let’s see what IP-addresses are received and from which gateway:

ifconfig
route
netstat -rn | grep default

Also you can see the information received from DHCP in the directory /var/lib/dhcp/.

In my case, IP is received from the DHCP server 10.0.2.2.
Here’s an example of running dhcping:

dhcping -s 10.0.2.2

If the DHCP server responds, the following information will be displayed:

Got answer from: 10.0.2.2

If there is no answer:

no answer

I’ll describe the dhcping startup keys:
-v (detailed mode)
-V (very detailed mode)
-i (use DHCPINFORM packets)
-r (use DHCPREQUEST packets (standard))
-q (quiet mode)
-t maxwait (response timeout, standard 3 seconds)
-c IP (request the specified IP)
-s IP (send request to specified IP)
-h MAC (use the specified MAC address in the request)
-g IP (use the specified IP gateway in the packet)

Configuring DHCP relay on Cisco

On the test, I’ll take the Cisco Catalyst 6509-E switch and configure it to forward DHCP packets to the DHCP server.
The switch is configured as L3 with assigned IP addresses in each VLAN.

Connect to the switch through the console or telnet and go to the configuration mode:

enable
configure t

Let’s assume the DHCP server address is 192.168.11.1 and we want to configure the transfer of DHCP broadcast packets to it on VLAN 100, for this we execute the commands:

interface Vlan100
ip helper-address 192.168.11.1
exit

Exit the configuration mode and save the configuration:

exit
write

Done.