Switch Interfaces
Network Topology Overview
- Concept: The configurations and demonstrations are based on a standard enterprise LAN topology.
- Details:
- IP Subnet:
192.168.1.0/24 - Devices: 1 Router (R1), 2 Switches (SW1, SW2), 4 PCs (PC1-PC4).
- Hardware: A typical Catalyst switch (e.g., Catalyst 9200) features many RJ45 (copper UTP) interfaces for end hosts (e.g., 48 ports) and a few SFP (Small Form-factor Pluggable) fiber interfaces for uplinks to routers.
- IP Subnet:
Router vs. Switch Interfaces Default State
- Concept: Cisco routers and switches have different default administrative states for their physical interfaces.
- Details:
- Router Interfaces: Administratively disabled (
shutdown) by default. Status shows asadministratively down/down. - Switch Interfaces: Enabled (
no shutdown) by default.- If connected to a device: Status is
up/up. - If unconnected: Status is
down/down.
- If connected to a device: Status is
- Layer 2 Switchports: Do not require an IP address. The IP address column in
show ip interface briefwill show asunassigned.
- Router Interfaces: Administratively disabled (
! Check Layer 1 and Layer 2 status
SW1# show ip interface brief
Things to note: A down/down status on a switch interface simply means no cable is plugged in or the connected device is off. It does not mean the interface is administratively shut down.
Checking Interface Status
- Concept: Cisco IOS provides specific commands to view interface states, configurations, and statistics.
- Details:
show ip interface brief: Shows Layer 1 (Status) and Layer 2 (Protocol) states, and IP addresses.show interfaces status: Shows Port, Name (Description), Status, VLAN, Duplex, Speed, and Type.show interfaces [interface_id]: Shows detailed statistics, traffic counters, and errors.
SW1# show ip interface brief
SW1# show interfaces status
SW1# show interfaces fastEthernet 0/1
Things to note:
- In
show interfaces status, the connection status is displayed asconnected,notconnect, ordisabled. - If speed/duplex shows an
a-prefix (e.g.,a-100,a-full), it means the setting was auto-negotiated. If there is no prefix (e.g.,100,full), it was manually configured.
Configuring Speed, Duplex, and Description
- Concept: Interfaces can auto-negotiate speed and duplex, but they can also be manually hardcoded. Descriptions are used for network documentation.
- Details:
- Speed: Data rate in Mbps (10, 100, 1000).
- Duplex: Ability to send and receive simultaneously (Full) or take turns (Half).
- Description: A text label describing the connection.
SW1(config)# interface fastEthernet 0/1
SW1(config-if)# speed 100
SW1(config-if)# duplex full
SW1(config-if)# description Connected to R1
Configuring Multiple Interfaces (Interface Range)
- Concept: To save time, you can apply configurations to multiple interfaces simultaneously using the
interface rangecommand. This is highly recommended for disabling unused ports for security. - Details:
- Can specify consecutive ranges using a hyphen (e.g.,
fa0/1 - 5). - Can specify non-consecutive interfaces using commas (e.g.,
fa0/1 - 3, fa0/5).
- Can specify consecutive ranges using a hyphen (e.g.,
! Shut down a consecutive range of unused interfaces
SW1(config)# interface range fastEthernet 0/5 - 12
SW1(config-if-range)# description UNUSED
SW1(config-if-range)# shutdown
! Enable non-consecutive interfaces
SW1(config)# interface range fastEthernet 0/5 - 6, fastEthernet 0/9 - 12
SW1(config-if-range)# no shutdown
Half-Duplex vs. Full-Duplex
- Concept: Duplex determines how a device handles sending and receiving data on the network medium.
- Comparison:
| Feature | Half-Duplex | Full-Duplex |
|---|---|---|
| Data Flow | One direction at a time (send OR receive) | Both directions simultaneously (send AND receive) |
| Collision Domain | Shared (e.g., connected to a Hub) | Single device (e.g., connected to a Switch) |
| Collision Mechanism | Uses CSMA/CD | No collisions expected |
| Performance | Lower (roughly 50-60% of link capacity) | Higher (100% of link capacity in both directions) |
| Modern Usage | Rare (mostly legacy Hubs) | Standard for all modern switched networks |
- CSMA/CD (Carrier Sense Multiple Access with Collision Detection):
- Used in half-duplex environments (like Hubs) to manage collisions.
- Process:
- Listen to the wire to ensure it is idle.
- Transmit data if the wire is clear.
- If a collision occurs, send a jamming signal to inform all devices.
- Wait a random backoff time before attempting to retransmit.
- (Note: CSMA/CA (Collision Avoidance) is a similar concept used in Wireless networks).
Speed and Duplex Autonegotiation
- Concept: Devices exchange information to automatically select the fastest speed and best duplex setting they both support. Default setting on Cisco devices is
speed autoandduplex auto. - Details:
- When both sides use autonegotiation: They successfully negotiate the highest common speed and full-duplex.
- When one side disables autonegotiation:
- Speed: The auto-negotiating side can usually sense the speed of the other side via electrical signals and matches it. If it fails to sense, it defaults to the slowest supported speed (e.g., 10 Mbps).
- Duplex: The auto-negotiating side cannot sense duplex. It falls back to a strict IEEE rule:
- If speed is 10 or 100 Mbps, it defaults to Half-Duplex.
- If speed is 1000 Mbps or higher, it defaults to Full-Duplex.
graph TD
A[Device A: Autonegotiation ON] -->|Senses Speed| B[Device B: Autonegotiation OFF]
B -->|Fixed 100Mbps, Full-Duplex| A
A -->|Speed 100Mbps detected| C{Speed is 10 or 100?}
C -->|Yes| D[Defaults to Half-Duplex]
D --> E[Duplex Mismatch!]
Things to note: A Duplex Mismatch occurs when one side is full-duplex and the other is half-duplex. The half-duplex side will detect collisions and back off, while the full-duplex side will keep sending, resulting in severe performance degradation and late collisions. Always leave autonegotiation enabled on both sides!
Interface Counters and Errors
- Concept: Cisco devices track traffic statistics and errors. High error counts indicate physical or data link layer issues (e.g., bad cables, duplex mismatch).
- Details: Viewed using the
show interfacescommand (look at the bottom of the output).- Runts: Frames smaller than the minimum Ethernet size (64 bytes). Often caused by collisions.
- Giants: Frames larger than the maximum Ethernet size (1518 bytes).
- CRC (Cyclic Redundancy Check): Counts frames that failed the FCS (Frame Check Sequence) math in the Ethernet trailer. Indicates physical layer issues (e.g., bad cable, EMI).
- Frame: Counts frames with an incorrect/illegal format (e.g., missing start frame delimiter).
- Input Errors: Total of all receive errors (runts, giants, CRC, frame, etc.).
- Output Errors: Total of all transmit errors.
SW1# show interfaces fastEthernet 0/1
! Scroll to the bottom of the output to view error counters
Things to note: CRC errors almost always point to a physical layer problem (cable, connector, or interference). Runts often point to collisions caused by a duplex mismatch. Broadcasts are normal network operations and are not counted as errors.
Summary of Commands
| Command | Description |
|---|---|
show ip interface brief |
Displays Layer 1/2 status and IP addresses. |
show interfaces status |
Displays description, VLAN, duplex, speed, and connection status. |
show interfaces [id] |
Displays detailed interface statistics and error counters. |
speed [10 | 100 | 1000 | auto] |
Configures interface speed. |
duplex [full | half | auto] |
Configures interface duplex. |
description [text] |
Adds a text description to the interface. |
interface range [range] |
Enters configuration mode for multiple interfaces at once. |
shutdown / no shutdown |
Administratively disables or enables an interface. |
! Complete Interface Configuration Example
SW1(config)# interface range fastEthernet 0/1 - 4
SW1(config-if-range)# description CONNECTED_TO_HOSTS
SW1(config-if-range)# speed auto
SW1(config-if-range)# duplex auto
SW1(config-if-range)# no shutdown
SW1(config)# interface range fastEthernet 0/5 - 48
SW1(config-if-range)# description UNUSED_PORTS
SW1(config-if-range)# shutdown