Hallo,
I try to replace our linux-based Servers with Mikrotik-Routers in an Docsis-Cable Environment. The provisioning with DHCP/TFTP/TOD is not really a problem and works great.
But we use intensively DHCP-Remote-ID (Option-82), to pass the Bundle “CPE-IP and correspondend Cablemodem-MAC” to an external authentication system. The Cisco CMTS works as a DHCP-Relay and passes this information via Option-82 to the Mikrotik-Router, which act as a dhcp-server. My goal is to write a script which parse the entries in “/ip dhcp-server lease print detail” and submit the information in “address and agent-remote-id” via syslog to this authentication system. Here you can see the problem:
/ip dhcp-server lease print detail
address=x.x.x.30 mac-address=00:23:8B:34:66:20 server=cpe-dhcp status=bound expires-after=8m57s last-seen=1m3s active-address=x.x.x.30 active-mac-address=00:23:8B:34:66:20 active-server=cpe-dhcp host-name=“emsinb” src-mac-address=00:15:C6:4F:54:00 agent-circuit-id=“\00\01\00\03” agent-remote-id=“\00\15/\95\B”
As you can see is the agent-remote-id field binary and not the mac-address of the cable-modem. This means I cannot take this information in this format for scripting.
If I debug the DHCP-Communication I can see this:
21:20:30 dhcp,debug,packet dhcp-cmts: cpe-dhcp sending ack with id 2961227336 to x.x.x.1
21:20:30 dhcp,debug,packet dhcp-cmts: ciaddr = 0.0.0.0
21:20:30 dhcp,debug,packet dhcp-cmts: yiaddr = x.x.x.30
21:20:30 dhcp,debug,packet dhcp-cmts: siaddr = x.x.x.x
21:20:30 dhcp,debug,packet dhcp-cmts: giaddr = x.x.x.x
21:20:30 dhcp,debug,packet dhcp-cmts: chaddr = 00:23:8B:34:66:20
21:20:30 dhcp,debug,packet dhcp-cmts: Msg-Type = ack
21:20:30 dhcp,debug,packet dhcp-cmts: Server-Id = x.x.x.x
21:20:30 dhcp,debug,packet dhcp-cmts: Address-Time = 600
21:20:30 dhcp,debug,packet dhcp-cmts: Subnet-Mask = 255.255.255.0
21:20:30 dhcp,debug,packet dhcp-cmts: Router = x.x.x.x
21:20:30 dhcp,debug,packet dhcp-cmts: Domain-Server = x.x.x.x
21:20:30 dhcp,debug,packet dhcp-cmts: Relay-Agent-Info = 01-04-00-01-00-03-02-06-00-15-2F-95-5C-42
Here you can see the Relay-Agent-Info. This contains the correct Cablemodem-MAC (last six hex values = 00:15:2F:95:5C:42).
It would be great If i could access this Information in “/ip dhcp-server lease print detail” either as a new raw field “Relay-Agent-Info” or correctly separated in circuit-id and remote-id. There it would be easy accessible by the scripting engine.
Other solution would be to parse the debug log via scripting and send the correspondend bundle “yiaddr and Relay-Agent-Info” via syslog to our external authentication system. How could this be done? We handle several hundreds simultaneous leases on each Mikrotik. If I run the DHCP on debug this would create large Log-Files on Mikrotik, probably the entries get mixed together? I would pay for a proper script handle this problem.
thanks
Oliver