Chapter 2: The OSI Model and TCP/IP Model
Common Mistakes I See Students Make
Friends, I see these OSI mistakes in every batch. Read them once and keep them in mind, so there is no confusion in the interview.
मित्रांनो, OSI च्या या चुका मी प्रत्येक बॅचमध्ये बघतो. एकदा वाचून ठेवा, म्हणजे इंटरव्ह्यूमध्ये गोंधळ होणार नाही.
दोस्तों, OSI की ये गलतियाँ मैं हर बैच में देखता हूँ. एक बार पढ़कर रखो, ताकि इंटरव्यू में कन्फ़्यूज़न न हो.
- Mixing up the order of layers or placing TCP at the network layer. Use the mnemonic and practise drawing it.
- Saying "a switch works at Layer 3". A normal switch works at Layer 2 (MAC addresses); a router works at Layer 3 (IP).
- Thinking HTTPS is a different layer from HTTP. HTTPS uses HTTP over a protected connection. Identify the actual transport and TLS setup.
- Forgetting DNS in the website walk-through. Without DNS, the browser does not even know which IP to connect to.
- Assuming ping failure means the server is down. ICMP may simply be blocked by the security group.
Why these mistakes happen, and how to fix each one
The list above is short. Let us take each mistake, see it with a real example, and learn the fix you can say in an interview.
Mistake 1: wrong layer order, or TCP at the network layer
TCP lives at Layer 4, Transport. IP lives at Layer 3, Network. A simple way to remember: IP gets the packet to the right computer. TCP gets the data to the right program on that computer, using a port number.
Everyday analogy. An address on a letter (city, street, building) is like IP. "Flat 302, attention Mr Patil" is like the port. Both are needed.
A mnemonic from Layer 1 up: "Please Do Not Throw Sausage Pizza Away" = Physical, Data link, Network, Transport, Session, Presentation, Application.
Mistake 2: "a switch works at Layer 3"
A normal switch forwards frames using MAC addresses, so it works at Layer 2. A router forwards packets using IP addresses, so it works at Layer 3. "Layer 3 switches" do exist in enterprise networks. They are switches with routing built in. In an interview, say: "A basic switch is Layer 2. Some enterprise switches also route at Layer 3."
Indian company example. Suppose we are a junior network engineer at TCS, setting up a new floor. Every desk cable goes into an access switch (Layer 2). The floor switches connect to a core device that routes between the office network and the data-centre network (Layer 3).
Mistake 3: "HTTPS is a different layer from HTTP"
HTTPS uses HTTP over a protected connection. HTTP/1.1 and HTTP/2 can use TLS over TCP. HTTP/3 uses QUIC over UDP with integrated TLS security. HTTPS ordinarily uses port 443, and HTTP ordinarily uses port 80.
Global app example. Open any site in Chrome and click the site-information icon in the address bar. It shows that the connection is secure and lets you view the certificate. That certificate is what the TLS layer checks. The endpoint reads HTTP messages after decrypting the protected exchange.
Mistake 4: forgetting DNS in the "what happens when I type a URL" answer
A fresh connection to a named service needs address information. A client can reuse a cached address or an existing connection. Classic DNS supports UDP and TCP on port 53. The output below is a simulated example rather than a live DNS value.
$ nslookup APPROVED_LAB_HOST
Name: portal.training.example
Address: 192.0.2.40 (simulated documentation address)
For a fresh HTTPS connection over TCP, explain the name resolution you need, TCP and TLS setup, HTTP request and response, then rendering. Cached data and HTTP/3 can change the observed stages.
Mistake 5: "ping fails, so the server is down"
Ping uses ICMP, a Layer 3 protocol. On AWS, a security group allows only what you add, and most people add SSH (22) and HTTP/HTTPS (80/443), but not ICMP. So the website can be perfectly fine while ping times out.
What you would see:
$ ping 13.234.x.x
Request timeout for icmp_seq 0
$ curl -I http://13.234.x.x
HTTP/1.1 200 OK
The fix: test the actual service with curl, or use nc -zv host 443 to test a port. Only allow ICMP in the security group if you really need it.
Try it yourself
- For a hostname in your approved test scope, use
nslookupto record the address and queried resolver. - Use the intended method, hostname and route in the local HTTP fixture below. Record the status and a harmless body marker.
- Draw the seven OSI responsibilities, then describe who interprets DNS, TCP, IP, TLS and HTTP in the example.
Common services, their ports and their layers
Interviewers love asking "which port, which layer?" for real software. Several examples below use TCP, while DNS can use UDP and TCP. Verify the actual service configuration instead of assuming that a default port identifies every protocol decision.
nginx / Apache httpd
Web servers. HTTP uses port 80 and HTTPS uses 443. Check what is listening:
sudo ss -tlnp | grep -E ":80|:443"What you see:
LISTEN 0 511 0.0.0.0:80 users:(("nginx",pid=812))Tomcat
Java application server. The default HTTP connector is 8080. Usually nginx or Apache sits in front on 80/443.
curl -I http://localhost:8080What you see:
HTTP/1.1 200MySQL
Database on port 3306. It should be reachable only from the app server, never from 0.0.0.0/0.
nc -zv 10.0.2.20 3306What you see:
Connection to 10.0.2.20 3306 port [tcp/mysql] succeeded!PostgreSQL
Database on port 5432.
pg_isready -h 10.0.2.21What you see:
10.0.2.21:5432 - accepting connectionsMongoDB
Document database on port 27017.
mongosh "mongodb://10.0.2.22:27017" --eval "db.runCommand({ping:1})"What you see:
{ ok: 1 }Redis
In-memory store on port 6379.
redis-cli -h 10.0.2.23 PINGWhat you see:
PONGApp frameworks: Spring Boot, ASP.NET Core, Node.js/Express, Flask/Django, Go, PHP-FPM, Rails
Common development defaults: Spring Boot 8080, ASP.NET Core 5000/5001 (newer templates often pick random ports), Express examples 3000, Flask 5000, Django 8000, Go apps often 8080, PHP-FPM 9000 (FastCGI), Rails 3000. In production these sit behind nginx or a load balancer.
DNS and SSH
Classic DNS can use UDP or TCP on port 53. SSH commonly uses TCP port 22.
dig +short APPROVED_LAB_HOSTIllustrative output:
192.0.2.40Summary
| Software | Port | Layer 7 protocol |
|---|---|---|
| nginx/Apache | 80 / 443 | HTTP / HTTPS |
| Tomcat | 8080 | HTTP |
| MySQL | 3306 | MySQL protocol |
| PostgreSQL | 5432 | PostgreSQL protocol |
| MongoDB | 27017 | MongoDB wire protocol |
| Redis | 6379 | RESP |
| DNS | 53 | DNS |
| SSH | 22 | SSH |
More real examples
Indian company example (sample data). Suppose we are a junior engineer at an IRCTC-style booking site on AWS. The security group for the web tier allows 443 from anywhere. The database tier allows 3306 only from the web tier's security group. A student who "fixes" a connection problem by opening 3306 to 0.0.0.0/0 has created a serious risk. The right fix is to check the source security group.
Global example. Internet-wide scans regularly find thousands of MongoDB, Redis and Elasticsearch servers exposed with no password. Many data leaks reported in the news started exactly this way.
Everyday analogy. A building (the IP address) has many doors with numbers (ports). The reception (443) is open to visitors. The server room (3306) should open only for staff with a badge.
Recap
- IP is Layer 3. TCP and UDP are Layer 4. HTTP is Layer 7. TLS wraps HTTP.
- A basic switch is Layer 2. A router is Layer 3.
- The client resolves a name when it needs an address. Test the intended service separately from ICMP reachability.
Correct the observation before you correct the system
A student reports that the online timetable is down. The support engineer can open it from an office computer. Another learner can see the page title but the list of classes never appears. All three reports matter. They measure different things, perhaps from different networks, at different times or with different application requests. A beginner can save time by first identifying the exact observation and the test that produced it. The reference model gives useful words for that step.
Start a small record. Write the user or lab device, source network, intended URL, time and exact error. Check that the person did not report a different resource such as a script or an API request behind the page. Include the address and transport port if you have verified them. If you have none of those values, ask for the safe parts of the request before making an infrastructure change. This exercise is about identifying which inference failed. It will help you discuss a mistake without blaming the person who noticed it.
Return to the familiar diagnoses below with one rule in mind. An observed result has limits. A DNS answer, a local route decision, a TCP connection and a visible HTTP response provide different evidence. Learn to write one sentence for the result and one sentence for the next question. The first sentence should be something another person could reproduce or inspect. The second should identify a missing observation rather than ask someone to change everything at once.
Mixing up an IP address, port and resource path
An IP address helps network devices forward packets toward a destination. A transport port helps the receiving host decide which endpoint gets the conversation. An application path helps the program choose the requested resource. Students sometimes say “the IP was working” when they have only seen an HTTP result from one port and resource. State the actual successful test. On the same IP, another port can have no listener, and another route in the same application can legitimately return 404.
Use a fictional lab host at 192.0.2.10 for a paper exercise. The exercise says its web program listens on port 8080 and exports /schedule. Its database listens privately on a different interface under the lab design. Draw three requests. One uses the correct port and path, one uses a different port, and one uses the correct port but a missing path. The first can return the schedule, the second can fail to connect, and the third can get a missing-resource response from the application. A result for one request cannot establish all three.
The usual examples such as 22 for SSH, 443 for HTTPS, or 3306 for MySQL are service conventions or defaults. Programs can be configured to use other ports. On a lab host, first check which program owns the listener and the address it binds. Check the protocol the configured service actually speaks rather than using a port number as proof. A successfully established TCP socket shows that an endpoint accepted the connection. It still needs further service evidence before a database query or web page is declared healthy.
Teach the distinction in your own words. If an interviewer asks which layer provides routing, say that ordinary IP forwarding makes a decision based on the network destination. If they ask how a host chooses among applications, describe the transport and application identifiers appropriate to the case. When explaining the course page, point to the selected TCP listener and the GET request to the intended route. Each answer adds information instead of replacing the earlier one.
Using the device's label as proof of its forwarding job
Ordinary Ethernet switching uses link information. A basic switch learns where link addresses appeared and can forward frames toward those destinations on the same local network. Routing involves an IP packet and its destination and can carry the packet between networks. A modern device may contain both kinds of capability. A label on the chassis or inventory list has limited value. Ask what the particular interface and configuration do for the request you are following.
Try one small topology. A workstation shares a local Ethernet network with another workstation and one router interface. The second workstation is in the same destination prefix according to the chosen route. The sender needs a suitable link address for that local peer. Now move the destination to a different routed subnet. The next hop might become the router's local interface. The frame is sent there on the first link, while the packet still names the distant IP destination. Draw separate link and network values on each connection.
If you read Linux ip route get and ip neigh, they expose two useful but different observations. A route report tells you a chosen link or gateway for the destination under the current routing state. A neighbour report can show local link information the host has learned. In a practice network you can decide if a missing neighbour entry warrants another observation. Cache state can change, and the commands alone do not prove a remote application succeeded. Always involve the intended local interface and approved destination.
Explain a Layer 3 switch precisely. It can perform local frame switching in some situations and route between networks when configured to do so. A student who memorises “all switches equal Layer 2” can give the right answer to one beginner example and a wrong answer about the next device. In interviews, distinguish the function from the hardware. Give the example of a local frame inside a subnet and a packet forwarded between subnets.
Treating one DNS answer as a full service test
A DNS query and a web request are separate application operations. A DNS answer can tell you that a name maps to one or more addresses under the resolver and record type you queried. It does not check that the service accepts connections or that the desired resource exists. If a client has a reusable name result or established connection, the browser might not need another visible DNS lookup for the next request. Mention name resolution as needed in a fresh visit, not as a mandatory network event for every resource.
Try this finding on paper. The office resolver returns the new address and the browser works. A learner off-site uses another resolver and reports an old answer for the same name. Check the resolver source, record type and timing before changing the origin application. A cached answer can be reused for its allowed lifetime. A client may also use encrypted DNS or a proxy whose behavior differs from the command you tested. Compare with the environment that actually supplied the failing request.
There is also a useful distinction between a name being reported absent and a name existing without the address record you wanted. A lookup can yield different outcomes depending on the name, requested type and server response. An IPv4-only check will not reveal which IPv6 address the browser used in a later attempt. If the browser connected to a different result than the one on your worksheet, rerun the comparison with the actual destination identified from the client's test evidence.
Use a known fixture when testing a suspicion about application routing. Giving curl an explicit address for one lab host and port lets you preserve the intended name while isolating ordinary resolver behavior. Its output cannot prove that a normal lookup would find that address. It does help you decide whether the endpoint answers the name you intended. Keep the request exact and use normal TLS checks for HTTPS. A hurried raw-IP browser visit can introduce a different host identity and hide what you intended to compare.
Making a health claim from a missing ping reply
Ping usually uses ICMP Echo request and reply messages. It is useful for measuring a particular kind of network response. That is different from testing an approved TCP listener or a web application route. A policy can block ICMP while allowing HTTPS. A host may respond to ICMP while the intended web listener is stopped. Whether a practice environment needs ICMP is a design choice. Keep the application goal in view before changing it.
Read the original complaint again. One learner gets an expected web response, and another gets no ping response. Those two observations do not conflict unless the assignment defined the same protocol test under the same path. Ask whether the second learner can reach the exact authorised website. If the named HTTPS request returns the right result, the student has tested the serving path from that device regardless of the ICMP result. If that request fails before connecting, inspect approved routing, filters and the listener rather than assuming the ICMP cause is the same.
Reverse the evidence. An ICMP reply comes back, but the TCP connection to port 443 is rejected. A host or intermediary that responds to ICMP has given you a sign of some reachability. It does not make an application listener exist. The next useful evidence might be a local listener list or an approved health test. Modify only the rule or service shown to differ from the intended design. Do not open unrelated protocols to reduce the number of error messages in a lab.
Confusing encryption, service identity and application success
HTTPS uses HTTP semantics over a protected connection. In the usual TCP-based browser case, TLS protects the HTTP exchange. An HTTP/3 path uses QUIC with TLS security integrated into establishment. The secure connection does not move the HTTP request into a different application protocol layer. It adds important behavior for identity and protection. Explain which protocol and endpoint handle those decisions instead of assigning all encryption to one fixed layer number.
Suppose the HTTP version of a practice name returns the expected document. The HTTPS version reaches a listener but fails certificate validation. You have verified that one exchange can reach a serving process. The secure exchange added an identity check, and that check did not accept the peer it saw. Investigate the exact name, expected certificate, chain and selected destination. Looking at the service configuration is safer evidence than weakening the client's verification. If the wrong name is in the address bar, a trusted certificate for the intended name can still produce a failure.
A second common mistake is to test by raw IP and conclude that a named virtual host does not work. The connection address can be the same while the expected identity and reported request host differ. Choose an approved request-specific address mapping to preserve the intended hostname when you need this isolation. Such a test bypasses the particular DNS lookup for that invocation. It can confirm a later transport, trust and routing path without making a claim about what every user's resolver would see. State that limit in the result.
Across a proxy, the public certificate can be entirely correct even if the private origin has a different certificate or no protected connection under the chosen configuration. Inspect each boundary and choose its required protection. An HTTPS address in a browser proves only the client-side connection's result. It does not testify about other legs. Use distinct arrows for browser-to-edge and edge-to-origin when discussing a CDN or load balancer deployment.
Reading the wrong HTTP request or the wrong response
Students often compare a browser navigation with a terminal request and assume the terminal command asked the same question. Check the method, name, path and connection details first. For example, curl's -I requests HEAD. A standard service can use HEAD to return headers without the regular body, but an application route may only have been set up for GET. In that case a HEAD result can differ from the browser's request even on the same address and port. Use the intended method when confirming the actual route.
Saving one status number is usually too little. A 200 can come from another environment's default page if the host or path does not match. It can report a form page while an API returns the failure that the user means. A 404 can be an intentional response from the intended program or an error issued by a front component that never contacted the program. A 502 in a proxy design can mean it had difficulty reaching or using an upstream, but you still need evidence from the observed proxy. Look at the harmless response marker, the exact stage and an authorised request log.
Try a classroom comparison with two IP addresses belonging to approved test paths. Both return 200 for the same host and path, but one body says “course list version A” and the other says “default page.” The application result is different even though the status and URL were similar. Trace the named route and expected response using both addresses. If one endpoint belongs to a different service, keep the scope narrow and stop sending requests until you can identify it. The test should verify the intended deployment, not discover unrelated endpoints.
Consider a page whose HTML loads, then an image returns missing and a later application request is denied. The browser's network panel can show three distinct resource rows. The HTML is one evidence point. The missing image could have a case-sensitive path error, and the denied API request could require app authentication. Record each request outcome separately. Do not widen a firewall because an HTTP denial already returned unless evidence identifies a separate network rule that violates the intended design.
Testing localhost and assuming a different machine was tested
The name localhost ordinarily refers to the current machine's loopback interface. A command entered into an SSH session runs on the remote server. In that session, a request to loopback stays on that server. A command entered into your original terminal without SSH runs on your laptop. Its loopback request stays on the laptop. Students can copy exactly the same command into these two shells and honestly get different results. First verify the hostname and execution context of the shell.
Now consider an application that binds only to loopback on an EC2 instance. A local test on that instance can work while a load balancer or separate client cannot reach that port through the instance's network interface. This does not automatically mean a subnet owner should change a route. Compare the listener's bind address with the intended entry point. Some designs deliberately keep that application local and let a reverse proxy on the same host make the connection. Other designs require the application to listen on a private interface accessible to an approved load balancer.
For a read-only check on Linux, inspect the local listening addresses and port with ss -ltn. Match the listing to the exact shell, expected process and address family. A result showing an address and port does not identify which web resource that program offers. Follow it with a safe application request from the intended source or a specific approved intermediary. Avoid treating all-listen settings as an automatic fix. A listener bound broadly may be undesirable under the intended plan.
Write three lines for a proper handoff. “The local check ran on the backend and obtained the expected application response on loopback. The approved frontend check did not connect to the backend's private interface. The next check is the process binding and intended frontend reachability.” That explanation teaches the difference between proving the app runs somewhere and proving the right path reaches it. It also avoids adding wide public rules as a test substitute.
Misreading AWS reachability and return rules
An EC2 instance can report healthy system status while its application listener is absent. A public IPv4 address can appear in the console without the complete internet route or permitted access path. A private service can be designed to accept connections only from its load balancer. Each observation says something different. Start by writing the approved source, named frontend and expected backend role. Draw the path, including route tables, gateways, traffic permissions and instance listener. Then place each observed result on that drawing.
Review security groups and subnet ACLs independently. A security group is associated with resources and performs stateful tracking under the documented behavior. A network ACL applies to a subnet and evaluates the relevant direction without flow state. Both can look at applicable protocol and port fields. In a request to port 443, the response can target the client's original temporary port. If a student copies 443 into every direction of a return-rule exercise, point to the destination value in the reply. A target-side transport leg created by a load balancer has its own endpoint values to examine.
Imagine a backend on a private subnet that needs outbound updates. It succeeds through the deliberately configured NAT path. A direct outside connection to the backend fails. These can both match the intended design. A NAT gateway provides a path for suitable outbound connections and replies. Its ability to carry those replies does not make the private host an internet-accessible server. Verify the intentionally public entry point, keeping private access restricted to the defined source.
Do not widen source ranges merely to see whether a port could respond. Suppose a web server needs database access, and a direct test from an unrelated machine fails. That result can be correct. Test from the authorised application path and confirm the intended source security group and database listener. A broad public rule can allow the unrelated machine and hide the layout issue you were trying to understand. If an authorised policy change is made, verify successful intended traffic and a denied unrelated path from appropriate lab sources.
Repair reports that cannot yet support a decision
Replace phrases such as “the server is down” with evidence. Note that your approved client connected to port 8443, passed peer verification, and received a 404 for one exact URL. If the correct page is on another path, that explains the application result without assuming any network change. If the response came from the wrong site, the next comparison may be the request name and routing condition. Keep the diagnosis tentative until a controlled change or an authoritative observation distinguishes the possibilities.
Use two short metrics in your notes. “Reached the intended HTTP responder” identifies a successful protocol exchange. “Got the expected timetable revision” identifies the application outcome. A ready frontend with a failing backend can satisfy the first in some contexts and fail the second. Checking them separately is especially helpful when a website uses caches, load balancers or backend APIs. Ask the service owner which response flag or content marker is appropriate for the second check.
Reproduce a case with one changed variable. Keep the server, route and name fixed while making an approved GET to a known path and a deliberately absent path. Keep the scheme, path and port fixed while testing the intended and wrong host against a local name-aware fixture. You can then show which change explains the new result. Simultaneously changing network, method and host creates a result that looks useful but offers too little isolation.
Interpreting a missing hop as a complete route failure
A trace tool often discovers intermediate devices by sending probes that expire after a chosen number of hops. A device may send a control reply when it discards such a probe. The tool can display a missing reply for a hop even while packets continue to later devices. Some devices do not send a reply for those probes, restrict how often they reply, or carry the two test protocols along different paths. A missing intermediate reply is an observation about that probe and its response, not proof that the route stops there.
Illustrate this with a paper trace where the first hop replies, the second shows stars, and the third and final destination reply. It would be inconsistent to claim that every packet stopped at the second hop in that run. Your explanation should be “the probe did not obtain the second hop's visible reply, while later probes obtained responses.” If a real lab has a single missed target and later application traffic also fails, you still need to check the intended protocol and path. An administrator can compare the network design with appropriate authorised tools.
The web response remains the desired service outcome. Trace results can inform an investigation, while an approved TCP or HTTP check from the intended source adds more specific evidence. Do not use a route trace through someone else’s network to infer the health of its private systems. Practise with a supplied fixture or with a network that the instructor has designated for this purpose. A diagram of the intended path remains valuable if you cannot directly observe the intermediaries.
Looking at a correct listener in the wrong network context
A container, virtual machine or separate lab shell may have its own view of the network. A program can listen on its own loopback interface even when the host outside that environment has no listener for that port. This is another form of the localhost mistake. It differs from copying a command into SSH because both consoles can appear on the same laptop. Before comparing results, identify the environment in which each program runs and how this lab publishes the intended service.
Suppose a test server inside a container reports a working loopback listener. The host terminal receives a refusal on its loopback port. Both results can be valid. Ask whether the lab configured a port exposure and an appropriate bind inside the training environment. If access from outside is intentionally disabled, the host refusal can be expected. Exposing a container on every interface is unnecessary for a local demonstration. Keep the approved scope explicit when selecting where the service should listen.
Write results in pairs. “Inside the container, the server returned the schedule.” “From the host without a published path, the local port refused.” State whether you expected a path between those locations. Then compare the approved environment’s connection settings and test only that documented address. A port number is meaningful only in the context of the host, interface or namespace you are observing.
Mistaking cached success for a successful rollout
A learner refreshes a page and gets 200, yet the expected timetable update is absent. A cached page can explain this outcome, and a second environment with an older backend can also return 200. Put a harmless revision label in the practice content and record it alongside status. Compare the exact resource path, hostname and response metadata that the system uses to govern cache reuse. A name update and a content update are separate changes. Reading the right IP address does not verify the expected version of the page.
Turn this into a positive test. Write out the intended host, response marker and exact asset path before the release. Ask the authorised service owner for an origin-side confirmation if an intermediary can cache that path. Then compare what the learner receives with the expected marker. If a service has both a cached general page and a live seat-count endpoint, test each separately. This is more informative than checking only that some page opened and gives your letter to the next technician a clear expectation.
Lab that distinguishes the host, path and method mistakes
You need Python 3 and curl in two local terminals. The exercise works in a Linux or macOS shell, or a suitable Linux training environment on Windows. It creates one HTTP listener on loopback only, requires no administrator permissions and uses no AWS resources. The fixture does not use TLS or real credentials. Its small, deliberate rules make clear why several different application responses can come from one reachable port.
Choose a free local port. This listing uses 8092, so substitute your selected port both in Python and every URL and address override if that one is occupied. Leave existing programs alone. The program has three checks. It accepts one method, expects one named host and serves a path with specific capitalization. The body is a synthetic schedule marker. Read the intended behavior before observing the outcomes.
python3 - <<'PY'
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlsplit
class ScheduleFixture(BaseHTTPRequestHandler):
def do_GET(self):
host = self.headers.get("Host", "").split(":", 1)[0].lower()
if host != "notes.training.example":
self.send_error(421, "Unexpected practice host")
return
if urlsplit(self.path).path != "/Schedule.txt":
self.send_error(404, "No file with that exact practice path")
return
body = b"Schedule from the intended host and GET path\n"
self.send_response(200)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_HEAD(self):
self.send_response(405)
self.send_header("Allow", "GET")
self.send_header("Content-Length", "0")
self.end_headers()
with HTTPServer(("127.0.0.1", 8092), ScheduleFixture) as server:
print("Practice listener on 127.0.0.1:8092", flush=True)
server.serve_forever()
PY
Expect the listener to start in terminal A and stay active. If that terminal exits immediately, check the reported reason before sending any test. A port conflict is different from the errors this exercise is designed to produce. Do not change the listener to bind across the network. In the client terminal the host name and address mapping are local to each diagnostic command and send traffic only to the loopback fixture.
Keep transport constant and change the application input
Begin with the happy path. curl maps the classroom name and port to loopback and requests the exact path. The options print response headers and keep the visible body. Expect HTTP 200 and the synthetic schedule line. Terminal A should report a GET for the correctly capitalized path. Now repeat with only the path capitalization changed and compare the HTTP response.
curl --noproxy '*' --connect-timeout 3 -sS -i \
--resolve notes.training.example:8092:127.0.0.1 \
http://notes.training.example:8092/Schedule.txt
curl --noproxy '*' --connect-timeout 3 -sS -i \
--resolve notes.training.example:8092:127.0.0.1 \
http://notes.training.example:8092/schedule.txt
The second result should be 404, which the operating system connection did not cause. The chosen application path did not match. The server records the request under the lowercase path. You can make this comparison even on a machine whose usual file system ignores case because the Python fixture compares the request path explicitly. A real server follows its own routing and file handling rules. Verify the exact spelling there instead of assuming your personal operating system behaves the same way.
Change the name in the next request but keep the same address, method and path. The fixture purposely refuses to serve that request at this authority by returning 421. The connection still reached the same listener. A production server might instead select a default site or respond with a different code. The lesson is to verify which host was requested and which service handled it.
curl --noproxy '*' --connect-timeout 3 -sS -i \
--resolve other.training.example:8092:127.0.0.1 \
http://other.training.example:8092/Schedule.txt
Return to the correct name and path, and use -I deliberately. This makes a HEAD request. The fixture returns 405 and its Allow header lists the accepted method. The response has no normal schedule body. Compare the outgoing method in the listener output with the original GET. This step gives you evidence that a convenient tool option can change which application operation you are measuring.
curl --noproxy '*' --connect-timeout 3 -sS -I \
--resolve notes.training.example:8092:127.0.0.1 \
http://notes.training.example:8092/Schedule.txt
Press Ctrl+C in terminal A to stop the fixture. Try the original GET once more; expect the connection failure before a new HTTP status, provided the port is free. These examples combine four application responses and one transport failure. Make a worksheet with columns for host, method, path, TCP result and HTTP result. Enter five separate rows so you can report exactly which controlled variable changed. The fixture creates no files or cloud infrastructure. Close the lab terminals when finished.
Turn common errors into result-driven troubleshooting cases
Missing page after a version change
The learner sees the new course title but one download is absent. Before blaming an infrastructure outage, retrieve the safe resource URL from the browser's network view. Compare the original requested route and the file name actually deployed. If the parent page is successful and this exact resource is 404 from its intended service, test a known existing file and compare. The next likely task concerns route configuration or deployment completeness. A port test can still work for both files and cannot tell you which was uploaded.
Expected path succeeds only for a labelled browser session
The class page is private and the training login is used in one browser window. An approved second window produces a denial. Check whether both requests used the same host and method, then document whether the intended application state was present. A 401 often means the request lacked valid authentication credentials for the target under HTTP semantics. A 403 can indicate that the responder understood the request and refused to fulfil it. An application might use a specialised challenge, redirect or error handler, so use local docs and logging for the precise purpose. A policy decision at the application layer can be correct.
The public site works but the admin route is unavailable
A service owner says public registration is intended, while administration is reachable only on an approved private path. A public client receives the expected page but cannot use the private route. That comparison can be a positive validation of the network and application boundary. Ask the owner how to run the authorised test and what evidence it should produce. Do not attempt to change the denied path into a public one for convenience. Keep the success condition tied to the intended audience.
The load balancer health indicator disagrees with a course request
The health endpoint returns a small static result, and the course page needs an application worker and a database. Both results can be accurate. A passing health probe establishes its configured checks under those settings. For the failed course request, verify which target the listener selected and whether the backend logged the exact method and safe path. The relevant failure could belong to an application dependency not touched by the health check. Keep the two observations readable and request facts from their actual owners.
Interview practice and revision
How would you explain why an open port does not prove an application is healthy?
The connection test verifies an endpoint accepted a transport connection from that source. The application still needs to implement the expected protocol and handle the intended operation. I would send a harmless request matching the method and named route and verify the relevant response and, if authorised, the service log. An application can accept TCP and reject a path or have a failed downstream dependency.
Why might testing a raw IP yield a different answer from using the desired HTTPS name?
A raw IP can change which name the client expects in the certificate and which HTTP authority the responder receives. A virtual host may route by the name. I would preserve the original hostname with a scoped address override in an approved lab and keep certificate validation enabled. That isolates one destination comparison without treating the override as proof of public DNS.
What evidence would you ask for before changing a network ACL?
I would draw the intended eligible flow, including the exact subnet, direction, protocol, addresses and transport ports. I would identify both request and response fields and review the applicable rules. Since ACLs are stateless, a reply can need a rule matching the returning destination port. Verify with the authorised test after any targeted change rather than opening broad traffic in both directions.
How can you tell that someone tested the wrong computer with localhost?
I would confirm the shell's hostname and whether it was inside SSH. A loopback address belongs to the machine that makes the request. The result can be accurate for that machine while irrelevant to a remote service. An approved test from the expected source should name the proper network destination for that service.
Quiz
Which change caused the method-specific failure in the controlled fixture: enabling a DNS override, using lowercase path text, or adding -I to the otherwise identical curl command?
Check your answer
Adding the option selected HEAD rather than GET. The method changed. The fixture explicitly returned 405 with GET in its Allow header.
An authorised service with a private backend fetches software through NAT successfully. Does this prove public clients can initiate new backend connections?
Check your answer
No. Outbound initiation and replies follow their configured NAT path. Public inbound initiation to a service requires its own intended and permitted path.
The browser shows a working title but a later data request is denied. Which result should be inspected to explain missing data?
Check your answer
Inspect the later data request and its expected application state. The successful document request tested a different operation.
Revision cards
Same transport, different result
Keep scheme, socket address and port fixed. A changed host, method or path can produce a different HTTP response without a network outage.
Observe locally
Loopback is the machine making the request. Check whether the terminal is local or connected to the server before drawing conclusions.
Limit each claim
A ping, resolved address, open port, valid certificate and application result each supply specific evidence. Write down what you still need to know.
Preserve the boundary
Use the approved source and path. A deliberate denial can be correct. Changing every rule at once makes the cause harder to observe.
Primary references
- ITU X.200 OSI reference model and RFC 1122 requirements for internet hosts
- RFC 9293 TCP, RFC 2308 DNS negative caching and response distinctions, and RFC 1034 DNS concepts
- RFC 9110 HTTP semantics and status codes, RFC 9525 HTTPS service identity and RFC 9114 HTTP/3
- AWS security groups, AWS subnet ACLs and AWS NAT gateways
- Nginx request processing, Linux neighbour table documentation and Linux socket utility
- Python HTTP fixture server and curl manual