Relay agent with dhcp server on same subnet

Glenn Satchell glenn.satchell at uniq.com.au
Wed Nov 18 13:36:45 UTC 2009


> Hi,
> I have a simple network with one dhcp server (isc dhcp), one managged
> switch and two clients.
>
>                       ___________
>                      |          4|------- Client 1 to sw port 4
> DHCPD  Server--------| Switch   6|------- Client 2 to sw port 6
> (192.168.1.30)       |___________|
>                     (192.168.1.101)
>
> I want to assign ip address according to switch ports whitch clients are
> connected.
> So I set Relay Agent on switch to relaying to DHCPD  Server (192.168.1.30)
> with Option-82.
> Then I configure DHCPD  Server like follow:
>
> class "port4" {
>     match (binary-to-ascii(16, 8, ":",option agent.circuit-id)); }
>
> subclass "port4" "b8:6:0:0:1:1:1:4";
>
> class "port6" {
>     match (binary-to-ascii(16, 8, ":",option agent.circuit-id)); }
>
> subclass "port6" "b8:6:0:0:1:1:1:6";
>
> subnet 192.168.1.0 netmask 255.255.255.0 {
>     pool {
> 	allow members of "port4";
> 	range 192.168.1.4 192.168.1.4;
>     }
>     pool {
> 	allow members of "port6";
> 	range 192.168.1.6 192.168.1.6;
>     }
> }
>
> Now I test this with only one client connected to the right port and I
> obtain this traffic:
>
> No.     Time        Source                Destination           Protocol
> Info
>       1 0.000000    0.0.0.0               255.255.255.255       DHCP
> DHCP Discover - Transaction ID 0xeaa79f3f
>       2 0.005068    192.168.1.101         192.168.1.30          DHCP
> DHCP Discover - Transaction ID 0xeaa79f3f
>       3 0.005072    192.168.1.30          192.168.1.101         DHCP
> DHCP Offer    - Transaction ID 0xeaa79f3f
>       4 0.010307    192.168.1.101         192.168.1.4           DHCP
> DHCP Offer    - Transaction ID 0xeaa79f3f
>       5 0.010796    0.0.0.0               255.255.255.255       DHCP
> DHCP Request  - Transaction ID 0xeaa79f3f
>       6 0.010819    192.168.1.30          255.255.255.255       DHCP
> DHCP NAK      - Transaction ID 0xeaa79f3f
>       7 0.015958    192.168.1.101         192.168.1.30          DHCP
> DHCP Request  - Transaction ID 0xeaa79f3f
>       8 0.031054    192.168.1.30          192.168.1.101         DHCP
> DHCP ACK      - Transaction ID 0xeaa79f3f
>       9 0.035778    192.168.1.101         192.168.1.4           DHCP
> DHCP ACK      - Transaction ID 0xeaa79f3f
>
> as can you see there is a NAK (packet n°6) so the transaction fails.
> Can I configure DHCP Server to not send this NAK?

I think the NAK is ok. Packet 8 is dhcp sending ACK to relay agent, and
packet 9 is switch sending ACK to client. That looks like success to me,
unless the client then reuses the ACK?

You need to add one level of verboseness to the packet capture command to
decode the dhcp protocol inside the packets. The client may be requesting
an old IP address it had previously?

Also, a minor point, but you can do binary string comparisons. Just leave
out the quotes around the colon separated hex digits, see the dhcp-eval
man page, eg:

class "port4" {
    match option agent.circuit-id; }

subclass "port4" b8:6:0:0:1:1:1:4;

Or
class "port4" {
    match if option agent.circuit-id = b8:6:0:0:1:1:1:4; }

regards,
-glenn

> Thanks
> Gianluigi Autuori
>






More information about the dhcp-users mailing list