Switch Interfaces

Review

  • Router interfaces have the 'shutdown' command applied by default.

  • Status & Protocol will be in the 'administratively down / down' state by default (in 'show ip interface brief' command).

  • Switch interfaces do not have the 'shutdown' command applied by default.

  • Status & Protocol will be in the 'up / up' state if connected to another device or in the 'down / down' state if not connected to another device.

  • IP address in 'show ip interface brief' command will remain 'unassigned' as the Layer2 switchports don't need an IP address.

Show interfaces status

SW1#show interfaces status (works only on switch. different from 'show ip interface brief' command, which works on both).

  • Port - lists all the interfaces.

  • Name - description of the interfaces.

  • Status - different than the status field of 'show ip interface brief' command. The connected interfaces show a status of 'connected' and unconnected interfaces show a status of 'notconnect'. There are other possible statuses also.

  • Vlan - basically used to divide LANs into smaller LANs. Default Vlan is 1. The interface connected to the other switch, is a 'trunk' interface.

  • Duplex - indicates whether the device is capable of both sending and receiving data at the same time (full duplex, if not - half duplex). It is 'auto' by default on Cisco switches (it will negotiate with the neighboring device and use full duplex if possible, 'a-full').

  • Speed - 'auto' by default (they are able to negotiate with the device they are connected to and use the fastest speed both devices are capable of, 'a-100'. Fastethernet interfaces operate at 100mbps but can also operate at 10mbps).

  • Type - shows the type of the cable used, which also indicates the speed at which they can operate (10/100BaseTX - for copper UTP fast ethernet cables).

Configure speed and duplex

  • [[#Speed Duplex autonegotiation]] works well, so usually you will leave it be (but if there is some problem and it is not working, you'll have to manually configure).

  • Enter 'interface config' mode.

  • Type 'speed ?' to view the commands and set the speed.

  • Type 'duplex ?' to view the commands and set the duplex.

  • Type 'description' and then the message.

  • Check using 'show interfaces status'.

Interface range

Although the switch interfaces are enabled by default (you can plug a device and use it straight away, shutdown is not applied by default), it can be a security concern. You should disable the unused interfaces.

  • From global/interface config mode, type 'interface range range' (eg: SW1(config)#interface range f0/5-12 or SW1(config)#interface range f0/5-6, f0/9-12, if you want to skip interfaces 7&8).

  • You will enter 'interface range config mode' ( SW1(config-if-range)# ) instead of interface config mode.

  • Enter a description (eg: not in use) and then 'shutdown' the interfaces.

  • Type 'do show interfaces status' and you can see the description of each interface and status is 'disabled' (different from 'status' field of 'show ip interface brief' which will now be 'administratively down', although both mean the same thing).

Half / Full duplex

  • Half duplex : The device cannot send and receive data at the same time.

  • If it is receiving a frame, it must wait before sending a frame.

  • Devices attached to a hub must operate in half duplex.

  • Full duplex : The device can send and receive data at the same time. Need not wait.

  • Devices attached to a switch can operate in full duplex.

  • In modern networks that use switches, all devices can use full duplex on their interfaces.

LAN hubs

  • In modern day networks, half duplex is used almosts nowhere.

  • It was used in an old network device which was before the network switch, the hub.

  • The hub is much simpler than a switch, it is simply a repeater.

  • Any frame it receives, it floods like switch does with a broadcast or unknown unicast frame, which may result in collision.

  • All devices connected to a hub are part of what's called a collision domain. The frames they send could collide with frames any of the other devices connected to the hub send.

  • To deal with collisions in a half duplex situation like this, Ethernet devices use a mechanism called CSMA/CD.

CSMA/CD

Carrier Sense Multiple Access with Collision Detection.

  • It describes how devices avoid collisions in a half-duplex situation, and how they react if collisions do occur.

  • Before sending frames, devices 'listen' to the collision domain until they detect that other devices are not sending frames.

  • Even if collision occurs (due to bad timing), the device sends a jamming signal to inform the other devices that a collision happened.

  • Each device will wait a random period of time before sending frames again.

  • The process then repeats.

  • This was how networks operated for a long period of time.

Collision domain

  • Hubs are simple repeaters which operate at Layer1, repeating whatever signals they receive.

  • Switches operate at Layer2, using MAC addresses to send frames to specific hosts.

  • They also won't try to send 2 frames to the same hosts at once.

  • So, the network which was one collision domain when connected to a hub (picture above), is now 3 collision domains.

  • Because of the improved functionality of switches over hubs, these devices can now operate in full duplex.

  • They don't have to worry about whether or not other devices are sending data at the same time, they can send data freely.

  • Although collisions occur, they are rare and usually a sign of problem like misconfiguration.

Speed / Duplex autonegotiation

  • applies to both switches and routers.

  • Interfaces that can run at different speeds (fastethernet: 10/100 or gigabitethernet: 10/100/1000) have default settings of speed auto and duplex auto.

  • Interfaces 'advertise' their capabilities to neighbors and they negotiate the best speed and duplex settings they are both capable of.

  • Thus the PCs are all able to use the max speed of their network interfaces, and the switch adjusts the speeds of its interfaces to match.

  • In a network like this, with all PCs and switches, there's no reason to use half duplex, so they all negotiate to use full duplex.

Failed autonegotiation

What if autonegotiation is disabled on the device connected to the switch?

  • Speed:

    • The switch will try to sense the speed that the other device is operating at.

    • If it fails to sense the speed, it will use the slowest supported speed.

    • eg: 10mbps on a 10/100/1000 interface.

  • Duplex:

    • If the speed is 10 or 100mbps, the switch will use half duplex.

    • If the speed is 1000mbps or greater, it will use full duplex.

  • Duplex mixmatch causes collisions to occur, resulting in poor network performance.

  • So, use autonegotiation on all devices in the network.

![[failed autonegotiation.png]]

Interface counters & errors

Applies for both switch and router.

  • Enter 'show interfaces interface-id' command and look at the statistics at the bottom.

  • Total no. of packets received on the interface, and the total no. of bytes in those packets.

  • Runts : frames that are smaller than the minimum frame size (64 bytes).

  • Giants : frames that are larger than the maximum frame size (1518 bytes).

  • CRC : frames that failed the CRC check (in the Ethernet FCS trailer).

  • Frame : frames that have an incorrect format (due to an error).

  • Input errors : total of various counters, such as the above four.

  • Output errors : frames that switch tried to send, but failed due to an error.

Last updated