09-30-2024 05:59 AM - edited 09-30-2024 06:04 AM
Hej
Can anyone help me with sending any DHCP Request / Offer message my device receives/Sends to a syslog server? I could not find the option for dhcp on syslog. I would be ok with doing it with telemetry as well
ASR9903 IoSXR 24.2.1
Regards
Solved! Go to Solution.
09-30-2024 10:57 AM
Hello,
To send DHCP Request/Offer messages to a syslog server on your ASR9903 running IOS XR 24.2.1, you can follow these approaches:
1. Syslog with Embedded Event Manager (EEM):
Since DHCP events might not be directly logged by default in IOS XR, you can use the Embedded Event Manager (EEM) to trigger syslog messages when DHCP-related activities occur.
Here’s an outline of how to achieve this using EEM:
Step 1: Define an EEM Applet to monitor the DHCP process. You can monitor the DHCP process using EEM and then log the output to the syslog server.
event manager applet DHCP_Log_Syslog
event syslog pattern "DHCP" ! Adjust this pattern for DHCP messages
action 1.0 syslog msg "DHCP Event Detected"
Step 2: Configure the Syslog server on your router. Make sure to configure the router to send logs to the syslog server.
logging host <syslog-server-ip>
logging trap informational
You’ll need to adjust the syslog patterns to specifically target the DHCP messages.
2. Using Telemetry:
If you'd prefer to use telemetry, you can set up model-driven telemetry (MDT) to capture and stream the DHCP-related data to a server.
Step 1: Create a Telemetry Subscription
You can set up a subscription to capture DHCP information. IOS XR has YANG models for DHCP, which you can use to capture events like DHCP discovery, offer, request, etc.
telemetry model-driven
sensor-group dhcp-sensor
sensor-path DHCP.YANG_PATH ! Replace with correct DHCP YANG path
!
subscription dhcp-subscription
sensor-group-id dhcp-sensor sample-interval 30000
destination-group dhcp-telemetry-destination
!
destination-group dhcp-telemetry-destination
address-family ipv4 10.1.1.2 port 50051 ! Your telemetry server IP and port
encoding gpb
protocol grpc
!
commit
You'll need to find the appropriate YANG model path for DHCP within IOS XR.
Step 2: Configure the Telemetry Server
On your telemetry server, ensure it is set up to receive and process the gRPC telemetry data being streamed from the ASR device.
3. Enable DHCP Snooping (Optional):
If you want more granular monitoring of DHCP traffic, enabling DHCP snooping on the router could provide additional logs related to DHCP packets, which can then be forwarded to syslog or processed via telemetry.
interface GigabitEthernet0/0/0
ip dhcp snooping trust
!
ip dhcp snooping
These options should help you track DHCP messages on your syslog or telemetry setup.
09-30-2024 06:00 AM
Just to confirm it ASR IOS Xr or IOS Xe
MHM
09-30-2024 06:05 AM
ASR9903 IoSXR 24.2.1
I have updated the opening post as well, thanks for pointing it out
09-30-2024 06:17 AM
Hello @oscardenizjensen
Do you identify the YANG model that includes the DHCP-related information you want to monitor ?
09-30-2024 06:23 AM
No I have not, but I would appreciate help or direction regarding how to
09-30-2024 10:57 AM
Hello,
To send DHCP Request/Offer messages to a syslog server on your ASR9903 running IOS XR 24.2.1, you can follow these approaches:
1. Syslog with Embedded Event Manager (EEM):
Since DHCP events might not be directly logged by default in IOS XR, you can use the Embedded Event Manager (EEM) to trigger syslog messages when DHCP-related activities occur.
Here’s an outline of how to achieve this using EEM:
Step 1: Define an EEM Applet to monitor the DHCP process. You can monitor the DHCP process using EEM and then log the output to the syslog server.
event manager applet DHCP_Log_Syslog
event syslog pattern "DHCP" ! Adjust this pattern for DHCP messages
action 1.0 syslog msg "DHCP Event Detected"
Step 2: Configure the Syslog server on your router. Make sure to configure the router to send logs to the syslog server.
logging host <syslog-server-ip>
logging trap informational
You’ll need to adjust the syslog patterns to specifically target the DHCP messages.
2. Using Telemetry:
If you'd prefer to use telemetry, you can set up model-driven telemetry (MDT) to capture and stream the DHCP-related data to a server.
Step 1: Create a Telemetry Subscription
You can set up a subscription to capture DHCP information. IOS XR has YANG models for DHCP, which you can use to capture events like DHCP discovery, offer, request, etc.
telemetry model-driven
sensor-group dhcp-sensor
sensor-path DHCP.YANG_PATH ! Replace with correct DHCP YANG path
!
subscription dhcp-subscription
sensor-group-id dhcp-sensor sample-interval 30000
destination-group dhcp-telemetry-destination
!
destination-group dhcp-telemetry-destination
address-family ipv4 10.1.1.2 port 50051 ! Your telemetry server IP and port
encoding gpb
protocol grpc
!
commit
You'll need to find the appropriate YANG model path for DHCP within IOS XR.
Step 2: Configure the Telemetry Server
On your telemetry server, ensure it is set up to receive and process the gRPC telemetry data being streamed from the ASR device.
3. Enable DHCP Snooping (Optional):
If you want more granular monitoring of DHCP traffic, enabling DHCP snooping on the router could provide additional logs related to DHCP packets, which can then be forwarded to syslog or processed via telemetry.
interface GigabitEthernet0/0/0
ip dhcp snooping trust
!
ip dhcp snooping
These options should help you track DHCP messages on your syslog or telemetry setup.
10-01-2024 01:57 AM
Thank you very much I will try this one out
10-01-2024 04:30 AM
Thanks, We have tested the telemetry and seem to be able to get information. Just need to fine tune it now
10-01-2024 06:15 AM
You're welcome!
Happy it worked for you.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide