Professional Documents
Culture Documents
1 of 8
Steps Commands Explanation Details
Exit the interface config mode for
Switch(config-if)#exit
fa0/2 and fa0/0
Enter interface config mode for
Switch(config)#interface range fa0/1, fa0/3 fa0/1 and fa0/3
Switch(config-if)#switchport mode access Set the port mode to access
Switch(config-if)#switchport access vlan 20 Assign vlan 20 to fa0/1 and fa0/3
Exit the interface config mode for
Switch(config-if)#exit
fa0/1 and fa0/3
Enter interface config. mode for
Router(config)#interface fa0/0
fa0/0
Router(config-if)#ip address 192.168.10.1 Configure IP address and subnet
255.255.255.0 mask
Router(config-if)#no shutdown Enable the interface
Configure the IP addresses on Router(config-if)#exit Exit the interface
the router Enter interface config. mode for
Router(config)#interface fa0/1
fa0/1
Router(config-if)#ip address 192.168.20.1 Configure IP address and subnet
255.255.255.0 mask
Router(config-if)#no shutdown Enable the interface
Router(config-if)#exit Exit the interface
Configure appropriate default Host A- 192.168.10.1
-
gateway on end-hosts Host B -192.168.20.1
Switch(config)#interface + interface name Configure the switchport as trunk
Switch(config-if)#switchport trunk encapsulation + Configure the encapsulation
isl/dot1q protocol: isl/do1q
Configure the connections
between switches as trunk Configure allowed VLANs on the
Switch(config-if)#switchport trunk + vlan-id
(if used) switchport
For security reasons it is
Switch(config)#switch trunk native vlan + vlan-id Disable or change native VLAN recommended to disable the
native VLAN
2 of 8
Router-on-a-Stick (ROAS) inter-VLAN routing
3 of 8
Steps Commands Explanation Details
Switch(config-if)#switchport mode access Set the port mode to access
Switch(config-if)#switchport access vlan 20 Assign vlan 20 to fa0/3
Exit the interface config mode for
Switch(config-if)#exit
fa0/3
Enter interface configuration for
Switch(config)#interface fa0/1
fa0/1
The link between switch and
Switch(config-if)#switchport mode trunk Set the port to trunk mode router should operate in
trunk mode
Switch(config-if)#exit Exit the interface
Enter sub-interface config. mode
Router(config)#interface fa0/1.10
for fa0/1.10
Router(config-subif)#encapsulation dot1Q 10 Set encapsulation type to 802.1Q
and assign VLAN 10 to the virtual
interface
Router(config-subif)#ip address 192.168.10.1 Configure IP address and subnet
255.255.255.0 mask
Router(config-subif)#exit Exit the sub-interface
Enter sub-interface config. mode
Router(config)#interface fa0/1.20 Useful command to verify
Configure the IP addresses on for fa0/1.20
the configuration:
the router Router(config-subif)#encapsulation dot1Q 20 Set the encapsulation type to
show ip route
802.1Q and assign VLAN 20 to the
virtual interface.
Router(config-subif)#ip address 192.168.20.1 Configure IP address and subnet
255.255.255.0 mask
Router(config-subif)#exit Exit the sub-interface
Enter interface config. mode for
Router(config)#interface fa0/1
fa0/1
Router(config-if)#no shutdown Activate the physical interface
Router#copy running-config startup-config Save configuration
Configure appropriate default Host A- 192.168.10.1 (fa0/1.10)
-
gateway on end-hosts Host B -192.168.20.1 (fa0/1.20)
Configure the connections Switch(config)#interface + interface name Configure the switchport as trunk
4 of 8
Steps Commands Explanation Details
For older versions. Newer
Switch(config-if)#switchport trunk encapsulation + Configure the encapsulation versions support only
isl/dot1q protocol: isl/dot1q 802.1q so it is enabled by
default
Switch(config-if)#switchport trunk allowed + vlan- Configure allowed VLANs on the
id switchport
Switch(config-if)#switchport trunk allowed vlan
To add a vlan
between switches as trunk add + vlan-id
(if used) Switch(config-if)#switchport trunk allowed vlan
To remove a vlan
remove + vlan-id
For security reasons it is
recommended to disable the
Switch(config-if)#switchport trunk native vlan + native VLAN
Disable or change native VLAN
vlan-id Useful command to show
native vlan: show interface
trunk
5 of 8
Multilayer Switch Inter-VLAN routing
6 of 8
Steps Commands Explanation Details
L2-Switch(config-if)#switchport mode access Set the port mode to access
L2-Switch(config-if)#switchport access vlan 10 Assign vlan 10 to fa0/2
Exit the interface config mode for
L2-Switch(config-if)#exit
fa0/2
Enter interface config mode for
L2-Switch(config)#interface fa0/3
fa0/3
L2-Switch(config-if)#switchport mode access Set the port mode to access access ports
Interfaces connected to
L2-Switch(config-if)#switchport access vlan 20 Assign vlan 20 to fa0/3 ROAS and other switches
Exit the interface config mode for will be configured as trunk
L2-Switch(config-if)#exit
fa0/3 ports
Enter interface configuration for
L2-Switch(config)#interface fa0/1
fa0/1
L2-Switch(config-if)#switchport trunk Set the encapsulation type to
encapsulation dot1q 802.1Q on the interface
L2-Switch(config-if)#switchport mode trunk Set the port to trunk mode
7 of 8
Steps Commands Explanation Details
gateway on end-hosts Host B -192.168.20.1
Create a virtual interface for
L3-Switch(config)#interface vlan10 VLAN 10 and enter interface
configuration mode
Configure L3 Switch VLAN
L3-Switch(config-if)#ip address 192.168.10.1 Configure a static route to reach
Interfaces (SVI)
255.255.255.0 VLAN 10
L3-Switch(config-if)#no shutdown Activate interface
L3-Switch(config-if)#exit Exit the interface
Create a virtual interface for
L3-Switch(config)#interface vlan20 VLAN 20 and enter interface
configuration mode
L3-Switch(config-if)#ip address 192.168.20.1 Configure a static route to reach
255.255.255.0 VLAN 20
L3-Switch(config-if)#no shutdown Activate interface
L3-Switch(config-if)#exit Exit the interface
Enter interface configuration for
L3-Switch(config)#interface fa0/0
fa0/0
L3-Switch(config-if)#description to Internet
Interface description
Firewall
Creates an L3 port on the switch’s
L3-Switch(config-if)#no switchport
Configure a routed port for physical port
connecting to the firewall on L3-Switch(config-if)#ip address 192.0.0.1
Configure IP address
the L3 switch 255.255.255.252
L3-Switch(config)#ip route 0.0.0.0 0.0.0.0 Configure default route towards
192.0.0.2 the firewall
L3-Switch(config-if)#exit Exit the interface
L3-Switch(config)#copy running-config startup-
Save all configuration
config
8 of 8