Link to home
Start Free TrialLog in
Avatar of Dragon0x40
Dragon0x40

asked on

How is the ip address that shows in CDP determined?

when you run cdp neighbor detail how is the ip address for that host determined?

RouterID, egress/ingress interface?
Avatar of mmusurlian
mmusurlian
Flag of United States of America image

based on the configuration / information provided from the device as part of the CDP process
Avatar of Dragon0x40
Dragon0x40

ASKER

thanks mmusurlian,

I want a specific answer so that I can compare what ip address I see in CDP to what I expect to see from the configuration of the device.

If I don't know how CDP populates the neighbor detail output then I cannot configure the device ip address that shows up in CDP.
CDP is a plain text protocol, the IP address of the switch is one of the pieces of texts transmitted.  If you watch a switch's traffic with wireshark, or any packet analyzer, you'll see the CDP packets and all the info they contain.
Avatar of greg ward
CDP is layer 2 and does not require an ip address to transmit cdp packets.
If it shows an ip address it will be of the interface which is connected to the device you are using.

Greg
I am looking at one of my switches and it showing the cdp neighbor ip address as a vlan interface ip address. there is a trunk in between them and it is allowing 3 vlans over the trunk. All three vlans have vlan interfaces with ip addresses assigned. The ip address that shows up in cdp neighbor is not of the connected interface nor the allowed vlans interface?

There has to be a different determining factor as to what ip address shows up in cdp neighbor.
CDP broadcasts the IP of the native, or untagged, VLAN.  A Cisco switch will try to use VLAN 1 as the native VLAN unless the "switchport trunk native vlan" command is used.  If VLAN 1 is disabled and no native VLAN is specified, then the unique settings in your configuration will dictate which VLAN gets used.  Which usually means whichever VLAN started communicating fist when the switch was powered up.

Short answer: Sync your CDP info by using the "switchport trunk native vlan"
Layer 3 connection: cdp will report far end IP as address on the interface?

Layer 2 connection: cdp will broadcast on vlan 1 or native vlan and if no aswer will use the vlan that started communicating first when booted up?

Do I have it right?
"Layer 3 connection: cdp will report far end IP as address on the interface" - This is correct, but it should be noted that devices between the layer 3 devices may block CDP or inject their own information.
I thought CDP will only report directly connected devices?
Routers, bridges, firewalls, etc can be set to allow CDP to pass-through.  It's rarely done, but can be done if multiple network segments need to appear as one.
Could it be that when a switch is attempting to determine which ip address it will use in a cdp packet it first looks at the native vlan to see if an ip address is assigned to the corresponding native vlan interface?

For example if the native vlan is 1 and vlan interface 1 has an ip address assigned then all cdp enabled ports send out a packet with that ip address as the device ip?

If int vlan1 has no ip address then the next higher numbered vlan int is checked until a vlan interface has an ip address configured and then that ip address will be used in the cdp packets to identify the switch?

If you set the native vlan to be the same number as the vlan int that has the ip address that you want displayed in CDP then the ip of the neighbors will display as desired?
ASKER CERTIFIED SOLUTION
Avatar of Marius Gunnerud
Marius Gunnerud
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
cdp neighbor will show the IP address on directly connected far end interface if one is assigned.

if no IP address on far end interface the cdp neighbor will show ip address of lowest configured IP address? Does CDP only look at Vlan interfaces? If a serial interface has the lowest IP address on the box will CDP use the IP address for the serial interface?
Serial interfaces will only be shown in cdp if an ip is configured on its interface. Fastethernet interfaces will always be shown as directly connected even if there is no ip configured.

CDP will first look at the directly connected fastethernet or gigabit interface, if the interface has no ip and the link is a trunk, cdp will then look at the vlan interface.