RANGER GAMEZ

CompTIA Network+ (N10-009) · chapter 9 of 29

Weeks 6-8: Warehouse build, routes and VLANs

Objective 2.1

Routing: how routers choose a path

Static routing

A static route is typed in by an admin: "to reach network X, send to next hop Y." It uses no CPU or bandwidth for updates, is predictable and secure, but does not react to failures and does not scale. Perfect for a stub site with one way out, like a default route (0.0.0.0/0) to the ISP. A floating static route has a higher administrative distance so it is used only if the main route disappears.

ip route 0.0.0.0 0.0.0.0 203.0.113.1
 ! default route
ip route 10.20.0.0 255.255.0.0 10.0.0.2
 ! warehouse
ip route 10.20.0.0 255.255.0.0 10.9.9.2 250
 ! floating: AD 250 = backup only

Exam tip Gateway of last resort = the default route. Static routes have an administrative distance of 1.

Dynamic routing: OSPF, EIGRP, BGP

Dynamic protocols learn routes from neighbors and reroute around failures automatically.

  • OSPF: open-standard link-state protocol. Every router builds a map and runs Dijkstra SPF. Metric = cost (based on bandwidth). Uses areas, with area 0 as the backbone. Interior (inside one organization).
  • EIGRP: Cisco-developed advanced distance-vector (often called hybrid). Metric from bandwidth and delay; DUAL keeps backup routes ready for very fast convergence. Interior.
  • BGP: path-vector exterior protocol that routes between autonomous systems; the routing protocol of the internet. Chooses by path attributes (AS path and more). Runs over TCP 179.

Exam tip Inside the company: OSPF or EIGRP. Between the company and ISPs or across the internet: BGP.

Route selection: prefix length, AD, metric

When several routes could match, a router decides in this order. (1) Prefix length: the longest (most specific) match wins, always. (2) Administrative distance (AD): if the same prefix is learned from different sources, the most trusted (lowest AD) is installed. (3) Metric: between routes from the same protocol, the lowest metric (OSPF cost, EIGRP composite) wins.

Source              AD (Cisco default)
Connected           0
Static              1
eBGP                20
EIGRP (internal)    90
OSPF                110
RIP                 120
iBGP                200
How a router picks a route, as three checks in order. First, the longest prefix match wins, always. Second, for the same prefix from different sources, the lowest administrative distance wins: connected 0, static 1, OSPF 110, RIP 120. Third, for routes from the same protocol, the lowest metric wins. Example: traffic to 10.20.5.7 matches both 10.20.0.0/16 from OSPF and 10.20.5.0/24 static; the /24 is longer, so it wins.
Longest prefix first, then lowest AD, then lowest metric.

Exam tip Trap: a /26 route beats a /24 even if the /24 has a better AD. Prefix length is checked first.

Objective 2.1

NAT, FHRP and subinterfaces

NAT and PAT

NAT translates IP addresses as packets cross a router or firewall, usually private (RFC1918) inside to public outside. Static NAT: one private to one public, permanent; used to publish a server. Dynamic NAT: private hosts borrow addresses from a public pool. PAT (port address translation, "NAT overload"): many private hosts share one public IP, kept apart by unique source port numbers. PAT is what home routers and most offices do.

PAT table on WH-EDGE (public 203.0.113.20)
Inside local        Inside global
10.20.0.15:51544 -> 203.0.113.20:1024
10.20.0.88:51544 -> 203.0.113.20:1025
10.20.0.130:6211 -> 203.0.113.20:1026
Port address translation. Three inside hosts, 10.20.0.15, 10.20.0.88 and 10.20.0.130, send traffic out through the edge router, which has one public address, 203.0.113.20. The router gives each conversation its own source port on the public side, 1024, 1025 and 1026, and keeps a table so replies go back to the right host.
PAT: many inside hosts share one public IP, kept apart by port numbers.

Exam tip Many hosts, one public IP, different ports = PAT. Web server needs a fixed public IP = static NAT.

FHRP and the virtual IP

Hosts have one default gateway. If that router dies, they are stranded. A First Hop Redundancy Protocol (FHRP) lets two or more routers share a virtual IP (VIP) and virtual MAC. Hosts use the VIP as their gateway; one router is active, another standby, and the standby takes over in seconds if the active fails. Protocols: HSRP (Cisco), VRRP (open standard), GLBP (Cisco, also load-balances).

Hosts gateway: 10.20.0.1 (VIP)
  WH-R1 10.20.0.2  priority 110  ACTIVE
  WH-R2 10.20.0.3  priority 100  STANDBY
First hop redundancy. Hosts use 10.20.0.1 as their default gateway, but that is a virtual IP shared by two routers. WH-R1, 10.20.0.2 with priority 110, is active and answers for the VIP; WH-R2, 10.20.0.3 with priority 100, is standby. If R1 fails, R2 takes over the VIP within seconds and hosts notice nothing.
Hosts point at the virtual IP; the standby router takes it over if the active one dies.

Exam tip Clients point to the VIP, never to a router's real address, or failover does not help them.

Subinterfaces (router on a stick)

A subinterface is a logical interface carved out of one physical interface. Connect one router port to a switch trunk, create one subinterface per VLAN, tag each with 802.1Q, and give it the gateway IP for that VLAN. The router now routes between VLANs over a single cable: "router on a stick". Cheap, but all inter-VLAN traffic shares one link.

interface Gi0/0.20
 encapsulation dot1Q 20
 ip address 10.20.0.1 255.255.255.128
interface Gi0/0.30
 encapsulation dot1Q 30
 ip address 10.20.0.129 255.255.255.192
Router on a stick. One router port connects by a single 802.1Q trunk cable to a switch. On the router that port is split into subinterfaces: Gi0/0.20 tagged for VLAN 20 with gateway 10.20.0.1, and Gi0/0.30 tagged for VLAN 30 with gateway 10.20.0.129. Hosts in VLAN 20 and VLAN 30 send traffic up the trunk, the router routes it between the subinterfaces, and it comes back down the same cable.
One cable, one subinterface per VLAN: the router routes between VLANs.

Exam tip Subinterface number (.20) is just a label; the dot1Q VLAN ID is what must match the switch.

Objective 2.2

VLANs, SVIs and trunks

VLANs and the VLAN database

A VLAN splits one physical switch into separate logical networks; each VLAN is its own broadcast domain and IP subnet. Moving traffic between VLANs needs a router or Layer 3 switch. VLAN IDs 1-4094 are usable (1 is the default VLAN; 1002-1005 reserved on Cisco). The switch keeps VLAN IDs and names in its VLAN database (vlan.dat on Cisco); a port cannot carry a VLAN that does not exist there.

vlan 20
 name FLOOR-SCANNERS
vlan 30
 name OFFICE
vlan 50
 name VOICE

Exam tip Assigning a port to VLAN 40 before VLAN 40 exists in the database leaves the port inactive.

Switch virtual interface (SVI)

An SVI is a virtual Layer 3 interface for a VLAN on a switch ("interface vlan 30"). On a Layer 3 switch, the SVI IP becomes the default gateway for that VLAN and the switch routes between VLANs at wire speed: faster than router on a stick. On a Layer 2 switch, one SVI is usually just the management IP.

ip routing
interface vlan 30
 ip address 10.20.0.129 255.255.255.192
 no shutdown

Exam tip An SVI is up/up only if the VLAN exists and at least one port in that VLAN is up.

Access ports, trunks, 802.1Q and the native VLAN

An access port belongs to one VLAN and sends untagged frames to the device. A trunk carries many VLANs between switches (or to a router or AP). 802.1Q tagging inserts a 4-byte tag with a 12-bit VLAN ID into each frame on the trunk. Frames in the native VLAN cross the trunk untagged. Both ends must agree on the native VLAN, or traffic leaks between VLANs and you see mismatch errors.

interface Gi1/0/48
 switchport mode trunk
 switchport trunk native vlan 999
 switchport trunk allowed vlan 20,30,40,50
Two switches joined by a trunk link that carries VLANs 20 and 30. Access ports send untagged frames to the PCs. On the trunk, each frame gets a 4-byte 802.1Q tag holding a 12-bit VLAN ID, inserted after the source MAC address; frames in the native VLAN cross the trunk untagged. Below, the tagged frame: destination MAC, source MAC, 802.1Q tag, type, data, FCS.
Trunks tag frames with 802.1Q; the native VLAN goes untagged; access ports never tag.

Exam tip Security best practice: change the native VLAN from 1 to an unused VLAN and allow only needed VLANs on trunks.

Voice VLAN

A desk phone usually sits between the wall jack and the PC. A voice VLAN lets one access port carry two VLANs: the phone tags its voice traffic with the voice VLAN (learned via CDP/LLDP), and the PC plugged into the phone sends untagged data VLAN traffic. Voice is kept separate so QoS can prioritize it.

interface Gi1/0/10
 switchport mode access
 switchport access vlan 30
 switchport voice vlan 50

Exam tip Port with an IP phone and a PC behind it: access VLAN for the PC, voice VLAN for the phone. Not a full trunk.

Objective 2.2

Interfaces, spanning tree and MTU

Link aggregation

Link aggregation bundles several physical links into one logical link (port channel / EtherChannel): more bandwidth and redundancy, and spanning tree sees it as one link so nothing gets blocked. LACP (IEEE 802.3ad, now 802.1AX) negotiates the bundle. All member ports must match: speed, duplex, VLANs and trunk settings.

Exam tip Two 10G uplinks to the warehouse distribution switch in one LACP bundle = 20G and survives a single link failure.

Speed and duplex

Each port has a speed (10/100/1000/10G) and duplex: full duplex sends and receives at once; half duplex takes turns and can collide. Leave both ends on auto-negotiation or hard-code both ends the same. A duplex mismatch (one full, one half) still links up, but is painfully slow: the half-duplex side logs late collisions and the full side logs CRC/runt errors.

Exam tip Hard-coding one side and leaving the other on auto often causes a duplex mismatch: the auto side falls back to half duplex.

Spanning tree (STP)

Redundant switch links create Layer 2 loops: broadcasts circle forever (broadcast storm) and MAC tables flap. Spanning tree (802.1D; Rapid STP 802.1w) blocks redundant paths. Switches elect a root bridge (lowest bridge ID = priority, default 32768, then lowest MAC). Each switch picks a root port (best path to root); each segment gets a designated port; the rest are blocked, ready to take over if a link fails.

802.1D port states:
  blocking -> listening -> learning
  -> forwarding  (plus disabled)
RSTP: discarding, learning, forwarding

spanning-tree vlan 20,30 priority 4096
  ! make this switch the root
Three switches wired in a triangle, which would make a layer 2 loop. Spanning tree elects the root bridge, the switch with the lowest bridge ID (priority 4096 here). Each other switch picks its root port (RP), its best path to the root. Each link gets a designated port (DP). One port on the link between the two non-root switches is blocked, so the loop is broken; it will forward if another link fails.
STP elects a root, picks root and designated ports, and blocks one port to break the loop.

Exam tip Set the root bridge on purpose (low priority on the core/distribution switch). Use PortFast + BPDU guard on access ports.

MTU and jumbo frames

The MTU (maximum transmission unit) is the largest payload a link carries in one frame: 1500 bytes by default on Ethernet. Jumbo frames (up to about 9000 bytes) cut overhead for storage (iSCSI), backups and VM migration. Every device on the path must support the same jumbo MTU; a mismatch causes drops or fragmentation, often seen as "small pings work, big transfers hang".

Exam tip Jumbo frames help SAN/iSCSI traffic inside the data center. They are not used across the internet.

Check yourself 1Two warehouse routers must share one default gateway address so hosts keep working if one router fails. What should be configured?

  1. A floating static route on each host
  2. PAT on both routers
  3. Subinterfaces for each VLAN
  4. An FHRP with a virtual IP
Show the answer

Answer: D. An FHRP with a virtual IP

An FHRP such as VRRP or HSRP gives the routers a shared virtual IP. Hosts use the VIP as their gateway, and the standby router takes over if the active one fails.

Check yourself 2A link between a switch and a server runs at 1 Gbps but transfers are very slow. The switch port shows many late collisions. What is the MOST likely cause?

  1. Duplex mismatch
  2. Native VLAN mismatch
  3. Spanning tree blocking
  4. MTU set to 1500
Show the answer

Answer: A. Duplex mismatch

Late collisions on a link that is up but slow are the classic sign of a duplex mismatch: the half-duplex side sees collisions caused by the full-duplex side.

Practice questions

Answer in your head, then open the answer. Ranger's Packet Trail has 483 questions like these for Network+, with mock exams.

Question 1A branch office has one router with a single WAN link back to headquarters, and no other paths exist. The admin wants the least CPU and bandwidth overhead. How should the branch router learn the way to the HQ networks?

  1. A static default route to the HQ router
  2. OSPF with the branch router in a stub area
  3. BGP peering with the HQ router
  4. EIGRP with a feasible successor
Show the answer

Answer: A. A static default route to the HQ router

A stub site with one exit needs only a static default route, which uses no routing-protocol traffic or CPU. A dynamic protocol such as OSPF adds overhead and gives no benefit when there is no alternate path.

Question 2A security-minded admin is deciding between static routes and a dynamic routing protocol for a small, stable network that rarely changes. Which of the following are advantages of static routing? Choose two.

  1. It scales easily to hundreds of routers
  2. New subnets are learned without any admin work
  3. No update traffic or extra CPU load on the routers
  4. The admin controls exactly which path each network uses
  5. Routes adjust automatically when a link fails
Show the answer

Answers: C. No update traffic or extra CPU load on the routers, D. The admin controls exactly which path each network uses

Static routes cost no protocol overhead and give predictable, admin-chosen paths, and no routing updates can be spoofed. They do not adapt to failures or new subnets on their own, which is the job of dynamic routing.

Question 3A company is getting a second internet connection from a different ISP and has its own public address block and autonomous system number. Which routing protocol will its edge router use to exchange routes with both ISPs?

  1. OSPF
  2. BGP
  3. EIGRP
  4. RIP
Show the answer

Answer: B. BGP

BGP is the exterior gateway protocol that exchanges routes between autonomous systems, such as an enterprise and its ISPs. OSPF and EIGRP are interior protocols used within a single organization.

Question 4A network team runs routers from three different vendors across 12 sites. They want an open-standard protocol that floods link-state updates, builds a full topology map and can be divided into areas around a backbone area 0. Which protocol fits?

  1. RIPv2
  2. EIGRP
  3. BGP
  4. OSPF
Show the answer

Answer: D. OSPF

OSPF is an open-standard link-state protocol that uses areas, with area 0 as the backbone, and runs on most vendors' routers. EIGRP is Cisco-originated and distance-vector based, so it is the tempting but wrong pick.

Question 5An admin wants OSPF to prefer the 10 Gbps fiber link between two sites over a 1 Gbps backup link. Which value does OSPF compare to choose its best path?

  1. Cost, based on interface bandwidth
  2. A composite of bandwidth and delay values
  3. The length of the AS path
  4. Hop count to the destination
Show the answer

Answer: A. Cost, based on interface bandwidth

OSPF's metric is cost, calculated from reference bandwidth divided by interface bandwidth, so faster links get a lower cost. A bandwidth-and-delay composite describes EIGRP.

Practice it in Ranger's Packet TrailThe same lessons as a story, with drills, hands-on labs and mock exams. Free, in your browser.
Play free

CompTIA, A+, Network+, Security+ and Linux+ are trademarks of CompTIA, Inc. Ranger Gamez is not affiliated with or endorsed by CompTIA. The practice questions are written to the published exam objectives; they are not real exam questions.