Skip to main content

The method of using the Forward Networks search bar to list all devices where a subnet is learned or advertised is very useful. This NQE lists the route, egress interface, interface description and a bit more. Displaying the next hop MAC address and associated OUI vendor is useful in determining whether the next hop is a router or firewall. 
 

/**
* @intent List IP Prefixes / Route Table entries for all Routers
* @description List the Route Table and egress interfaces detailes. Useful to determine where a particular route is, and what routes egress a device or interface.
*/
getNextHopDesc(deviceName, interfaceName) =
foreach interface in deviceName.interfaces
where interface.name == interfaceName
select interface.description;

getNextHopMac(deviceName, interfaceName, ipNextHop) =
foreach interface in deviceName.interfaces
foreach subinterface in interface.subinterfaces
let ipv4 = subinterface.ipv4
foreach neighbor in ipv4.neighbors
where neighbor.ip == ipNextHop
select neighbor.linkLayerAddress;

foreach device in network.devices
foreach networkInstance in device.networkInstances
let afts = networkInstance.afts
where isPresent(afts.ipv4Unicast)
let ipv4Unicast = afts.ipv4Unicast
foreach ipEntry in ipv4Unicast.ipEntries
foreach nextHop in ipEntry.nextHops
// where nextHop.originProtocol == OriginProtocol.BGP
let intDesc = getNextHopDesc(device, nextHop.interfaceName)
let nextHopMac = getNextHopMac(device, nextHop.interfaceName, nextHop.ipAddress)
foreach uniqueMac in nextHopMac
let ouiVendor = ouiAssignee(uniqueMac)
select {
deviceName: device.name,
networkInstanceName: networkInstance.name,
ipEntryPrefix: ipEntry.prefix,
originProtocol: nextHop.originProtocol,
nextHopInterface: nextHop.interfaceName,
nextHopIP: nextHop.ipAddress,
nextHopMac,
macVendor: ouiVendor,
intDesc
}

 

Be the first to reply!

Reply