Problem
Create a non-routed VLAN on a Cisco switch.tl;dr
Create a VLAN on the switch:
conf t
vlan 100
name marketing
int fa0/1
switchport mode access
switchport access vlan 10
Solution
A VLAN, or virtual LAN, is a level 2 network that is not constrained to a single physical device. That is, it behaves the same way as a normal LAN, so every host can see every other host and it is extremely easy to configure things such as file and printer sharing. A VLAN can even span multiple physical locations, such as buildings, or even cities.
Alternatively, in a small/medium business environment you may only have one or two switches for your entire network. However, you may wish to segregate different host groups for reasons such as security, or ease of management. You may also not want guest computers to have access to sensitive resources on the internal network, such as file servers, but do not wish to create a separate network just for them.
In such situations, creating multiple internal VLANs on the switch is a great solution - hosts inside a single VLAN cannot access hosts inside another VLAN without going through a router or the Internet.
Create the VLAN
To create a VLAN on the switch, first login via console or SSH and go to enable mode, then:
conf t
vlan 100
name marketing
This adds VLAN 100 with the name "marketing" so you know it belongs to your company's marketing department.
Add a host to the VLAN
Hosts are organized on the VLAN through switch ports. In a basic configuration, each port can only be a member of a single VLAN. Adding a host to multiple VLANs is outside the scope of this guide.
To add a switch port to the VLAN, enter the following on your Cisco:
int fa0/4
switchport mode access
switchport access vlan 100
This adds FastEthernet port 4 to the just-created VLAN 100. The switchport mode access command is needed to change port mode to access, so it can only be used with the VLAN it is assigned. It is not strictly necessary, however it is useful for security.
Make sure to exit configuration mode and save your configuration!