check_dhcp and IP aliasing

I have my nagios checking several DHCP servers and each of them serving different networks so I need to force check_dhcp to send a different giaddr to each server.

The easiest way to do that is to create several interfaces (eth0:1, eth0:2, etc) with different IP’s and them ask check_dhcp to bind to the interfaces using the option -i interface]

The problem is that it doesn’t seem like check_dhcp likes IP aliasing at all. It works fine if the interface is eth0 but it gives me an error if I try any of the aliased interfaces.

[root]# ./libexec/check_dhcp -v -u -s 64.89.230.195 -i eth0:1
Requested server address: 64.89.230.195
DHCP socket: 3
Error: Could not bind socket to interface eth0:1. Check your privileges…

For that matter, it’s the same error as if I use a bogus string:

[root]# ./libexec/check_dhcp -v -u -s 64.89.230.195 -i foobar
Requested server address: 64.89.230.195
DHCP socket: 3
Error: Could not bind socket to interface foobar. Check your privileges…

[root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:24:CD:59
inet addr:192.168.0.221 Bcast:192.168.0.223 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:95045 errors:0 dropped:0 overruns:0 frame:0
TX packets:75661 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23443043 (22.3 MiB) TX bytes:15651222 (14.9 MiB)
Interrupt:177 Base address:0x1400

eth0:1 Link encap:Ethernet HWaddr 00:0C:29:24:CD:59
inet addr:10.0.4.254 Bcast:10.0.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:177 Base address:0x1400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:45114 errors:0 dropped:0 overruns:0 frame:0
TX packets:45114 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8798317 (8.3 MiB) TX bytes:8798317 (8.3 MiB)

Any suggestions?

Thanks,
Beltran

Yeah, it seems not to like aliases/virtual interfaces.
Only real interfaces…
Try to search for a different plugin of a same sort on nagios exchange, or write your own script…