# Lab 02 - Switch Configuration
> ***Objectives:***
> - Ensure PCs and switches are connected properly
>   - Cable types
>     - PC-SW: straight cables
>     - SW-SW: ~~gay~~ crossover cables
>   - Connections
>     - Connect PCs to ports 1-3 and 11-13 of switches
>     - Connect switches together with ports 23 and 24
> - Configure switches properly
>   - Rename switches to `SW1`-`SW4`
>   - Assign ports 1-10 to VLAN 10
>   - Assign ports 11-20 to VLAN 20
>   - Set spanning-tree `portfast` on ports 1-20
>   - Set ports 22-24 as trunks for VLAN 10 and 20
>   - Set spanning-tree `portfast trunk` for ports 22-24
>   - Set `SW2` to be spanning-tree root primary for VLAN 10 and root secondary for VLAN 20
>   - Set `SW3` to be spanning-tree root secondary for VLAN 20
> - Configure static IP addresses for at least 3 computers per switch

The lab is realized in `./Networks/Main.ptk` in tag `lab-2`

## Basic Configuration
Run this configuration on each Switch replacing `{x}` with the switch number:

```sh
enable
configure terminal
hostname SW{x}

interface range fastEthernet 0/1-10
switchport mode access
switchport access vlan 10

interface range fastEthernet 0/11-20
switchport mode access
switchport access vlan 20

interface range fastEthernet 0/1-20
spanning-tree portfast

interface range fastEthernet 0/22-24
switchport mode trunk
switchport trunk allowed vlan 10,20
spanning-tree portfast trunk

exit
exit
disable
exit
```

## Configuration of `SW2`
```sh
enable
configure terminal
spanning-tree vlan 10 root primary
spanning-tree vlan 20 root secondary

exit
exit
disable
exit
```

## Configuration of `SW3`
```sh
enable
configure terminal
spanning-tree vlan 10 root secondary
spanning-tree vlan 20 root primary

exit
exit
disable
exit
```