Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Find the switch port (CISCO) through IP

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. brief introduction

In a Cisco switched network, given the IP address of a machine, how do you find out which port on which switch it is connected to? This chapter will demonstrate the experiment.

Very basic search commands, but sometimes many people forget, except for beginners.

1. (privileged mode): show ip arp | include the IP you want to find. This command finds out the corresponding MAC address of IP

2. (privileged mode): show mac address-table address MAC address. This command finds the port corresponding to the MAC address

In this case, it is generally necessary to start looking at the aggregation layer, find the port, enter the access layer switch and use the 2 command to find the corresponding port and then plan.

Because CDP is a proprietary route discovery protocol for CISCO, you can also find peripherals with the following command:

1. (privileged mode): show cdp neighbor can find out which port the device connects to which port of another device.

2. (privileged mode): show cdp entry * protocol can check the names and corresponding IP addresses of peripherals. Combined with the first command, you can build a network topology diagram without a topology diagram.

II. Practical commands for CISCO switches

2.1. Experiment with finding switch Port (CISCO) through IP

2.1.1. Ping the IP address on the switch first. Due to the aging time of the arp cache table, those that have not been used for a long time will be deleted.

# ping 172.16.9.22

Sending 5, 100-byte ICMP Echos to 172.16.9.22, timeout is 2 seconds:

!

2.1.2. Check the arp table to obtain the MAC address of the IP (if the MAC address is known, steps 1 and 2 can be omitted)

# show ip arp | in 172.16.9.22

2.1.3. View the mac table command to get the port number

# Show mac address-table address E005.C56D.D1C7

2.1.4. Use the cdp command to confirm whether the mac address belongs to the port of the current switch

# show cdp neighbors gi1/0/23

2.1.5. from the above results, we can see that the mac address was learned from the 0.14 switch. Log in to 0.14 and look for the port again.

# show cdp entry * protocol finds the IP corresponding to the switchover machine name

# show mac address-table | in E005.C56D.D1C7

2.1.6. Finally, use the cdp command to confirm whether it belongs to the current switch.

# show cdp neighbors fa0/14

If there is no result in the figure above, the mac address is the fa0/14 port from the current switch.

Attachment 1: common switch commands

Switch > user mode

1: enter privileged mode enable

Switch > enable

Switch#

2: enter global configuration mode configure terminal

Switch > enable

Switch#configure terminal

Switch (conf) #

3: the switch is named with 2950 as an example.

Switch > enable

Switch#configure terminal

Switch (conf) # hostname 2950

2950 (conf) #

4: configure the enable password to take cisco as an example

Switch > enable

Switch#configure terminal

Switch (conf) # hostname 2950

(conf) # enable password cisco

5: configure enable password enable secret ciscolab take cicsolab as an example

Switch > enable

Switch#configure terminal

Switch (conf) # hostname 2950

2950 (conf) # enable secret ciscolab

6: set up virtual local area network vlan 1 interface vlan 1

Switch > enable

Switch#configure terminal

Switch (conf) # hostname 2950

2950 (conf) # interface vlan 1

(conf-if) # ip address 192.168.1.1 255.255.255.0 configure switch port ip and subnet mask

2950 (conf-if) # no shut

2950 (conf-if) # exit

2950 (conf) # ip default-gateway 192.168.1.254 set the gateway address

7: enter a certain port of the switch interface fastehernet 0ram 17 take port 17 as an example

Switch > enable

Switch#configure terminal

Switch (conf) # hostname aptch3950

2950 (conf) # interface fastehernet 0amp 17

2950 (conf-if) #

8: view the command show

Switch > enable

Switch# show version views all version information in the system

Show interface vlan 1 views the switch configuration information about the ip protocol

Show running-configure to view the configuration information of the switch that is currently functioning

Show interface fastethernet 0Blade 1 to view the specific configuration and statistics of switch 1 interface

Show mac-address-table View mac address tabl

Show mac-address-table aging-time View automatic Aging time of mac address Table

9: switch resumes factory default restore command

Switch > enable

Switch# erase startup-configure

Switch# reload

10: duplex mode settin

Switch > enable

Switch#configure terminal

2950 (conf) # hostname aptch-2950

2950 (conf) # interface fastehernet 0amp 17 take port 17 as an example

2950 (conf-if) # duplex full/half/auto has three options: full, half, and auto

11:cdp related commands

Switch > enable

Switch# show cdp views the global cdp configuration information for the device

Show cdp interface fastethernet 0Table17 View cdp configuration information for port 17

Show cdp traffic views statistics about cdp packages

Show cdp nerghbors lists the cisco devices connected to the device

Attachment 2: common Router commands

Router > user mode

1: enter privileged mode enable

Router > enable

Router #

2: enter global configuration mode configure terminal

Router > enable

Router # configure terminal

Router (conf) #

3: name the switch hostname routera take routerA as an example

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

Routera (conf) #

4: configure enable password enable password cisco take cisco as an example

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # enable password cisco

5: configure enable password enable secret ciscolab take cicsolab as an example

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # enable secret ciscolab

6: enter a certain port of the router interface fastehernet 0ax 17 take port 17 as an example

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface fastehernet 0amp 17

RouterA (conf-if) #

Enter one of the subports of the router, interface fastethernet 0tic.17.1, take the subport 1 of port 17 as an example.

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface fastehernet 0amp 17.1

7: set port ip address information

Router > enable

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface fastehernet 0amp 17 take port 17 as an example

RouterA (conf-if) # ip address 192.168.1.1 255.255.255.0 configure switch port ip and subnet mask

RouterA (conf-if) # no shut is the configuration running

RouterA (conf-if) # exit

8: view the command show

Router > enable

Router # show version view all version information in the system

Show interface vlan 1 views the switch configuration information about the ip protocol

Show running-configure to view the configuration information of the switch that is currently functioning

Show interface fastethernet 0Blade 1 to view the specific configuration and statistics of switch 1 interface

Show mac-address-table View mac address tabl

Show mac-address-table aging-time View automatic Aging time of mac address Table

Show controllers serial + number to view serial port type

Show ip router looks at the routing table of the router

9:cdp related commands

Router > enable

Router # show cdp to view the global cdp configuration information for a device

Show cdp interface fastethernet 0Table17 View cdp configuration information for port 17

Show cdp traffic views statistics about cdp packages

Show cdp nerghbors lists the cisco devices connected to the device

Password recovery of 10:csico2600

Restart the router and press the win+ breakkey during the startup process to make the router enter rom monitor

Enter the command at the prompt to modify the value of the configuration register, and then restart the router

Remmon1 > confreg 0x2142

Remmon2 > reset

After restarting the router, enter setup mode, select "no", and return to exec mode. At this time, the original configuration of the router is still saved in startup-config. In order to make the configuration of the router unchanged after the password is restored, save the configuration in startup-config to running-config, then reset the enable password, and change the configuration register back to 0x2102:

Router > enable

Router#copy startup-config running-config

Router#configure terminal

Router (conf) # enable password cisco

Router (conf) # c onfig-register 0x2102

Save the current configuration to startup-config and restart the router.

Router # copy running-config startup-config

Router # reload

11: router telnet Telnet Settings:

Router > en

Router # configure terminal

Router (conf) # hostname routerA

RouterA (conf) # enable password cisco uses cisco as the privileged mode password

RouterA (conf) # interface fastethernet 0ram 1 uses port 17 as the telnet remote login port

RouterA (conf-if) # ip address 192.168.1.1 255.255.255.0

RouterA (conf-if) # no shut

RouterA (conf-if) # exit

RouterA (conf) line vty 0 4 setting 0-4 users can log in remotely with telnet

RouterA (conf-line) # login

RouterA (conf-line) # password edge uses edge as the user password for remote login

Host Settings:

Ip 192.168.1.2 the ip of the host must be in the same network segment as the address of the switch port

Netmask 255.255.255.0

Gate-way 192.168.1.1 Gateway address is the switch port address

Run:

Telnet 192.168.1.1

Enter the telnet remote login interface

Password: edge

Routera > en

Password: cisco

Routera#

12: configure the router identity banner $… $

Using the "banner" command in global configuration mode, you can configure prompts for the router, and all terminals connected to the router will receive it.

Router > en

Router # c onfigure terminal

Router (conf) # hostname routerA

RouterA (conf) # banner motd $This is aptech company' router! Please don't change the configuration without permissionism $

13: configure the interface ID description.

The interface identifies the interfaces used to distinguish the router.

Router > en

Router # c onfigure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface fastethernet 0amp 1 take the interface 0Universe 1 as an example

RouterA (conf-if) # description this is a fast Ethernet port used to connecting the company's intranet!

14: configuration timeout

Timeout is used to set how long the console has not been configured and automatically return the exec session time. The default is 10 minutes.

Router > en

Router # c onfigure terminal

Router (conf) # hostname routerA

RouterA (conf) # line console 0

RouterA (conf-if) # e xec-timeout 0 0 the first "0" represents minutes and the second "0" represents seconds

15: configure serial port parameters

Two routers connected through a serial port need one as DTE and the other as DCE. The DCE device provides clock rate and bandwidth to the DTE device.

DCE configuration:

Router > en

Router # c onfigure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface serial 0Universe 0

RouterA (conf_if) # clock rate 64000 provides a clock rate of 64000

RouterA (conf_if) # bandwidth 64 provides a bandwidth of 64

DTE configuration: router serial port configuration ip address

Router > en

Router # c onfigure terminal

Router (conf) # hostname routerB

RouterB (conf) # interface serial 0Universe 0

RouterB (conf_if) # ip address 192.168.1.1 255.255.255.0

16: configuration of static rout

Configure the hostname and interface parameters of router A

Router > enable

Router#c onfigure terminal

Router (conf) # hostname routerA

RouterA (conf) # interface fastethernet 0ram 1 Router A Port 1 is the connection port between the two routers

RouterA (conf-if) # ip address 192.168.2.1 255.255.255.0

RouterA (conf-if) # no shutdown

RouterA (conf-if) # exit

RouterA (conf) # interface fastethernet 0ram 0 Router A Port 0 is the connection port to the host

RouterA (conf-if) # ip address 192.168.1.2 255.255.255.0

RouterA (conf-if) # no shutdown

The ip address of host An is 192.168.1.1

255.255.255.0

192.168.1.2

Configure the hostname and interface parameters of router B

Router > enable

Router#c onfigure terminal

Router (conf) # hostname routerB

Port 0 of routerB (conf) # interface fastethernet 0amp 0 router B is the connection port between the two routers.

RouterB (conf-if) # ip address 192.168.2.2 255.255.255.0

RouterB (conf-if) # no shutdown

RouterB (conf-if) # exit

RouterB (conf) # interface fastethernet 0ram 1 Router B Port 1 is the connection port to the host

RouterB (conf-if) # ip address 192.168.3.1 255.255.255.0

The ip address of host B is 192.168.3.2

255.255.255.0

192.168.3.1

Configure the static routing table of router A

RouterA (conf) # ip router 192.168.3.0 255.255.255.0 192.168.2.2

Configure the static routing table of router B

RouterA (conf) # ip router 192.168.1.0 255.255.255.0 192.168.2.1

Configure default routes on routerA and routerB

RouterA (conf) # ip route 0.0.0.0 0.0.0.0 192.168.2.2

RouterA (conf) # ip classless

RouterB (conf) # ip route 0.0.0.0 0.0.0.0 192.168.2.1

RouterB (conf) # ip classless

Configure dynamic routing (RIP) on routerA and routerB

RouterA (conf) # router rip

RouterA (conf) # network 192.168.1.0

RouterA (conf) # network 192.168.2.0

RouterB (conf) # router rip

RouterB (conf) # network 192.168.2.0

RouterB (conf) # network 192.168.3.0

-end

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report