Eleven spreads. Each one has a picture, the theory, and the Cisco IOS commands you'd type into a real router or switch, or into Packet Tracer.
"It's a collapsed-core design: VLANs on an access switch, 802.1Q trunk to a router-on-a-stick, OSPF to the edge, PAT out to the ISP, and ACLs locking down the server VLAN."
Every word in that sentence gets its own page. Use the tabs or the ← → keys.
Sending data means wrapping it in headers, one layer at a time (encapsulation). Each device only opens the envelope it cares about.
| Layer | Unit | Address | Device | Examples |
|---|---|---|---|---|
| 7 App | data | URL | host | HTTP, DNS, SSH |
| 4 Transport | segment | port | firewall | TCP, UDP |
| 3 Network | packet | IP | router | IPv4, IPv6, ICMP |
| 2 Data link | frame | MAC | switch | Ethernet, 802.1Q |
| 1 Physical | bits | none | cable, hub | Cat6, fiber, Wi-Fi radio |
"That's a layer-2 problem: the IP config is fine, but the port's in the wrong VLAN."
An IPv4 address is 32 bits. The prefix (/24) says how many bits name the network. Hosts on the same network talk directly; anything else goes to the default gateway.
| Prefix | Mask | Block | Usable |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 (router links) |
10.0.0.0/8 · 172.16.0.0/12 · 192.168.0.0/162001:db8:10::1/64; no NAT needed169.254.x.x = DHCP failedA switch learns which MAC lives on which port and forwards frames only there. A VLAN is a separate broadcast domain on the same hardware: one subnet per VLAN.
Switch> enable Switch# configure terminal Switch(config)# hostname SW1 SW1(config)# vlan 10 SW1(config-vlan)# name STAFF SW1(config-vlan)# vlan 20 SW1(config-vlan)# name SERVERS SW1(config-vlan)# vlan 30 SW1(config-vlan)# name GUEST SW1(config-vlan)# exit SW1(config)# interface range fa0/1 - 10 SW1(config-if-range)# switchport mode access SW1(config-if-range)# switchport access vlan 10 SW1(config-if-range)# spanning-tree portfast SW1(config-if-range)# interface range fa0/11 - 15 SW1(config-if-range)# switchport mode access SW1(config-if-range)# switchport access vlan 20 SW1(config-if-range)# end SW1# show vlan brief SW1# show mac address-table
A trunk carries every VLAN, stamping each frame with an 802.1Q tag. To let VLANs talk, a router gets one subinterface per VLAN, which becomes that VLAN's default gateway.
SW1(config)# interface g0/1 SW1(config-if)# switchport mode trunk SW1(config-if)# switchport trunk allowed vlan 10,20,30,99 SW1(config-if)# switchport trunk native vlan 99 SW1# show interfaces trunk
R1(config)# interface g0/0 R1(config-if)# no shutdown R1(config-if)# interface g0/0.10 R1(config-subif)# encapsulation dot1Q 10 R1(config-subif)# ip address 192.168.10.1 255.255.255.0 R1(config-subif)# interface g0/0.20 R1(config-subif)# encapsulation dot1Q 20 R1(config-subif)# ip address 192.168.20.1 255.255.255.0 R1(config-subif)# interface g0/0.30 R1(config-subif)# encapsulation dot1Q 30 R1(config-subif)# ip address 192.168.30.1 255.255.255.0
MLS(config)# ip routing MLS(config)# interface vlan 10 MLS(config-if)# ip address 192.168.10.1 255.255.255.0
A router looks up the destination IP in its routing table, picks the most specific match (longest prefix), and forwards to the next hop. Routes come from three places: connected, static, or a dynamic protocol.
R1(config)# ip route 172.16.0.0 255.255.255.0 10.0.0.2 R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1 ! to ISP
R1(config)# router ospf 1 R1(config-router)# router-id 1.1.1.1 R1(config-router)# network 192.168.10.0 0.0.0.255 area 0 R1(config-router)# network 10.0.0.0 0.0.0.3 area 0 R1(config-router)# passive-interface g0/0 R1(config-router)# default-information originate R1# show ip ospf neighbor R1# show ip route ospf
0.0.0.255, /30 → 0.0.0.3R1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10 R1(config)# ip dhcp pool STAFF R1(dhcp-config)# network 192.168.10.0 255.255.255.0 R1(dhcp-config)# default-router 192.168.10.1 R1(dhcp-config)# dns-server 192.168.20.10 R1# show ip dhcp binding
R1(config)# interface g0/0.30 R1(config-subif)# ip helper-address 192.168.20.10
R1(config)# access-list 1 permit 192.168.0.0 0.0.255.255 R1(config)# interface g0/0.10 R1(config-subif)# ip nat inside ! repeat on .20 .30 R1(config)# interface g0/1 R1(config-if)# ip address 203.0.113.5 255.255.255.252 R1(config-if)# ip nat outside R1(config)# ip nat inside source list 1 interface g0/1 overload R1(config)# ip nat inside source static tcp 192.168.20.10 443 interface g0/1 443 R1# show ip nat translations
DNS itself usually runs on a server (Windows DNS, BIND, Pi-hole). In Packet Tracer: Server → Services → DNS, add an A record.
An ACL is an ordered list of permit/deny rules checked top-down; the first match wins and there's an invisible deny any at the end. Standard ACLs match source only (place near the destination). Extended ACLs match source, destination, protocol and port (place near the source).
R1(config)# ip access-list extended TO-SERVERS R1(config-ext-nacl)# permit tcp 192.168.10.0 0.0.0.255 host 192.168.20.10 eq 443 R1(config-ext-nacl)# permit udp any host 192.168.20.10 eq 53 R1(config-ext-nacl)# deny ip 192.168.30.0 0.0.0.255 192.168.20.0 0.0.0.255 R1(config-ext-nacl)# permit ip any any R1(config)# interface g0/0.20 R1(config-subif)# ip access-group TO-SERVERS out
R1(config)# enable secret Str0ng!Secret R1(config)# service password-encryption R1(config)# ip domain-name corp.local R1(config)# crypto key generate rsa modulus 2048 R1(config)# username admin privilege 15 secret Adm1n!Pass R1(config)# line vty 0 4 R1(config-line)# transport input ssh R1(config-line)# login local R1(config)# banner motd #Authorized access only#
SW1(config)# interface fa0/1 SW1(config-if)# switchport port-security SW1(config-if)# switchport port-security maximum 1 SW1(config-if)# switchport port-security mac-address sticky SW1(config-if)# switchport port-security violation shutdown SW1(config)# interface range fa0/20 - 24 SW1(config-if-range)# switchport access vlan 999 SW1(config-if-range)# shutdown
The passwords here are examples; use your own.
Each SSID maps to a VLAN, so Wi-Fi users land in the same subnets as wired ones. Big sites use a WLC (wireless LAN controller) to manage many lightweight APs.
SW1(config)# interface fa0/24 SW1(config-if)# switchport mode trunk SW1(config-if)# switchport trunk allowed vlan 10,30
R1(config)# interface g0/0.10 R1(config-subif)# ip address 192.168.10.2 255.255.255.0 R1(config-subif)# standby 10 ip 192.168.10.1 R1(config-subif)# standby 10 priority 110 R1(config-subif)# standby 10 preempt R1# show standby brief
SW1(config)# interface range g0/1 - 2 SW1(config-if-range)# channel-group 1 mode active SW1(config)# interface port-channel 1 SW1(config-if)# switchport mode trunk SW1# show etherchannel summary
administratively down.R1# show ip interface brief ! up/up? IPs right? R1# show running-config R1# show ip route R1# show access-lists ! hit counters R1# show cdp neighbors ! who's plugged in SW1# show interfaces status SW1# show port-security interface fa0/1 R1# ping 192.168.20.10 source g0/0.10 R1# traceroute 8.8.8.8 R1# copy running-config startup-config ! SAVE! C:\> ipconfig /all C:\> ipconfig /release && ipconfig /renew C:\> arp -a
no shutdownipconfig on PCs, ping gateway, ping across VLANs, ping the ISP (9).copy run start. Document it.| VLAN | Name | Subnet | Gateway | DHCP range |
|---|---|---|---|---|
| 10 | STAFF | 192.168.10.0/24 | .1 | .11–.254 |
| 20 | SERVERS | 192.168.20.0/24 | .1 | static |
| 30 | GUEST | 192.168.30.0/24 | .1 | .11–.254 |
| 99 | NATIVE | no IP | none | none |
| none | WAN | 203.0.113.4/30 | .6 ISP | none |
"Switches sort by MAC inside VLANs, trunks carry the tags, routers move packets between subnets, DHCP and DNS make it automatic, NAT gets you online, ACLs keep it safe, and show commands tell you what broke."