Static IP via Option 82 - methodology

Denis Laventure Denis_Laventure at uqac.ca
Thu Jan 9 18:59:36 UTC 2014


Hi,

We have used this for several years now and I was not able to use an ASCII stings for agent.circuit-id. I always use the option-82 HEX value in my DHCP server configuration like this :

host 10-24-24-9 {
 host-identifier option agent.circuit-id 1:12:31:2e:32:31:2e:31:2e:34:2f:45:74:68:65:72:6e:65:74:39;
fixed-address 10.24.24.9;
}

I also added this line to the interface on our cisco switches :

ip dhcp snooping vlan 24 information option format-type circuit-id string 1.21.1.4/Ethernet9

The option-82 HEX value for 1.21.1.4/Ethernet9 = 1:12:31:2e:32:31:2e:31:2e:34:2f:45:74:68:65:72:6e:65:74:39.

I created this small perl script to convert between the two values :

#!/usr/bin/perl

$STR = $ARGV[0];

if (!$STR) {
  print "CID ASCII <-> HEX\n";
  print "Ex: cid 1.21.1.4/Ethernet9\n";
  print "    cid 1:12:31:2e:32:31:2e:31:2e:34:2f:45:74:68:65:72:6e:65:74:39\n\n";
  exit;
}

if (substr($STR,0,2) eq "1:") {
  @x = split ':', $STR;
  $a = 1;
  foreach(@x) {
    if ($a <= 2) { $a++; }
    else { print chr(hex($_)); }
  }
}
else {
  @x = split //, $STR;
  print "1:";
  printf("%x", length($STR));
  foreach(@x) {
    printf(":%x", ord($_));
  }
}

print "\n";

Perhaps this can help you.
Denis


De : dhcp-users-bounces+denis_laventure=uqac.ca at lists.isc.org [mailto:dhcp-users-bounces+denis_laventure=uqac.ca at lists.isc.org] De la part de perl-list
Envoyé : 9 janvier 2014 13:34
À : Users of ISC DHCP
Objet : Re: Static IP via Option 82 - methodology

Thank you - i'll try that out!  it does past syntax check - now to see if it works in the real world.

________________________________
From: "Dave Brenner" <david at toledotel.com<mailto:david at toledotel.com>>
To: dhcp-users at lists.isc.org<mailto:dhcp-users at lists.isc.org>
Sent: Thursday, January 9, 2014 11:39:05 AM
Subject: Re: Static IP via Option 82 - methodology

On 1/9/2014 6:42 AM, perl-list wrote:
> Is this the way to do it?
>
> ------------------------
>
> host 10-24-24-9 { option agent.circuit-id = "1.21.1.4/Ethernet9";
> fixed-address 10.24.24.9; } # static by option 82 (with host line)?
>
> ------------------------

Close.

host 10-24-24-9 {
    host-identifier option agent.circuit-id "1.21.1.4/Ethernet9";
    fixed-address 10.24.24.9;
}


_______________________________________________
dhcp-users mailing list
dhcp-users at lists.isc.org<mailto:dhcp-users at lists.isc.org>
https://lists.isc.org/mailman/listinfo/dhcp-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20140109/ce328a2f/attachment-0001.html>


More information about the dhcp-users mailing list