0% found this document useful (0 votes)
32 views9 pages

Codes Cisco

Uploaded by

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

Codes Cisco

Uploaded by

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

Configure Basic Router Settings

Router# configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)# hostname R1

R1(config)# enable secret class

R1(config)# line console 0

R1(config-line)# password cisco

R1(config-line)# login

R1(config-line)# exit

R1(config)# line vty 0 4

R1(config-line)# password cisco

R1(config-line)# login

R1(config-line)# exit

R1(config)# service password-encryption

R1(config)#

R1(config)# banner motd #Authorized Access Only!#

R1# copy running-config startup-config

Destination filename [startup-config]?

Building configuration...

[OK]

Configure Router Interfaces

R1(config)# interface gigabitethernet 0/0/0

R1(config-if)# ip address 192.168.10.1 255.255.255.0

R1(config-if)# ipv6 address 2001:db8:acad:1::1/64

R1(config-if)# description Link to LAN 1

R1(config-if)# no shutdown

R1(config-if)# exit
R1(config)# interface gigabitethernet 0/0/1

R1(config-if)# ip address 192.168.11.1 255.255.255.0

R1(config-if)# ipv6 address 2001:db8:acad:2::1/64

R1(config-if)# description Link to LAN 2

R1(config-if)# no shutdown

R1(config-if)# exit

R1(config)# interface serial 0/0/0

R1(config-if)# ip address 209.165.200.225 255.255.255.252

R1(config-if)# ipv6 address 2001:db8:acad:3::225/64

R1(config-if)# description Link to R2

R1(config-if)# no shutdown

R1(config-if)# exit

R1(config)#

VLAN Creation Commands

Task IOS Command

Enter global configuration mode. Switch# configure terminal

Create a VLAN with a valid ID


Switch(config)# vlan vlan-id
number.

Specify a unique name to identify


Switch(config-vlan)# name vlan-name
the VLAN.

Return to the privileged EXEC


Switch(config-vlan)# end
mode.

VLAN Port Assignment Commands

Task IOS Command

Enter global configuration mode. Switch# configure terminal

Enter interface configuration mode. Switch(config)# interface interface-id


Task IOS Command

Set the port to access mode. Switch(config-if)# switchport mode access

Assign the port to a VLAN. Switch(config-if)# switchport access vlan vlan-id

Return to the privileged EXEC


Switch(config-if)# end
mode.

VLAN Port Assignment Example

S1# configure terminal

S1(config)# interface fa0/6

S1(config-if)# switchport mode access

S1(config-if)# switchport access vlan 20

S1(config-if)# end

Data and Voice VLAN Example

S3(config)# vlan 20

S3(config-vlan)# name student

S3(config-vlan)# vlan 150

S3(config-vlan)# name VOICE

S3(config-vlan)# exit

S3(config)# interface fa0/18

S3(config-if)# switchport mode access

S3(config-if)# switchport access vlan 20

S3(config-if)# mls qos trust cos

S3(config-if)# switchport voice vlan 150

S3(config-if)# end

Router-on-a-Stick

1. Create and name the VLANs.


S1(config)# vlan 10

S1(config-vlan)# name LAN10

S1(config-vlan)# exit
S1(config)# vlan 20

S1(config-vlan)# name LAN20

S1(config-vlan)# exit

S1(config)# vlan 99

S1(config-vlan)# name Management

S1(config-vlan)# exit

S1(config)#

2. Create the management interface.

S1(config)# interface vlan 99


S1(config-if)# ip add 192.168.99.2 255.255.255.0
S1(config-if)# no shut
S1(config-if)# exit
S1(config)# ip default-gateway 192.168.99.1
S1(config)#

3. Configure access ports.

S1(config)# interface fa0/6

S1(config-if)# switchport mode access

S1(config-if)# switchport access vlan 10

S1(config-if)# no shut

S1(config-if)# exit

4. Configure trunking ports.


S1(config)# interface fa0/1

S1(config-if)# switchport mode trunk

S1(config-if)# no shut

S1(config-if)# exit

S1(config)# interface fa0/5


S1(config-if)# switchport mode trunk

S1(config-if)# no shut

S1(config-if)# end

S2 VLAN and Trunking Configuration

S2(config)# vlan 10

S2(config-vlan)# name LAN10

S2(config-vlan)# exit

S2(config)# vlan 20

S2(config-vlan)# name LAN20

S2(config-vlan)# exit

S2(config)# vlan 99

S2(config-vlan)# name Management

S2(config-vlan)# exit

S2(config)#

S2(config)# interface vlan 99

S2(config-if)# ip add 192.168.99.3 255.255.255.0

S2(config-if)# no shut

S2(config-if)# exit

S2(config)# ip default-gateway 192.168.99.1

S2(config)# interface fa0/18

S2(config-if)# switchport mode access

S2(config-if)# switchport access vlan 20

S2(config-if)# no shut

S2(config-if)# exit

S2(config)# interface fa0/1

S2(config-if)# switchport mode trunk

S2(config-if)# no shut

S2(config-if)# exit

S2(config-if)# end
R1 Subinterface Configuration

R1(config)# interface G0/0/1.10

R1(config-subif)# description Default Gateway for VLAN 10

R1(config-subif)# encapsulation dot1Q 10

R1(config-subif)# ip add 192.168.10.1 255.255.255.0

R1(config-subif)# exit

R1(config)#

R1(config)# interface G0/0/1.20

R1(config-subif)# description Default Gateway for VLAN 20

R1(config-subif)# encapsulation dot1Q 20

R1(config-subif)# ip add 192.168.20.1 255.255.255.0

R1(config-subif)# exit

R1(config)#

R1(config)# interface G0/0/1.99

R1(config-subif)# description Default Gateway for VLAN 99

R1(config-subif)# encapsulation dot1Q 99

R1(config-subif)# ip add 192.168.99.1 255.255.255.0

R1(config-subif)# exit

R1(config)#

R1(config)# interface G0/0/1

R1(config-if)# description Trunk link to S1

R1(config-if)# no shut

R1(config-if)# end

R1#

Layer 3 Switch Inter-VLAN Routing

1. Create the VLANs.


D1(config)# vlan 10

D1(config-vlan)# name LAN10


D1(config-vlan)# vlan 20
D1(config-vlan)# name LAN20
D1(config-vlan)# exit
D1(config)#

2. Create the SVI VLAN interfaces.

D1(config)# interface vlan 10


D1(config-if)# description Default Gateway SVI for 192.168.10.0/24
D1(config-if)# ip add 192.168.10.1 255.255.255.0

D1(config-if)# no shut
D1(config-if)# exit
D1(config)#
D1(config)# int vlan 20

D1(config-if)# description Default Gateway SVI for 192.168.20.0/24


D1(config-if)# ip add 192.168.20.1 255.255.255.0
D1(config-if)# no shut
D1(config-if)# exit

D1(config)#

3. Configure access ports.

D1(config)# interface GigabitEthernet1/0/6


D1(config-if)# description Access port to PC1
D1(config-if)# switchport mode access
D1(config-if)# switchport access vlan 10

D1(config-if)# exit
D1(config)#
D1(config)# interface GigabitEthernet1/0/18
D1(config-if)# description Access port to PC2

D1(config-if)# switchport mode access


D1(config-if)# switchport access vlan 20
D1(config-if)# exit
4. Enable IP routing.

D1(config)# ip routing

D1(config)#

1. Configure the routed port.

D1(config)# interface GigabitEthernet0/0/1

D1(config-if)# description routed Port Link to R1

D1(config-if)# no switchport

D1(config-if)# ip address 10.10.10.2 255.255.255.0

D1(config-if)# no shut

D1(config-if)# exit

D1(config)#

2. Włącz routing.

D1(config)# ip routing

D1(config)#

3. Configure routing.

D1(config)# router ospf 10

D1(config-router)# network 192.168.10.0 0.0.0.255 area 0

D1(config-router)# network 192.168.20.0 0.0.0.255 area 0

D1(config-router)# network 10.10.10.0 0.0.0.3 area 0

D1(config-router)# ^Z

D1#
LACP Configuration Example

S1(config)# interface range FastEthernet 0/1 - 2

S1(config-if-range)# channel-group 1 mode active

Creating a port-channel interface Port-channel 1

S1(config-if-range)# exit

S1(config)# interface port-channel 1

S1(config-if)# switchport mode trunk

S1(config-if)# switchport trunk allowed vlan 1,2,20

You might also like