Working with a Switch Commands - jwells24/Tech-Journal GitHub Wiki

Working with a Switch

  • For Week 2, I needed to set up multiple VLANs on multiple switches for our network. On a switch CLI, you start off at the top level command line. IN order to config, we type the command config to move deeper into the CLI in order to set configurations. When moving around, exit will bring you back to the top level.

Useful Commands

  • show running-config - Run from the lowest level CLI, prints out all of the ports and vlans configured on the switch. Important for determining names.

  • hostname west-edge - Change the hostname of the system

Adding and Configuring VLANs

  • In order to add and name a VLAN, use this command: vlan 10 & name Students. When accessing the config for a specific vlan, interface vlan 10 will bring us into the config on CLI for that specific vlan, where we can set ports and change settings.

  • Next, we need to designate the switch ports necessary for each vlan. This can be done using these two commands:

  1. (config)interface range FastEthernet 0/x-y
  2. (config-if-range)switchport access vlan x

Accessing a Port and Creating Trunk/Access Ports

  • In order to change the mode of a port, you first need to access the interface of the individual interface you want to change. Access an interface using this command:

  • interface Gigabitethernet 4/0/1

  • Once you are in the interface, you can either change the port to an access or trunk port. To enable a trunk port, we need to specify the encapsulation. Use these two commands below in conjunction to first specify the encapsulation, and then confirm the port is a trunk.

  • switchport trunk encapsulation dot1q and switchport mode trunk

  • If we want to make an access port and assign it to a specific VLAN, once we are in the ports interface, we use these commands below. The first command sets the port mode to access, and the second command assigns a vlan to the specified port.

  • switchport mode access and switchport access vlan 100