Monday, March 16, 2020

Trace a Host to its Interface with Automation!

Trace a Host to its Interface with Automation!

Host Trace lets you figure out where a host's interface is located based off its MAC or IP Address.

 

All you need to do is provide two parameters.

  1. The IP Address or MAC Address to trace.
  2. The starting switch/router from where the trace will begin. Generally, this should be the L3 where the network lives.

 

Note that this version of the script is rather reliant on CDP, so if your environment does not support CDP, you may want to modify this to work with LLDP.

 

Source Code

https://github.com/syedur-rahman/networkcoder/tree/master/projects/host_trace

 

Demonstration

https://i.imgur.com/VxOtaFh.gif

 

Conclusion

The usage and setup of the script is detailed in the repository but feel free to ask me any questions if you encounter issues.

 

Also, if you are interested in the parsing logic of this script, feel free to check this out too:

 

https://github.com/syedur-rahman/networkcoder/tree/master/projects/mac_arp_parse

 

The Host Trace script is an extension of the above project.

 

Good luck and happy automating!

 

Disclaimer: Please note that the code is meant to be educational in nature and should be modified and tested if you plan to use it in your environment.



No comments:

Post a Comment