Changing the name of a Cisco switch
To change the name of a Cisco network switch, you can use
the command hostname newHostname
where
newHostname is the new name you wish to apply to the switch. To
make the change permanent so the new name is still in place after a reboot,
you can follow the command with the write memory
command.
Switch>
Switch>enable
Password:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname Styx
Styx(config)#end
Styx#
*Sep 23 01:14:23.917: %SYS-5-CONFIG_I: Configured from console by console
Styx#write memory
Building configuration...
[OK]
Styx#
[/hardware/network/switch/cisco]
permanent link
Changing the default gateway address on a Cisco switch
For a Cisco network switch, to change the
default gateway
address, i.e., to specify the IP address of a router that the switch will
use, enter privileged EXEC mode with the enable
command, then
enter configuration mode with the command configure terminal
and then set the default gateway address with the command ip
default-gateway gatewayIPAddress
where gatewayIPAddress
is the address for the router you wish the switch to use. Then exit
configuration mode with the end
command. To make the change
permanent, so that it will persist after a reboot of the switch, enter
the command write memory
.
Switch>enable
Password:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip default-gateway 192.168.1.1
Switch(config)#end
Sep 23 01:26:53.415: %SYS-5-CONFIG_I: Configured from console by console
Switch#write memory
Building configuration...
[OK]
Switch#
You can view the default gateway address with the command
show ip default-gateway
.
Switch>show ip default-gateway
192.168.1.1
Switch>
[/hardware/network/switch/cisco]
permanent link
Checking and setting the port speed on a Cisco switch
You can check the port speed on a
Cisco network switch from its
command-line
interface (CLI) by logging into the switch and then issuing the
show interface
command. If you want to see the parameters,
including port speed, for all ports on the switch, the command
without any additional command line arguments will display information
for all the ports on the switch. If you are only interested in the rate for
a particular port, then specify it after the command. E.g., show
interface fa0/1
.
Hadrian>show interfaces fa0/1
FastEthernet0/1 is up, line protocol is up (connected)
Hardware is Fast Ethernet, address is 0009.e897.d281 (bia 0009.e897.d281)
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 32/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 10Mb/s, media type is 100BaseTX
input flow-control is unsupported output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 72000 bits/sec, 29 packets/sec
5 minute output rate 1286000 bits/sec, 728 packets/sec
686444 packets input, 756803225 bytes, 0 no buffer
Received 6 broadcasts (0 multicast)
0 runts, 0 giants, 0 throttles
4 input errors, 4 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
1626390 packets output, 293258140 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
Hadrian>
[ More Info ]
[/hardware/network/switch/cisco]
permanent link
Setting the date and time on a Cisco switch
When I logged into an old Cisco 2950 network switch today and checked the time
on the switch, I found the date was July 29, 1993 rather than January 1, 2022.
Hoggle>show clock
*23:47:16.884 UTC Thu Jul 29 1993
Hoggle>
A show clock detail
command revealed there was no time source
set for the switch.
Hoggle>show clock detail
*23:49:39.464 UTC Thu Jul 29 1993
No time source
Hoggle>
To set the time, I turned on the ability to enter privileged commands
with the enable
command.
Hoggle>enable
Password:
Hoggle#
I set the date and time to the current
Coordinated
Universal Time (UTC) values with the clock
set
command. You can find the current UTC time at
Current UTC, Time
Zone (Coordinated Universal Time).
Hoggle#clock set 02:47:10 jan 2 2022
Hoggle#show clock
02:47:20.163 UTC Sun Jan 2 2022
Hoggle#
The format of the command is clock set [hh:mm:ss] [month] [day]
[year]
with the following permissible values:
-
hh:mm:ss - Specifies the current time in hours in
military
format, aka 24-hour clock format, minutes, and seconds. So the value for
hours can range from 0 to 23 while the values for minutes and seconds can
range from 0 to 59.
- month - Specifies the current month using the first three letters of the
month name. The range is from Jan (January) to Dec (December).
- day - Specifies the current day of the month from 1 to 31
- year - Specifies the current year as a 4-digit year. The range is from
2000 up to 2037.
You may prefer to have the time displayed in your local time. This switch
is in the Eastern
Time Zone of the United States (you can see the current time for
U.S. time zones at
UNITED STATES
TIME ZONES), so the local time is currently 5 hours behind UTC time.
To display the time in the local time zone, I entered the configure
terminal
command to enter the Global Configuration context and then
specified the timezone as EST and indicated it is minus 5 hours from
UTC time.
Hoggle#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Hoggle(config)#clock timezone EST -5
Hoggle(config)#
The format for the command is clock timezone [zone] [hours-offset]
[minutes-offset]
. The options for the command are as follows:
- zone - The acronym of the time zone, which can be up to four characters in
length.
- hours-offset - The hours difference from UTC. The range is from -12 to +13.
- minutes-offset - (Optional) The minutes difference from UTC. The range is
from 0 to 59.
You can exit the Global Configuration context with Ctrl-Z. If you then
issue the show clock
command you should see the date and time
matching your local time.
Hoggle(config)#^Z
Hoggle#show clock
22:17:01.987 EST Sat Jan 1 2022
Hoggle#
[/hardware/network/switch/cisco]
permanent link
Clearing the counters for a port on a Cisco switch
You can view the counters for a port on a Cisco switch using the
show interfaces
command. E.g., if I want to check on whether
cyclic redundancy check (CRC) errors have been occurring on port fa0/16,
I can issue the command shown below:
Huron>show interfaces fa0/16
FastEthernet0/16 is up, line protocol is up (connected)
Hardware is Fast Ethernet, address is 0009.e897.d290 (bia 0009.e897.d290)
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 19/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 10Mb/s, media type is 100BaseTX
input flow-control is unsupported output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:00, output hang never
Last clearing of "show interface" counters 2d17h
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 24000 bits/sec, 40 packets/sec
5 minute output rate 756000 bits/sec, 64 packets/sec
46168 packets input, 4608074 bytes, 0 no buffer
Received 1250 broadcasts (1161 multicast)
0 runts, 0 giants, 0 throttles
121 input errors, 16 CRC, 105 frame, 0 overrun, 0 ignored
0 watchdog, 1161 multicast, 0 pause input
0 input packets with dribble condition detected
255151 packets output, 119141892 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
Huron>
[ More Info ]
[/hardware/network/switch/cisco]
permanent link
Changing the duplex setting for a port on a Cisco switch
You can determine the speed and duplex settings for a port on a Cisco switch
with the show interfces port_designation status
. E.g.:
Huron>show interfaces fa0/1 status
Port Name Status Vlan Duplex Speed Type
Fa0/1 connected 1 full 10 10/100BaseTX
Huron>
Often ports will be set to
autonegotiate the speed and duplex settings with the equipment connected
to the port. But sometimes that autonegotiation process may not work as
expected requiring you to manually set the parameters. E.g, if the piece
of equipment being connected to the port on the Cisco switch is configured
for a fixed mode of operation while the port on the switch is configured for
autonegotiate, the speeds may be configured for matching values on both sides
but there may be a
duplex mismatch. As a result of that mismatch
cyclic redundancy check (CRC) errors may be reported for the port on
the switch. You can manually set the duplex setting by entering the
enable
command and then the enable
password
when prompted. Then enter the configure
command and then
enter duplex
followed by full
or half
,
e.g., duplex full
.
[/hardware/network/switch/cisco]
permanent link
Determining the port to which a system is connected by MAC address
If you need to know the port on a Cisco switch to which a particular host
is connected and know the
media access control (MAC) address, you can determine
the port to which it connects using a
show mac address-table address
command. You can view all of the entries in the MAC address table
with the command
show mac address-table
, but if you know the
MAC address of the relevant system and only wish to determine the port on
the switch to which it connects, you can specify its MAC address with the
command
show mac address-table address
followed by the 48-bit
MAC address, which can be in the form
xx.xx.xx.xx.xx.xx
or
xxxx.xxxx.xxxx
.
Saturn>show mac address-table address 50:e5:49:d8:13:37
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 50e5.49d8.1337 DYNAMIC Fa0/19
Total Mac Addresses for this criterion: 1
Saturn>
With the port number, you can determine details for the interface to which
the system connects using a show interfaces port
where
port is the port identified by the show mac address-table address
command.
[ More Info ]
[/hardware/network/switch/cisco]
permanent link
Dealing with an err-disabled port
I experienced a problem with a Cisco switch periodically putting one
port in an
err-disabled
state. After checking the port,
I found that I needed to configure the speed and duplex settings to
specific values rather than letting them be autonegotiated.
[ More Info ]
[/hardware/network/switch/cisco]
permanent link
Port Spanning
Cisco switches have the capability to mirror what is going to/from one port
on a switch to another port on the same switch for monitoring purposes.
Cisco dubs this mirroring capability
"
port spanning".
The
monitor
command can be used to have all of the data
to and from a particular port copied to another port of your choosing
on the switch.
[More Info]
[/hardware/network/switch/cisco]
permanent link
Checking MAC Addresses on a Cisco Switch
On a Cisco switch, you can use the
show mac address-table
command to view the MAC addresses of devices connected to the switch.
[ More Info ]
[/hardware/network/switch/cisco]
permanent link