0% found this document useful (0 votes)
12 views

Configuring Switches and Routers

This document provides a comprehensive guide on configuring switches and routers, focusing on basic routing and switching functionalities. It covers essential topics such as accessing the command-line interface, basic configurations for switches and routers, VLAN setup, inter-VLAN routing, static and dynamic routing protocols, and DHCP implementation. Additionally, it includes practical examples to illustrate the configuration of a small office network with VLANs and port security.

Uploaded by

hussenseid670
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Configuring Switches and Routers

This document provides a comprehensive guide on configuring switches and routers, focusing on basic routing and switching functionalities. It covers essential topics such as accessing the command-line interface, basic configurations for switches and routers, VLAN setup, inter-VLAN routing, static and dynamic routing protocols, and DHCP implementation. Additionally, it includes practical examples to illustrate the configuration of a small office network with VLANs and port security.

Uploaded by

hussenseid670
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Configuring Switches and Routers: Basic Routing and Switching Configuration

Switches and routers form the backbone of any network infrastructure. While switches operate at
the Data Link layer (Layer 2) and primarily manage LAN communication, routers operate at the
Network layer (Layer 3) and handle inter-network communication. This guide provides a
fundamental understanding of how to configure switches and routers for basic routing and
switching functionality.

Introduction to Switching and Routing


Switches and routers are critical devices in network design:

 Switches connect devices within the same local area network (LAN), using MAC
addresses to forward frames.
 Routers connect multiple networks and direct data packets between them based on IP
addresses.

Configuring these devices involves setting up interfaces, enabling protocols, and applying
security measures to ensure efficient data transfer and secure network operation.

1. Accessing the Command-Line Interface (CLI)


2. Basic Switch Configuration
3. Basic Router Configuration
4. VLAN (Virtual LAN) Configuration
5. Inter-VLAN Routing
6. Static Routing
7. Dynamic Routing Protocols (e.g., RIP, OSPF)
8. Backup and Saving Configurations

1. Accessing the Command-Line Interface (CLI)

 To configure a switch or router, you need to access its CLI. Methods include:
o Console Access: Using a console cable connected to a PC running terminal
emulation software like PuTTY.
o SSH/Telnet: For remote configuration (requires IP address and authentication
setup).
o Web Interface: Some devices offer a graphical web-based interface for
configuration.
2. Basic Switch Configuration

Switch configuration primarily involves setting up VLANs, port settings, and enabling
management capabilities.

Steps to Configure a Switch

1. Access the CLI:


o Connect to the switch via the console or SSH.
o Log in to the switch using the default credentials.
2. Set a Hostname:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch1

3. Configure an IP Address for Management: Assign an IP address to the switch's


management VLAN (usually VLAN 1 by default).

Switch1(config)# interface vlan 1


Switch1(config-if)# ip address 192.168.1.2 255.255.255.0
Switch1(config-if)# no shutdown

4. Configure Default Gateway: Specify the router's IP address as the default gateway for
remote management.

Switch1(config)# ip default-gateway 192.168.1.1

5. Set Console and SSH Access: Enable console and SSH access for secure management.

Switch1(config)# line console 0


Switch1(config-line)# password cisco
Switch1(config-line)# login
Switch1(config-line)# exit

Switch1(config)# line vty 0 4


Switch1(config-line)# password cisco
Switch1(config-line)# login
Switch1(config-line)# transport input ssh

6. Save the Configuration:

Switch1# write memory


3. Basic Router Configuration

Router configuration involves setting up IP routing, interfaces, and basic protocols.

Steps to Configure a Router

1. Set a Hostname:

Router> enable
Router# configure terminal
Router(config)# hostname Router1

2. Configure Interfaces: Assign IP addresses to router interfaces.

Router1(config)# interface GigabitEthernet0/0


Router1(config-if)# ip address 192.168.1.1 255.255.255.0
Router1(config-if)# no shutdown

Router1(config)# interface GigabitEthernet0/1


Router1(config-if)# ip address 10.0.0.1 255.255.255.0
Router1(config-if)# no shutdown

3. Enable IP Routing (default in most routers):

Router1(config)# ip routing

4. Configure a Static Route (if needed):

Router1(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

5. Enable SSH Access:

Router1(config)# username admin privilege 15 secret cisco


Router1(config)# line vty 0 4
Router1(config-line)# login local
Router1(config-line)# transport input ssh
Router1(config-line)# exit

6. Save the Configuration:

Router1# write memory


4. VLAN (Virtual LAN) Configuration

VLANs segment a switch into multiple logical networks to improve performance and security.

Steps to Configure VLANs

1. Create a VLAN:

Switch1(config)# vlan 10
Switch1(config-vlan)# name Sales

2. Assign Ports to VLANs:

Switch1(config)# interface GigabitEthernet0/1


Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 10

3. Verify VLAN Configuration:

Switch1# show vlan brief

5. Inter-VLAN Routing

Inter-VLAN routing allows devices in different VLANs to communicate, which requires a Layer
3 device (router or Layer 3 switch).

Router-on-a-Stick Configuration:

1. Create Subinterfaces:

Router1(config)# interface GigabitEthernet0/0.10


Router1(config-subif)# encapsulation dot1q 10
Router1(config-subif)# ip address 192.168.10.1 255.255.255.0

2. Repeat for Other VLANs:

Router1(config)# interface GigabitEthernet0/0.20


Router1(config-subif)# encapsulation dot1q 20
Router1(config-subif)# ip address 192.168.20.1 255.255.255.0

3. Enable the Main Interface:

Router1(config)# interface GigabitEthernet0/0


Router1(config-if)# no shutdown
6. Static Routing

Static routes are manually configured paths to reach specific networks.

Steps to Configure Static Routing:

1. On Router1:

Router1(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2

2. On Router2:

Router2(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.1

7. Dynamic Routing Protocols

Dynamic routing protocols like RIP or OSPF simplify route configuration and adapt to network
changes.

Configuring RIP:

1. Enable RIP:

Router1(config)# router rip

2. Specify Networks:

Router1(config-router)# network 192.168.1.0


Router1(config-router)# network 10.0.0.0

8. Backup and Saving Configurations

Always save your configurations to avoid losing them after a reboot.

 Save Running Configuration to Startup Configuration:

Router1# copy running-config startup-config

 Backup Configurations to a TFTP Server:

Router1# copy running-config tftp


Practical Example: Small Office Network

1. Scenario: You need to configure a network for a small office with two VLANs (VLAN
10 for Sales, VLAN 20 for IT) and interconnect them via a router.
2. Devices:
o Switch: Configure VLANs 10 and 20.
o Router: Enable inter-VLAN routing using subinterfaces.
3. Steps:
o Assign devices in the Sales department to VLAN 10 and IT to VLAN 20.
o Configure inter-VLAN routing on the router to allow communication between the
two VLANs.

This configuration ensures efficient communication and segregation of traffic, demonstrating

Configuring Switch and Router Basic Settings

Configuring switches and routers involves establishing their basic functionality and preparing
them for more advanced configurations.

Basic Configuration of a Switch

1. Set a Hostname:

Switch> enable
Switch# configure terminal
Switch(config)# hostname Switch1

2. Assign Management IP Address: Configure the management interface for remote


access.

Switch1(config)# interface vlan 1


Switch1(config-if)# ip address 192.168.1.2 255.255.255.0
Switch1(config-if)# no shutdown

3. Configure Default Gateway:

Switch1(config)# ip default-gateway 192.168.1.1

4. Enable Console and SSH Access:

Switch1(config)# line console 0


Switch1(config-line)# password cisco
Switch1(config-line)# login

Switch1(config)# line vty 0 4


Switch1(config-line)# password cisco
Switch1(config-line)# login
Switch1(config-line)# transport input ssh
5. Save the Configuration:

Switch1# write memory

Basic Configuration of a Router

1. Set Hostname:

Router> enable
Router# configure terminal
Router(config)# hostname Router1

2. Configure Interfaces:

Router1(config)# interface GigabitEthernet0/0


Router1(config-if)# ip address 192.168.1.1 255.255.255.0
Router1(config-if)# no shutdown

3. Configure Default Route:

Router1(config)# ip route 0.0.0.0 0.0.0.0 <next-hop IP>

4. Save the Configuration:

Router1# write memory

Configuring a Simple LAN with Port Security

Port security helps prevent unauthorized access to the LAN by limiting the MAC addresses that
can connect to specific switch ports.

Steps to Configure Port Security

1. Assign a Port to Access Mode:

Switch1(config)# interface GigabitEthernet0/1


Switch1(config-if)# switchport mode access

2. Enable Port Security:

Switch1(config-if)# switchport port-security

3. Set Maximum MAC Addresses:

Switch1(config-if)# switchport port-security maximum 2

4. Specify MAC Addresses:


Switch1(config-if)# switchport port-security mac-address 0001.0002.0003

5. Set Violation Mode:


o Protect: Drops packets from unknown MACs.
o Restrict: Drops packets and generates a log message.
o Shutdown: Disables the port if a violation occurs.

Switch1(config-if)# switchport port-security violation shutdown

6. Verify Configuration:

Switch1# show port-security interface GigabitEthernet0/1

VLAN Implementation

VLANs segment a network into smaller, isolated networks, improving performance and security.

Steps to Configure VLANs

1. Create VLANs:

Switch1(config)# vlan 10
Switch1(config-vlan)# name Sales
Switch1(config)# vlan 20
Switch1(config-vlan)# name IT

2. Assign Ports to VLANs:

Switch1(config)# interface GigabitEthernet0/1


Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 10

Switch1(config)# interface GigabitEthernet0/2


Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 20

3. Configure a Trunk Port: A trunk port carries traffic for multiple VLANs between
switches or to a router.

Switch1(config)# interface GigabitEthernet0/24


Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk allowed vlan 10,20

4. Verify VLANs:

Switch1# show vlan brief


DHCP Implementation

A DHCP server assigns IP addresses automatically to devices in the network.

Configuring DHCP on a Router

1. Define DHCP Pool:

Router1(config)# ip dhcp pool Sales


Router1(dhcp-config)# network 192.168.10.0 255.255.255.0
Router1(dhcp-config)# default-router 192.168.10.1
Router1(dhcp-config)# dns-server 8.8.8.8

2. Exclude IP Addresses: Reserve IPs that should not be assigned dynamically.

Router1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10

3. Verify DHCP Leases:

Router1# show ip dhcp binding

Configuring DHCP Relay on a Switch

If DHCP is hosted on a router and clients are in different VLANs, configure the switch to relay
DHCP requests.

1. Enable DHCP Relay:

Switch1(config)# interface vlan 10


Switch1(config-if)# ip helper-address <DHCP server IP>

Practical Example

Scenario: Implementing a network with two VLANs (Sales and IT), using port security,
and enabling DHCP for each VLAN.

1. Configure VLANs:
o VLAN 10: Sales (192.168.10.0/24)
o VLAN 20: IT (192.168.20.0/24)
2. Set up DHCP on the router for each VLAN:
Router1(config)# ip dhcp pool Sales
Router1(dhcp-config)# network 192.168.10.0 255.255.255.0
Router1(dhcp-config)# default-router 192.168.10.1

Router1(config)# ip dhcp pool IT


Router1(dhcp-config)# network 192.168.20.0 255.255.255.0
Router1(dhcp-config)# default-router 192.168.20.1

3. Configure Inter-VLAN Routing using subinterfaces:

Router1(config)# interface GigabitEthernet0/0.10


Router1(config-subif)# encapsulation dot1q 10
Router1(config-subif)# ip address 192.168.10.1 255.255.255.0

Router1(config)# interface GigabitEthernet0/0.20


Router1(config-subif)# encapsulation dot1q 20
Router1(config-subif)# ip address 192.168.20.1 255.255.255.0

4. Enable Port Security on Switch:

Switch1(config)# interface GigabitEthernet0/1


Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 10
Switch1(config-if)# switchport port-security
Switch1(config-if)# switchport port-security mac-address sticky

You might also like