cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
46097
Views
10
Helpful
15
Replies

Retrieving a list of all IP's and their ports from CLI

jxke
Level 1
Level 1

I have searched for similar posts and have found nothing.

I am needing help with commands I can run to get a list of ALL IP's and their associated ports from the CLI. I do not want a single ip and its port. That's too much work for our organization. 

 

I can get mac's and ports or ip's and macs. But not IP's and ports.

 

Any help would be greatly appreciated. Thank you

15 Replies 15

Joseph W. Doherty
Hall of Fame
Hall of Fame
First problem, network devices do not generally keep track of all IPs because they often don't need them. For example, a switch will record an incoming frame's src MAC to the ingress port, but it will not record an incoming src IP. As a switch, it doesn't need either the src or dest IP.

If device is a router (or L3 switch), it doesn't record an ingress src IP and dest IP, if not on a connected network, would only be recorded if using a route cache. For a connected network, the dest IP will be in ARP table.

So, as you've noted, they don't keep IPs and ports together, you generally need to look at something like a device's ARP table, to translate IPs to MACs and then look at the MAC table to tranlate MACs to ports.

Hi

The only command that it could be useful is:

 

show ip int brief

or

show ip int brief | include up




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

This show's all IP's as unassigned.

Other command but it will show everything local and remote subnets is:

show ip cef

or more explicit

show ip cef | inc receive

The information could be a little bit confused based on what you desire obtain. 

Or show ip arp but you must identify the IP Addresses associated to your interfaces




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

Basically I need a list of each port on the switches and the IP address being used on that port.

There may be commercial tools but I would simply script it. 

 

So get all the mac address tables off the L2 switches, get the arp table and mac address table of the L3 switch(es) and then cross reference the arp to mac address tables based on mac address. 

 

A number of scritpting languages have modules to make connecting to Cisco devices relatively easy and then you collect the relevant tables and then withint the script you could do the cross referencing using the arp table contents to cross reference against each mac address table. 

 

Even this is not perfect depending on your network topology and whether the end device is active or not but it would be a good start. 

 

You may find something like this has been done before if you do a search. 

 

Jon

 

Leo Laohoo
Hall of Fame
Hall of Fame
Enable IP Device Tracking.

Hi Leo,

Please correct me if I am wrong, does it work for routers? or just for switches?

Thank you 




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

Hi Julio,

I would never enable IP Device Tracking on a router. Why? Because trying to trawl through the list would be a challenge.

When I want to find the IP address of a downstream device connected to a port, the command I use is "sh ip device track interface <BLAH>". Even with a 169.254.X.X will show up with IPDT enabled.

Ok thank you for the explanation.

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

Enabling the IP tracking feature from the command line does nothing. 

 

I need to retrieve about 500 devices IP's and ports from our switches for our VOIP provider. I do not want to sort through all of that data manually. 

It's 2017, I feel like this should be a feature by now or someone should have a way to pull every port's assigned DHCP address with ease, instead of only listing MAC address and port. 

As I wrote earlier, a switch often doesn't need host IPs (when it's only supporting L2), so it will be difficult to provide such a feature when the device doesn't have the data (by default).

Even on a L3 switch, that has an ARP cache, you may need to do something like a subnet ping to get all on-line hosts' IP in the ARP cache.

"Enabling the IP tracking feature from the command line does nothing."

 

I would think you would want to enable IP device tracking on the interface(s) rather than globally, especially if you have interfaces you don't care to track. For example - if you are trying to track IP addresses on all hosts belonging to a specific VLAN then go into the VLAN interface and run "ip device tracking max 500" (since you said 500 devices)

 

You then need to wait for the devices to actually DO something IP related. Like other users have said, a switch will not natively track this so the data needs to populate after you enable the command. For example, you enable IP device tracking and then show ip device tracking but don't see anything. You then ping a device on one of the interfaces you are tracking and re-run the "show ip device tracking all" command. You will now see that the data for that device, specifically: IP Address, MAC Address, Vlan, Interface, Probe-Timeout, State, Source.

hello dear cisco i used in my office all my network connectivity  in cisco device please support me how to configure Switch or vlans

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco