Build it in Packet Tracer or GNS3
Configure switches, router, DHCP, NAT, ACLs and Wi-Fi so every user reaches the internet.
By Invicly Tech, , in Computer Networking. About 12 minutes to read.
In short
In Cisco Packet Tracer or GNS3 you build the designed network device by device: switch VLANs and trunks, router subinterfaces for inter-VLAN routing, DHCP pools, NAT to the internet and ACLs between zones. Verify each layer as you go rather than configuring everything first. Save working configurations so you can return to a known-good state.
Explained simply
Now you build the design in a simulator. Cisco Packet Tracer is free with a Cisco Networking Academy account and is great for learning Cisco commands. GNS3 runs real router and switch software images, so it behaves even more like real gear, but it needs more setup.
Build in layers, the same way you troubleshoot. First connect the devices and make the links come up. Then create VLANs and trunks on the switches. Then add routing between VLANs, then DHCP and DNS, then NAT for the internet, and last the ACLs and Wi-Fi.
After every step, test before moving on. If a PC in the staff VLAN cannot get an address, there is no point adding NAT yet. Fixing one small step at a time is far easier than debugging everything at the end.
Save your work often. On Cisco devices the active configuration lives in memory (running-config) and is lost on reboot unless you copy it to startup-config. In Packet Tracer, also save the .pkt file itself.
Press Play on a diagram to walk through it one step at a time.
- 1Cable and power
Place devices, connect links.
- 2VLANs and trunks
Access ports, 802.1Q trunk to router.
- 3Inter-VLAN routing
Subinterfaces with gateway IPs.
- 4DHCP and DNS
Pools per VLAN; test client leases.
- 5NAT and ACLs
Internet access; restrict guest VLAN.
- 6Wi-Fi and verify
AP per SSID; ping and browse from each VLAN.
- Links
- show ip interface brief
- show cdp neighbors
- VLANs and trunks
- show vlan brief
- show interfaces trunk
- Routing
- show ip route
- show ip interface brief
- DHCP and NAT
- show ip dhcp binding
- show ip nat translations
- ACLs
- show access-lists
- show ip interface g0/0.20
In depth
VLANs, access ports and trunks
On each switch, create the VLANs and give them names, then assign each access port to one VLAN. An access port carries one VLAN without tags, which is what PCs and printers expect. A port for an IP phone can carry a data VLAN and a separate voice VLAN with switchport voice vlan. Add spanning-tree portfast on access ports so PCs get their link and DHCP lease quickly.
Links between switches, and from the core switch to the router, are trunks: they carry many VLANs, each frame tagged with 802.1Q. Set them explicitly with switchport mode trunk, restrict them with switchport trunk allowed vlan, and set the native VLAN (the untagged one) to an unused VLAN on both ends. On older multilayer switches like the 3560 you must first set switchport trunk encapsulation dot1q; 2960 switches only support 802.1Q, so the command does not exist there. Verify with show vlan brief (access ports per VLAN) and show interfaces trunk (allowed and active VLANs).
- vlan 10, then name STAFF
- switchport mode access, switchport access vlan 10
- switchport mode trunk, switchport trunk allowed vlan 10,20,30,40,99
- Native VLAN must match on both ends of a trunk
Inter-VLAN routing
Devices in different VLANs need a router (or a layer 3 switch) to talk. With router-on-a-stick, the router's physical interface connects to a trunk port, and you create one subinterface per VLAN: interface g0/0.10, then encapsulation dot1Q 10, then ip address 10.20.10.1 255.255.255.0. That address is the default gateway for every host in VLAN 10. The physical interface itself needs no shutdown, or none of the subinterfaces will come up.
On a layer 3 switch, create an SVI per VLAN instead (interface vlan 10 with the gateway IP) and enable ip routing globally. Either way, verify with show ip interface brief (every gateway up/up) and show ip route (one connected route per VLAN). Then test from a PC in each VLAN: ping its own gateway, then a host in another VLAN. If the gateway ping fails, the problem is the VLAN or trunk; if only the cross-VLAN ping fails, check the routing or the other host's gateway setting.
- PC (VLAN 10) to Switch: Frame to gateway MAC, untagged on access port1Frame to gateway MAC, untagged on access port
- Switch to Router g0/0.10 and .40: Sent on trunk tagged VLAN 102Sent on trunk tagged VLAN 10
- Router g0/0.10 and .40 to Switch: Routed, sent back tagged VLAN 403Routed, sent back tagged VLAN 40
- Switch to Server (VLAN 40): Untagged on the server's access port4Untagged on the server's access port
- Server (VLAN 40) to Switch: Reply to its gateway, VLAN 405Reply to its gateway, VLAN 40
- Router g0/0.10 and .40 to PC (VLAN 10): Routed back via VLAN 106Routed back via VLAN 10
DHCP, DNS and NAT
For DHCP on the router, first exclude addresses you keep static with ip dhcp excluded-address, then create a pool per VLAN with network, default-router and dns-server. The router answers DHCP on each subinterface whose subnet matches a pool. If DHCP lives on a server instead, put ip helper-address with the server's IP on each VLAN subinterface. Check leases with show ip dhcp binding.
For DNS in Packet Tracer, use a Server device: on its Services tab turn DNS on and add A records such as files.office.lan. In GNS3, run a small Linux VM as the DNS server.
For NAT, mark interfaces with ip nat inside (each VLAN subinterface) and ip nat outside (the WAN interface), create a standard ACL that matches your internal range, and add ip nat inside source list 1 interface g0/1 overload. Verify by browsing from a PC, then run show ip nat translations to see the inside local address mapped to the outside interface's address and port.
- ip dhcp excluded-address before ip dhcp pool
- show ip dhcp binding lists leases
- ip nat inside on LAN side, ip nat outside on WAN side
- show ip nat translations proves NAT works
ACLs, Wi-Fi and verification
Turn the zone matrix into extended named ACLs, one per VLAN, applied inbound on that VLAN's subinterface so traffic is filtered as close to its source as possible. Put specific permits (such as guests to the DNS server on UDP 53) before broad denies, end with the permit that allows the rest, and remember the implicit deny. After applying, use show access-lists: the match counters next to each line prove which rules traffic actually hits.
For Wi-Fi in Packet Tracer, connect an access point to a switch port in the right VLAN (or a trunk for multi-SSID APs), set the SSID and WPA2-PSK key, and add a wireless card to laptops. Finally, verify from every VLAN with a fixed checklist: lease received, ping gateway, ping a host in an allowed VLAN, blocked VLAN refused, DNS name resolves, internet reachable. Save with copy running-config startup-config on every device.
- 1Lease
ipconfig shows an IP from the right pool
- 2Gateway
ping the VLAN's .1 address
- 3Allowed VLAN
ping or open a permitted service
- 4Blocked VLAN
Should fail, ACL counters go up
- 5DNS
nslookup files.office.lan
- 6Internet
Browse; NAT translation appears
Learn it in 6 short steps
About 1h each. Track them with a timer in your plan.
- 1Configure VLANs and trunks on switches~1h
- 2Configure inter-VLAN routing~1h
- 3Set up DHCP and DNS~1h
- 4Configure NAT and ACLs~1h
- 5Add a wireless access point~1h
- 6Verify connectivity from every VLAN~1h
Key points
- Verify with show vlan brief, show interfaces trunk and show ip interface brief.
- Test from a client in every VLAN after each step.
- Use show running-config and copy run start to save progress.
- Packet Tracer simulation mode lets you step through each packet.
Key terms
Tap a card to flip it. 0/3 known
Examples
interface g0/0.10
encapsulation dot1Q 10
ip address 10.20.10.1 255.255.255.0
ip nat inside
interface g0/1
ip address dhcp
ip nat outside
access-list 1 permit 10.20.0.0 0.0.255.255
ip nat inside source list 1 interface g0/1 overload
do show ip interface briefRouter subinterface plus PAT on Cisco IOS.
Configuring an access switch
The floor switch has PCs on ports 1 to 20, phones with PCs behind them on ports 21 to 24, and an uplink on Gi0/1. Step 1: create the VLANs. Step 2: configure access ports with portfast. Step 3: configure phone ports with both a data and a voice VLAN. Step 4: configure the trunk with only the needed VLANs and an unused native VLAN. Step 5 (not shown): create VLAN 99, give the switch a management IP on interface vlan 99 with ip default-gateway, then save.
vlan 10
name STAFF
vlan 30
name VOICE
interface range fa0/1 - 20
switchport mode access
switchport access vlan 10
spanning-tree portfast
interface range fa0/21 - 24
switchport mode access
switchport access vlan 10
switchport voice vlan 30
interface g0/1
switchport mode trunk
switchport trunk allowed vlan 10,20,30,40,99DHCP pools and a guest ACL on the router
The router serves DHCP for guests and must keep them away from internal subnets while letting them use the internal DNS server. Step 1: exclude the addresses you keep. Step 2: create the guest pool (the staff pool looks the same). Step 3: write the guest ACL: first permit DHCP, because lease renewals go to the router's own address inside 10.20.0.0/16, then permit DNS to the server, then deny the internal range, then permit anything else. Step 4: apply it inbound on the guest subinterface. Step 5: test from a guest laptop and watch the counters with show access-lists.
ip dhcp excluded-address 10.20.20.1 10.20.20.9
ip dhcp pool GUEST
network 10.20.20.0 255.255.254.0
default-router 10.20.20.1
dns-server 10.20.40.10
ip access-list extended GUEST-IN
permit udp any eq bootpc any eq bootps
permit udp 10.20.20.0 0.0.1.255 host 10.20.40.10 eq 53
deny ip 10.20.20.0 0.0.1.255 10.20.0.0 0.0.255.255
permit ip 10.20.20.0 0.0.1.255 any
interface g0/0.20
ip access-group GUEST-IN inQuick reference
- Access port: switchport mode access + switchport access vlan N
- Trunk: switchport mode trunk + switchport trunk allowed vlan list
- Router subinterface: interface g0/0.10, encapsulation dot1Q 10, ip address
- Physical router interface needs no shutdown for its subinterfaces to work
- DHCP: ip dhcp excluded-address first, then ip dhcp pool with network and default-router
- PAT: ip nat inside source list 1 interface g0/1 overload
- Apply extended ACLs inbound on the source VLAN's interface
- Save on every device: copy running-config startup-config
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Configure a 2960 switch port fa0/5 for a printer in VLAN 10 and verify it.
- Exercise 2medium
Configure router-on-a-stick on g0/0 for VLANs 10, 20, 30, 40 and 99 using the addressing plan (gateway .1 in each 10.20.x.0 network, /23 for VLAN 20).
- Exercise 3hard
Move DHCP from the router to a server at 10.20.40.5 without breaking any VLAN. Write the router changes and the order you would apply them.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is Cisco Packet Tracer free?
- Yes. It is free to download for anyone who signs up for a Cisco Networking Academy account, and it runs on Windows, macOS and Linux.
- Should I use Packet Tracer or GNS3?
- Packet Tracer is easier and ideal for learning Cisco CLI and CCNA-level topics. GNS3 runs real device images and real captures, which is closer to production but needs images and more resources.
- Why does my PC get a 169.254 address?
- It asked for DHCP and nobody answered, so it gave itself a link-local address. Check the port's VLAN, the trunk, the DHCP pool and any helper-address.
- What is the difference between running-config and startup-config?
- running-config is the active configuration in memory. startup-config is stored in NVRAM and loaded at boot, so copy running-config startup-config to keep your changes.