首页 > 代码库 > how to find out the switch port by IP address

how to find out the switch port by IP address

Subject: How to find out the port number by IP address

Solution:

In core switch, ping  the IP address,

Ex:

telnet@GemHF-Fab-Core#ping 10.20.12.111

Sending 1, 16-byte ICMP Echo to 10.20.12.111, timeout 5000 msec, TTL 64

Type Control-c to abort

Reply from 10.20.12.111    : bytes=16 time=1ms TTL=128

Success rate is 100 percent (1/1), round-trip min/avg/max=1/1/1 ms.

telnet@GemHF-Fab-Core#

 

And then:

telnet@GemHF-Fab-Core#sh arp 10.20.12.111

       IP Address           Mac Address      Type         Age          Port        Status

   1     10.20.12.111   6c62.6d99.023c Dynamic     1            1/19        Valid

telnet@GemHF-Fab-Core#

 

And we find one device be connected to Port:1/19

But the device‘s IP address is 10.20.12.111?

Let show MAC address again.

telnet@GemHF-Fab-Core#sh mac ethernet 1/19

Total active entries from port 19 = 10

 

MAC-Address     Port         Type       Index      VLAN

0012.f20c.d234  1/19         Dynamic    15838      2   

001b.78a5.1abb  1/19         Dynamic    1186       11  

6c62.6d99.023c  1/19         Dynamic    9116       12  

0022.641b.a7d6  1/19         Dynamic    14968      11  

0022.641b.a89f  1/19         Dynamic    7876       11  

1cc1.de13.3269  1/19         Dynamic    14167      11  

0015.5d0c.6f0b  1/19         Dynamic    10006      12  

4061.86c6.9d40  1/19         Dynamic    567        11  

9cb6.543a.d6b6  1/19         Dynamic    9426       11  

000d.f411.af84  1/19         Dynamic    5002       12  

telnet@GemHF-Fab-Core#

 

We can find not only 6c62.6d99.023cdevice  communication by this switch port. So we know a switch or router be connected to this switch port number.

 

Let me show fdp(Cisco named CDP) neighbor.

 

telnet@GemHF-Fab-Core#sh  fdp neighbors ethernet 1/19

Device ID: HF-OA-B1-1C

           configured as tag-type8100

Entry address(es):

  IP address: 10.20.0.20

Platform: FES4802 Switch,  Capabilities: Switch

Interface: ethernet1/19

Port ID (outgoing port): ethernet50 is TAGGED in following VLAN(s):

 2 11

Holdtime : 122 seconds

Foundry Networks, Inc. FES4802, IronWare Version 03.6.00cTc1 Compiled on Oct 31 2006 at 22:18:23 labeled as FES03600c

 

One device named HF-OA-B1-1C be connected to this port.

 

Now let‘s login this switch by telnet.

 

Let‘s ping the IP address: 10.20.12.111 at first.

 

telnet@HF-OA-B1-1C#ping 10.20.12.111

Sending 1, 16-byte ICMP Echo to 10.20.12.111, timeout 5000 msec, TTL 64

Type Control-c to abort

Reply from 10.20.12.111    : bytes=16 time<1ms TTL=127

Success rate is 100 percent (1/1), round-trip min/avg/max=0/0/0 ms.

telnet@HF-OA-B1-1C#^C

telnet@HF-OA-B1-1C#

 

And then let‘s show the mac address:

 

telnet@HF-OA-B1-1C#sh mac-address

Total active entries from all ports = 31

  MAC-Address    Port     Type   VLAN

6c62.6d99.0129     50  Dynamic     12

6c62.6d99.0309     50  Dynamic     12

6c62.6d99.023f     50  Dynamic     12

6c62.6d99.023c      7  Dynamic     12

d067.e531.3ec0     50  Dynamic     12

02e0.52ea.ca0c     50  Dynamic     12

02e0.52c5.ca0b     50  Dynamic     11

02e0.522e.ca02     50  Dynamic      2

9cb6.543a.d6b6     22  Dynamic     11

000d.f411.d7d2     50  Dynamic     12

0012.f21a.da00     50  Dynamic     11

0012.f21a.da12     50  Dynamic     11

000d.f410.c492     50  Dynamic     12

0015.5d0c.6f0b      7  Dynamic     12

000d.f411.c18e     50  Dynamic     12

000d.f411.4920     50  Dynamic     11

0022.641b.a7d6     21  Dynamic     11

0022.641b.a89f     14  Dynamic     11

4061.86c8.12a1     50  Dynamic     11

0012.f21b.2500     50  Dynamic     11

000d.f411.af84      7  Dynamic     12

  MAC-Address    Port     Type   VLAN                            

4061.86c6.9d60     50  Dynamic     12

4061.86c6.9d40     25  Dynamic     11

001b.78a5.1abb     23  Dynamic     11

001c.c41e.a6cf     50  Dynamic     11

1cc1.de13.3269     16  Dynamic     11

0012.f21a.da12     50  Dynamic     12

0012.f21b.2500     50  Dynamic     12

0012.f21a.da12     50  Dynamic      2

0012.f21b.2500     50  Dynamic      2

0012.f21a.da00     50  Dynamic     12

 

 

We can find the mac-address 6c62.6d99.023c matching with IP address, and the switch port number  is 7.  but we find not only the mac address communication by this switch port. Let‘s check it again. We find one a small hub is connected to this switch port. So we can ignore this small HUB and think the device directly connected to this port.

 

Now we have found the switch port.


本文出自 “庐阳侠们” 博客,请务必保留此出处http://c1813.blog.51cto.com/112125/1558343

how to find out the switch port by IP address