Unit 3 Networking Field Guide
AP Cybersecurity, Days 41 to 45. A reference for the Networking Lab, the Hex Tutorial, and the Network Sandbox. Each section says when to use it. It explains each idea and shows a worked example, and it never gives away your answers.
1. What a network is
Use this on Day 1, and any time you mix up a switch and a router.
| Word | Meaning |
|---|---|
| LAN | Local area network. One room, building, or home. |
| WAN | Wide area network. Cities or the world. The internet is the biggest WAN. |
| Packet | A small chunk of data with a source address, a destination address, and part of the message. |
| Switch | Joins the devices inside one LAN and sends each message only to the device it is meant for. |
| Router | Joins different networks and forwards each packet toward its destination. |
| Access point | Lets wireless devices join the LAN. |
| ISP | The internet service provider. Your router connects to it, and it connects to other providers. |
Layouts. Star: everything connects to one central switch. Bus: one shared cable. Ring: each device connects to two neighbors in a loop. Mesh: many direct links, so traffic can go around a failure.
In the sandbox: a computer's gateway is the address of the router on its own LAN. It is where the computer sends anything that is not on its own LAN.
↑ top of section2. IP addresses and MAC addresses
Use this on Day 2, and whenever the sandbox complains about an address.
An IPv4 address is four numbers from 0 to 255 separated by dots, like 192.168.1.23. It changes when a device joins a different network. A MAC address is six bytes in hex, like 3C:22:FB:9A:10:5E, built into the network card. The first three bytes name the manufacturer.
| Private ranges (only work inside one local network) |
|---|
10.0.0.0 to 10.255.255.255 |
172.16.0.0 to 172.31.255.255 (172.15 and 172.32 are public) |
192.168.0.0 to 192.168.255.255 (192.169 is public) |
172.20.4.9 private? It starts with 172, and 20 is between 16 and 31, so yes. Is 172.40.4.9 private? 40 is outside 16 to 31, so no, it is public. A valid address needs exactly four parts, and each part must be 0 to 255.The rule the sandbox uses
Everything on one LAN shares the first three numbers (the network part) and has a different last number. For example, 192.168.1.10 and 192.168.1.11 are on the same LAN. 192.168.1.10 and 192.168.2.10 are not, so they need a router between them. Every address must be unique.
3. Bits, bytes, and hexadecimal
Use this on Day 3, in the Hex Tutorial, and any time you read a hex dump.
A bit is a 0 or a 1. A byte is 8 bits. Each place is worth double the one to its right: 128, 64, 32, 16, 8, 4, 2, 1. Add up the places that hold a 1.
0100 1101 has 1s in the 64, 8, 4, and 1 places. 64 + 8 + 4 + 1 = 77.Hex is base 16: the digits 0 to 9 and the letters A to F. One hex digit stands for 4 bits, so two digits make one byte.
| A | B | C | D | E | F |
|---|---|---|---|---|---|
| 10 | 11 | 12 | 13 | 14 | 15 |
2F: the left digit is worth 16 each, so 2 × 16 = 32. The right digit is F = 15. 32 + 15 = 47.Decimal to hex. 200 ÷ 16 = 12 with 8 left over. 12 is C, so 200 is
C8.41 (65), B = 42, C = 43. So 42 4F 4F is B, O, O: BOO.4. The TCP/IP model and packet headers
Use this on Day 3, and whenever you open a packet in the sandbox.
| Layer | What lives here |
|---|---|
| Application | HTTP, HTTPS, DNS, SSH, FTP |
| Transport | TCP and UDP (ports) |
| Internet | IP addresses, routers |
| Network access | Ethernet, Wi-Fi, MAC addresses, switches |
Each layer adds its own header in front of the data. A packet in the sandbox is a stack: Ethernet, then IPv4, then TCP or UDP, then the data.
Ethernet header (14 bytes)
| Bytes | Field |
|---|---|
| 0 to 5 | Destination MAC (FF:FF:FF:FF:FF:FF means every device on the LAN) |
| 6 to 11 | Source MAC |
| 12 to 13 | Type: 08 00 IPv4, 08 06 ARP, 86 DD IPv6 |
IPv4 header (20 bytes, starts after the Ethernet header)
| Byte | Field |
|---|---|
| 0 | Version and length. 45 means IPv4, 20 bytes |
| 2 to 3 | Total length |
| 8 | TTL: hops left. Each router subtracts 1 |
| 9 | Protocol: 06 TCP, 11 UDP |
| 10 to 11 | Header checksum (changes when the TTL changes) |
| 12 to 15 | Source IP |
| 16 to 19 | Destination IP |
UDP header (8 bytes) and TCP header (20 bytes)
| UDP byte | Field | TCP byte | Field |
|---|---|---|---|
| 0 to 1 | Source port | 0 to 1 | Source port |
| 2 to 3 | Destination port | 2 to 3 | Destination port |
| 4 to 5 | Length | 4 to 7 | Sequence number |
| 6 to 7 | Checksum | 8 to 11 | Acknowledgment number |
| 13 | Flags: 02 SYN, 10 ACK, 18 PSH+ACK, 01 FIN, 04 RST | ||
| 16 to 17 | Checksum |
00 11 22 33 44 55 AA BB CC DD EE FF 08 06: the destination is 00:11:22:33:44:55, the source is AA:BB:CC:DD:EE:FF, and 08 06 means an ARP message follows.In an IP header,
C0 A8 01 0A in the source field is 192.168.1.10, because C0 = 192, A8 = 168, 01 = 1, and 0A = 10.5. Ports, protocols, and firewall rules
Use this on Day 4, whenever a packet is refused or blocked, and when you write firewall rules.
| Service | Port | Cleartext? |
|---|---|---|
| HTTP | 80 | Yes |
| HTTPS | 443 | No, encrypted |
| FTP | 21 (control) | Yes |
| SSH | 22 | No, encrypted |
| Telnet | 23 | Yes |
| DNS | 53 | (not asked in the lab) |
| SMTP | 25 | (not asked in the lab) |
A server only answers on ports it is listening on. TCP port 443 and UDP port 443 are different doors, so the protocol has to match too.
A firewall rule allows or denies traffic. The firewall checks its rules from the top, and the first rule that matches decides. A rule for any matches every packet, so put it last. A firewall only sees packets that cross it, so computers inside the LAN can still reach each other.
1. allow port 443 2. deny port 80 3. allow any
6. Reading a result in the Network Sandbox
Use this whenever you press Send and want to know what happened and why.
| Result | What it means | What to look at |
|---|---|---|
| Delivered | The server was reached and is listening on that port. | Open each frame and compare the MAC addresses and TTL. |
| Blocked by a firewall | A router dropped it. The message names the router and the rule. | That router's rule list. Order matters. |
| Refused | The server was reached, but nothing listens on that port and protocol. TCP answers with a reset (RST), UDP with an ICMP "port unreachable". | The server's ports panel. |
| No route | The packet had nowhere to go: a missing gateway, a gateway that is not a router on the LAN, or no cable path. | Section 8, the checklist. |
| Cannot send yet | A computer has no valid IP address. | The device's settings panel. |
What changes from step to step
| Stays the same | Changes at every router |
|---|---|
| Source and destination IP, the ports, the data | Source and destination MAC, the TTL (down by 1), and the IP header checksum |
Cleartext or encrypted? On ports 80, 21, and UDP the data bytes are readable text. On ports 443 and 22 they look scrambled. That is exactly what someone capturing the packet would see.
↑ top of section7. TCP, UDP, FTP, and sending files
Use this on Day 4 and Day 5, and before you use Send a file.
| UDP | TCP | |
|---|---|---|
| Setup | None. It just sends. | Three-way handshake: SYN, SYN-ACK, ACK. |
| Lost packets | Gone for good. Nobody asks for them again. | Numbered and acknowledged. A missing one is sent again. |
| Speed | Fastest, with no waiting. | Slower, because of handshakes and resends. |
| Used for | Video streams, voice calls, DNS, games. | Web pages, email, file transfer. |
FTP
FTP is not a transport protocol. It runs on TCP. It uses a control connection on port 21 for commands and a separate data connection for the file. In the sandbox it uses passive mode: the server tells the client a high data port (50000). Your cheat sheet lists FTP as 20/21, which is the older active mode. The login and every command cross the network as cleartext, including the password.
425 Cannot open data connection.Reading the file transfer results
| Line | What it tells you |
|---|---|
| Packets needed | The file size divided by what one packet can carry, rounded up. |
| Lost for good (UDP) / Lost, then sent again (FTP) | How many packets disappeared on the noisy cables. |
| Fingerprint sent and received | A CRC32 checksum of the whole file. If they match, the file is exactly right. If not, it is damaged. |
| Time (ticks) | A simplified clock. TCP pays extra ticks for handshakes and for waiting to resend. |
Bigger files lose more. Every packet has the same chance of being lost, so a 50 MB file (tens of thousands of packets) almost always loses some. Even 1% loss damages a UDP file that big.
↑ top of section8. If something is not working: a checklist
Use this when the Network check panel lists a problem, or a packet says No route or Refused.
| You see | Try this |
|---|---|
| "has no IP address yet" | Click the device and type an address. Computers on one LAN share the first three numbers. |
| "different network parts" | Find the one device whose first three numbers do not match the rest of its LAN, and fix it. |
| "Two devices use the IP address" | Give one of them a new last number. Every address must be unique. |
| "gateway ... is not on its own network" or "is not a router on this LAN" | A gateway is the address of the router on the same LAN. Click the router, find its address for that LAN, and use it. |
| "has no gateway set" | Type the router's address for that LAN into the Gateway box. |
| "is not connected" or "fewer than two connections" | Use the Cable tool to connect it. |
| No route | Check, in order: the sender's gateway, the cables between every router and the provider, and the destination's address. |
| Refused | Click the server and look at its ports. Is the right port open, and is it the right protocol (TCP or UDP)? |
| Blocked | Click the router the message names and read its rules from the top. Which one matched first? |
| The transfer could not start | Read the explanation. Control port 21 blocked means it never connects. Data port 50000 blocked means you can log in, but the file cannot move. |
Back to the Networking Lab, the Hex Tutorial, or the Network Sandbox.
↑ top of section