Get relay's address from within script

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Get relay's address from within script

Tiago SR
Dears,

In ISP I work on there is a central ISC DHCP server, which is relayed (DHCP relay) in each PoP.
I would like to get DHCP relay address from within my "on commit", "on release" and "on expiry" scripts.

I've been searching and looking at "man dhcp-eval", but found no way to get it.
DHCP relays are MikroTik routers and only change they can do to DHCP requests is to add option 82 values,
but I can't use it to add relay's address, as option 82 is already used for authentication purposes.

If there is no direct way to get relay's address, I was thinking in some way to get source address of DHCP
request, as I presume they would be the same.

I would appreciate it if you could help me.
Thanks.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Get relay's address from within script

Simon Hobson
Tiago SR <[hidden email]> wrote:

> ... and only change they can do to DHCP requests is to add option 82 values

They should be setting GI-Addr as well ! I have no idea if GI-ddr ends up in a variable/parameter accessible from the scripts - but it is in a fixed place in the packets so it should be possible to extract it with the right incantation.

Alternatively, and this isn't really something you'd want to do in real time, if Option82 is being used for authentication, can you do a lookup from that to see which gateway that user connects through ? Or is that the information you are trying to get ?

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Get relay's address from within script

Tiago SR

After some searches, looks like MikroTik routers actually set GI-Addr and this can be extracted
by packet(24,4) or even better binary-to-ascii(10, 8, ".", packet(24,4)).

Thanks very much. I didn't even know about the existence of GI-Addr. :D

 ---- On Wed, 27 Jul 2016 03:46:47 -0300 Simon Hobson <[hidden email]> wrote ----
 > Tiago SR <[hidden email]> wrote:
 >  
 > > ... and only change they can do to DHCP requests is to add option 82 values
 >  
 > They should be setting GI-Addr as well ! I have no idea if GI-ddr ends up in a variable/parameter accessible from the scripts - but it is in a fixed place in the packets so it should be possible to extract it with the right incantation.
 >  
 > Alternatively, and this isn't really something you'd want to do in real time, if Option82 is being used for authentication, can you do a lookup from that to see which gateway that user connects through ? Or is that the information you are trying to get ?
 >  
 > _______________________________________________
 > dhcp-users mailing list
 > [hidden email]
 > https://lists.isc.org/mailman/listinfo/dhcp-users 
 >

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Get relay's address from within script

Simon Hobson
Tiago SR <[hidden email]> wrote:

> After some searches, looks like MikroTik routers actually set GI-Addr

If they didn't they wouldn't work as relay agents !

> and this can be extracted by packet(24,4) or even better binary-to-ascii(10, 8, ".", packet(24,4)).


Yes, that sounds about right.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users