Commands To Configure A Cisco Switch
CISCO
NAME CONFIGURATION, PASSWORDS AND SAVE CONFIGURATION
Switch>enable
Switch#config term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#enable secret (PASSWORD)
S1(config)#no ip domain-lookup
S1(config)#line console 0
S1(config-line)#password (password)
S1(config-line)#login
S1(config-line)#line vty 0 15
S1(config-line)#password (password)
S1(config-line)#login
S1(config-line)#end
S1#copy running-config startup-config wr
Destination filename [startup-config]?
Building configuration...
S1(config)#banner motd #Unauthorized access to this device is prohibited!#
#UNAUTHORIZED ACCESS HACKER PROSPECT#
CREATION OF VLAN AND NAMES
SERVER(config)#vlan (vlan number) 10
SERVER(config-vlan)#name (vlan name) Administration
SERVER(config-vlan)#end
SERVER(config)#vlan (vlan number) 20
SERVER(config-vlan)#name (name of the vlan) Students
SERVER(config-vlan)#end
ASSIGNMENT OF VLANS ON PORTS
SERVER(config)#interface range f0/(port range e.g. "2-5") ::THE PORTS
ASSIGNED::
SERVER(config-if-range)#switchport access vlan (vlan number) ::NAME OF
THE VLANS::
SERVER(config)#interface range f0/(port range e.g. "6-24") ::THE PORTS
ASSIGNED::
SERVER(config-if-range)#switchport access vlan (vlan number) ::NAME OF
THE VLANS::
SW1#show vlan brief
l
ASSIGNMENT OF IP TO EACH VLAN
SERVER(config)#interface vlan (vlan number)
%LINK-5-CHANGED: Interface Vlan10, changed state to up
LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to upSERVER
(config-if)#ip address (e.g. ip 172.17.10.10 and subnet mask e.g. 255.255.255.0)
SERVER(config-if)#no shutdown
ASSIGNMENT OF VLAN GATEWAY
SERVER(config)#ip default-gateway (gateway ip e.g. 172.17.10.1)
Enter configuration commands, one per line. End with CNTL/Z.
CREATION OF VLAN 99 PORT ASSIGNMENT
SERVER(config)#vlan 99
SERVER(config-vlan)#name (name of the vlan)
SERVER(config)#interface vlan 99
%LINK-5-CHANGED: Interface Vlan99, changed state to upSERVER(config-if)#
SERVER(config-if)#ip address (ip and subnet mask of the vlan)
SERVER(config-if)#
SERVER(config)#interface range f0//range of the ports)
SERVER(config-if-range)#switchport access vlan 99
Switch#show vlan brief ::Verify the VLAN information
Switch# show version ::Show the IOS information of Cisco.
Switch# show interface fastethernet 0/18 ::Examine the Fast Ethernet interfaces.
Switch# show vlan ::Examine the VLAN information.
Switch# show flash ::Examine the flash memory
S1#show interface vlan 99 ::Check the management configuration of the
LAN.
---------------------------
Use the help service to set up the clock
S1#clock ?
Step 2: Use the help to set up the clock according to the time.
actual
S1#clock ?
set Set the time and date
S1#clock set?
hh:mm:ss Current Time
S1#clock set 12:12:12 ?
Day of the month
Month of the year
See the most recently entered commands.
S1#show history
Check the loaded Cisco IOS software version.
S1#show version
Show the MAC addresses using the command
S1#show mac-address-table
List the show mac-address-table options.
S1#show mac-address-table ?
Show only the MAC addresses from the table that were learned in a way
dynamic.
S1#show mac-address-table address dynamic
To delete the existing MAC addresses,
S1#clear mac-address-table dynamic
Check that the MAC address table is blank.
S1#show mac-address-table
Show the port security configuration.
S1#show port-security
Remove the information file from the VLAN database.
Switch#delete flash:vlan.dat
Delete filename [ vlan.dat ] ? [ Intro ] (no spaces)
Delete flash:vlan.dat? [confirm] [Intro] (no spaces)
Delete the startup configuration file of the switch from the NVRAM.
Switch#erase startup-config
In response, the following input request will appear:
Erasing the nvram filesystem will remove all files! Continue? [ confirm ]
Press Enter to confirm.
The answer must be:
Erase of nvram: complete
Note: this post will be constantly modified.
Creation of VLAN
Switch#vlan database
Switch(vlan)#vlan [vlan number] name [vlan name]
Switch(vlan)#exit
-------------------------------------------------
We assign a VLAN to a port (Access mode)
Switch(config)#interface [Interface]
Switch(config-if)#switchport access vlan [vlan number]
We assign trunk mode to a port
Switch(config)#interface [Interface]
Switch(config-if)#switchport mode trunk
Router Configuration for VLAN
Router>enable
Router#configure terminal
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shut
Router(config-if)#interface fastEthernet 0/0.1 ---> (*)
Router(config-subif)#encapsulation dot1Q [VLAN number]
Router(config-subif)#ip address [IP] [Mask]