Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 1: Networking Fundamentals

AWS Cloud

1.2 IP address — what and why

In short: An IP (Internet Protocol) address is an address assigned to a network interface, like the postal address of a house. A device can have several interfaces or addresses, and private addresses can repeat on separate networks.

Friends, every device on a network needs an identity – that is its IP address. Just as a postman needs an address to find a house, a packet needs an IP.

An IP (Internet Protocol) address is an address assigned to a network interface, like the postal address of a house. A device can have several interfaces or addresses, and private addresses can repeat on separate networks. Routers use it to deliver packets to the correct destination.

  • IPv4 example: 192.168.1.10 (32 bits)
  • IPv6 example for documentation: 2001:db8:30:10::10 (128 bits)

Analogy

Think of an apartment complex. The IP address is the building address (e.g. Shivaji Nagar, Pune). The port is the flat number inside the building. The postman (router) delivers to the building; the watchman (operating system) sends the letter to the right flat (application). And just like the pin code (e.g. 411005) tells India Post which area a letter belongs to, the network part of an IP address tells routers which network the packet belongs to, while the host part identifies the exact machine.

Lakshat theva — this is only an analogy. The literal mechanism is: every packet carries a destination IP in its IP header; each router compares that IP with its routing table (longest matching prefix wins) and forwards the packet to the next hop. When the packet reaches the destination host, the OS reads the destination port in the TCP/UDP header and hands the data to the process listening on that port.

Ravindra Bagale's Tip

Many students get confused between an IP address and a MAC address. Remember: the IP is a logical address that can change when the network changes, while the MAC is the hardware address of the network card. A router forwards the packet by looking at the IP – the MAC works only within that local network (Chapter 2).

Practice task

Tumchya laptop var kiwa EC2 var ip -4 addr show aani hostname -I chalva aani tumcha IP liha. Mag analogy box pramane tya IP cha network part aani host part kontya aahe te andaj karun liha – pudhchya lesson 1.4 madhe subnet mask ne he nakki karu.

Give each connection an address that makes sense in its network

At the dairy, Asha uses one laptop at two shops. The packing printer at the first shop is on a private office network. The order website is reached by customers over the internet. On Friday Asha leaves the first shop, joins different Wi-Fi and still opens the order website. Her laptop is the same machine, but the network connection can have a different address. That change explains why an IP address is useful as a location for a particular exchange, while a person’s account or a computer’s label serves a different purpose.

An IP address identifies a network endpoint to the Internet Protocol. In the common setup we can see that address on a network interface. The interface might be a Wi-Fi adapter, a wired adapter, a VPN connection, a virtual adapter in a guest machine, or the virtual network interface of an EC2 instance. A machine can have multiple usable addresses. In AWS a network interface can have a primary private IPv4, additional private addresses, and associated IPv6 addresses, depending on its configuration. Read the interface and the selected path before deciding which address a request uses.

For the first shop, put Asha’s Wi-Fi interface at 192.168.40.18/24 and a printer at 192.168.40.30/24. In the second shop, give that same laptop a different Wi-Fi assignment such as 192.168.55.24/24. The address belongs in the context of the attached network. The laptop can now send local traffic to a second shop’s devices and use a suitable route for the public site. It cannot assume the first shop’s printer is directly reachable by issuing its old private address from the other shop. The networks need deliberate connectivity and an allowed service path for that task.

Make two rows in your notebook with columns for device, interface, address, connected range, and example destination. Keep the device name the same and change the interface setting when the laptop moves. This models what you will see when cloud resources change placements or when an engineer switches between a local terminal and a remote environment. It also gives you a concrete answer when a student asks which IP is “the IP” of a device with several addresses.

For all paper examples, use the supplied documentation blocks for public addresses. 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are examples reserved for documentation. 2001:db8::/32 fills that role in IPv6. They are useful precisely because you do not need to contact any internet host to learn address arithmetic or routing. Where an exercise actually runs a request, use the local loopback address or a destination in a lab you operate.

Keep the end destination separate from the next hop

Asha opens the order site at the example destination 203.0.113.20. On the first link, the laptop’s source in the sketch is 192.168.40.18 and the destination in its IP packet is 203.0.113.20. She uses the wireless office router 192.168.40.1 as the next hop. Write three labels in your diagram: packet source, packet destination, and next hop on this link. The gateway is the next place the packet travels. The web service stays its final destination at that point in the sketch.

The local link has its own addressing. On an Ethernet segment, a frame has local link-layer addressing such as MAC addresses. The laptop can use ARP to learn the local router’s link-layer address for its IPv4 address. The router receives a frame on one link, reads the IP destination and selects a route. It sends traffic onward using the next link’s framing. You can think of the IP packet as a letter traveling inside a new local envelope for each trip between routers. The web server does not need the first shop’s Wi-Fi hardware address to answer the connection.

IPv6 uses Neighbor Discovery for several local-network tasks, including discovering a neighbor’s link-layer address on links where this applies. It is useful to recognize that service as part of normal IPv6 operation rather than trying to find an ARP exchange for an IPv6 packet. When debugging a local problem, check which address family and interface the device actually used. The fact that a Wi-Fi connection exists does not tell you that every address on every interface is a valid route for your request.

At a router, the forwarding decision looks at the packet’s destination address and the router’s own routing information. A longer prefix match specific to a destination is used before a broader default when both apply. A network translation device can separately change an address or port as it forwards. The return trip may use different routers. These distinctions explain why packet addresses at one observation point can differ from addresses captured farther along a permitted path.

Do a one-step test on paper. The laptop requests the printer 192.168.40.30, which sits in the same connected /24. The expected first link delivers to that neighbor if the office allows the traffic. Now change just the destination to the remote site. The laptop keeps its same interface on Wi-Fi but selects an outside route. Explain why it may need the local router’s address before it can send the packet to the remote service. This is the useful part of the postal analogy from the original example.

Read the prefix before deciding whether two addresses are neighbors

Take 192.168.40.18/24. The address portion identifies Asha’s network endpoint in this context. The slash followed by 24 says which leading bits identify the network range. A slash is not part of the numeral itself. You can use the address alone as a destination, but you need the prefix to decide which addresses lie in a particular configured network. The same written address can appear with a different prefix in another planned design.

Think about two planned interfaces named A and B. A is 192.168.40.18/26. A /26 leaves six varying bits, so the first block in this fourth octet holds values 0 through 63. A possible printer at 192.168.40.50 fits the range. If B is 192.168.40.80/26, its fourth octet falls in the next block, 64 through 127. They share the first three displayed numbers but belong to different /26 blocks in this plan. Assuming “same first three numbers” is a common mistake when a subnet is smaller than /24.

Now put A and B in two independently managed networks. The fact that two hosts use separate subnets does not prevent routing between them. A router can provide a path with appropriate policy and return routes. The prefix tells each machine which addresses are treated as local and helps routers decide where an address belongs. Permission and physical or virtual network placement determine whether a suitable path actually exists. In a cloud design, check both the planned CIDR range and the actual subnet membership.

Use the same reading habit for IPv6. 2001:db8:30:10::18/64 names one interface address and its 64-bit network prefix. The full address contains 128 bits. Hexadecimal shortening changes the writing, while the set of bits represented remains the same. A host can have an IPv6 and an IPv4 address at once. One address family can succeed while the other lacks a usable route or listener. Later lessons explore the arithmetic and shortened forms in more detail. For this lesson, always keep an address’s family and prefix attached to the observation.

Three written strings describe different things. 192.168.40.18 is a host address. 192.168.40.0/24 is the abbreviated range used for this office example. 192.168.40.18:8000 describes a local service endpoint combining an address and a port. In a URL, enclose an IPv6 literal in square brackets before the port, for example http://[::1]:8000/. This avoids confusing the port separator with the colons inside the IPv6 address. Use the exact syntax in the intended client.

Classify the scope before choosing an address for a real test

Network addresses are allocated for different uses. An engineer should know whether a value describes the same computer, a local link, a private routed network, or a public path. Seeing familiar digits is a clue. Read the full range and the interface to decide what that clue means. Where a scope name is unfamiliar, check the official special-purpose registry instead of assuming every nonprivate IPv4 goes straight to the public internet.

Address in the exerciseAssigned purpose or scopePractical use in your notes
127.0.0.1 or ::1Loopback on the current host for IPv4 or IPv6Use it to test a local listener from the same system.
192.168.40.18 or 10.30.4.50RFC 1918 private IPv4 addressesUse them inside the planned private network or an authorized routed connection.
169.254.20.8IPv4 link-local exampleInvestigate local addressing and configuration before relying on a wider path.
fe80::1234IPv6 link-local exampleIdentify the appropriate local interface when reading or testing it.
100.64.12.20Shared IPv4 address space used by providersIt can be an intermediate address rather than the outward public address a site sees.
203.0.113.20 or 2001:db8::20Documentation examples for IPv4 and IPv6Use them on paper, in examples or in offline arithmetic.

A machine can use a working local address and lack internet connectivity. For example, when it has only link-local communication on a particular interface, it may still exchange local traffic while ordinary routed services fail. Likewise, private IPv4 addresses can travel between company networks through approved private routing. “Private” does not mean one room or one physical cable. It means the address comes from a range intended for private use and you need a route that understands that private address space.

Take 172.20.4.8 and 172.32.4.8. Only the first belongs to the private 172.16.0.0/12 range. Sixteen through thirty-one are the second-octet values included by that prefix. A useful beginner exercise is to read this with two other RFC 1918 ranges, 10.0.0.0/8 and 192.168.0.0/16. Then check IANA for an unfamiliar range that is outside them. Three private ranges are enough to memorize for this lesson. The registry supplies evidence for less common scopes.

A listening prompt such as 0.0.0.0:8000 needs its own interpretation. In that service configuration, the wildcard means all local IPv4 interfaces for the listener. It gives the operating system a binding instruction. A route or security group showing 0.0.0.0/0 is a prefix matching every IPv4 address. Read the surrounding field to distinguish these uses. If you saw that string in a rule for an administrative service, check who actually needs the connection before keeping such broad access.

Predict which address a multihomed machine will use

Asha plugs an Ethernet cable into her laptop while Wi-Fi is still on. She also has a company VPN active. The address list can now include entries for all three. A network tool that simply prints addresses does not necessarily tell you which one is used for a given request. Decide the destination, then inspect the route for that destination. A more specific company route can prefer the VPN while ordinary internet traffic uses the default through the office connection. Operating-system settings and interface state influence the final choice.

Use a paper example under Linux. The wired interface is enp1s0 with 192.168.40.18/24. The VPN is tun0 with 10.40.1.7. The company network 10.60.0.0/16 is reached through tun0. Most outside requests use the default through the wired interface’s router. The same laptop can therefore use different source addresses to reach an internal order database and a public site. Label the destination before making a source-address claim. It is possible for a program that explicitly binds a source to change the behavior of its own connection.

On a permitted Linux lab host, ip -4 addr shows IPv4 addresses, and ip route shows routing rules handled by the routing table you inspect. Try ip route get 203.0.113.20 to ask the system about its local routing decision for that example destination. This looks up a route and does not make a connection to the destination. On an ordinary host with a default route, output can indicate via for the next router, dev for the outgoing interface and src for a selected source. With no usable route, it can report the destination is unreachable. Its result describes local routing information rather than proof of end-to-end delivery.

When you move from Wi-Fi to a hotspot, bring the test notes along and repeat address and route inspection. You may find a new internal address, a different gateway and a different outbound public IPv4. If an approved server only accepts the old source address, the original connection rule may no longer match. The old result remains a valid observation for the old path. A useful report says which network was active during each test rather than relying on a single address from a screenshot.

Keep a service name and a user’s identity separate from the IP

The dairy’s customers remember orders.dairy.example. DNS can provide addresses for that name, so the operator can adjust the service’s placement over time. With a load balancer, customers can keep using the same hostname while app targets join and leave behind it. If you use only a numeric address saved in a document, the next deployment can make the note stale. Record whether the address is meant to be stable or is the current answer for a name.

When you compare two DNS results, include the resolver’s location, the record type and the time. An internal DNS view can give an answer for a private client that a customer on the public network should not use. Cached records can also produce different results during a managed change. A browser can use an IPv6 answer when another device uses IPv4. If your own service gives different behavior to two testers, read their actual addresses, then trace the paths that correspond to those answers.

Now put two users behind the same router. Both can appear to a public website with the same outward IPv4. The service still needs to distinguish who is logged in and what each may access. An address is practical network information and can narrow a network rule. An account, session, certificate or other authenticated credential establishes a different form of identity. In a permission plan, write the network requirement and the application authorization requirement on separate lines. This keeps the dairy’s packing portal private without assuming everyone on one subnet may edit orders.

There is a similar distinction at the receiving side. An HTTPS certificate authenticates a requested name rather than proving all hostnames associated with an address belong to that service. Type the intended name in the browser for the real test. If an approved direct address test uses a different host value, its result can help you discover a routing problem but may not verify the hostname and TLS behavior used by customers. In your notes include the full intended URL and the numeric address chosen for that request.

Reconcile the EC2 console address with the address Linux prints

For the cloud version of the dairy project, an EC2 instance in subnet 10.30.8.0/24 can have a primary private IPv4 such as 10.30.8.15. This address appears on its Elastic Network Interface, or ENI, and the guest can see it. The network interface supplies a place for addresses, attached security groups and related network configuration. In a simple single-interface instance, the primary interface does the job you first picture when you draw a server’s network socket.

Suppose the team also enables a public IPv4 association for a disposable direct-access lab. The console can show that public value beside the private one. Linux itself can still show the private address on the interface because the internet gateway handles the IPv4 address mapping for that public path. A request from an allowed private app in the VPC can use the private IPv4. A request from an intended outside client uses the public-facing entry address. Draw both paths and label which address each observer sees. Do not paste the Linux private IP into an outside browser and expect the same result without a private connection.

Use a different mental picture for an app behind an internet-facing Application Load Balancer. In the simple design the client reaches the load balancer’s named public service. The load balancer, in turn, can reach the app target at a private address. The target needs permission to accept the load balancer’s connection on its app port. If the team changes the target interface, the load balancer can direct traffic to another healthy registered target. The public hostname and the backend address are independently managed parts of the design.

Address persistence also comes from configuration. For an EBS-backed lab instance an ordinary stop and start can keep the instance and its primary private address while changing an automatically assigned public IPv4. An associated Elastic IP can provide a stable reference when used as intended. A replaced instance can obtain a different network interface and address. Draw the exact resource whose identity is meant to be stable. A domain for visitors, a retained network interface and an explicitly assigned public address solve related but different problems.

If a connection unexpectedly goes to the wrong server, check the instance ID and endpoint association as well as the digits. Two private networks can both contain 10.30.8.15. One DNS name can return multiple addresses over time. A team’s cloud inventory should record the account, Region, VPC, resource ID and interface as well as the IP value. Those extra fields are how you tell the intended resource apart from another use of a familiar number.

Describe the address as seen from one point on the path

Asha’s browser can send a request from a private address, the office router can translate its source, and the public service can see the outward address. A reply flows back through the translation state to the initiating connection. This is why a service owner who limits requests based on a source address needs to know the source visible from that service. The laptop’s own interface settings tell only the local part of the story.

Write three columns for an approved troubleshooting session: on the laptop, at the public boundary, and on the private target. Read the local source from the route choice on the laptop. The public boundary can record the source of the connection that reaches it. A load balancer or proxy may then create a separate connection to a target, whose observed peer is the load balancer or proxy. Some configured proxies also provide request metadata for the original client address. Take that information only from a trusted component in your deployment and learn how it was configured before using it as an authorization decision.

Try two learners on the same office path. Their laptop addresses differ, they can share an outward IPv4, and their application identities remain separate. If a student moves to an approved alternate network, repeat the address checks. A site that intentionally allows only office-origin traffic may now refuse the alternate path. Explain the policy from its observed source rather than ordering the student to change the laptop’s private IPv4.

This is also why keeping a log of numeric IPs is not the same as keeping a log of users. A meaningful incident record pairs time, connection, service request and authenticated account where appropriate. Keep only data you are authorized to collect. For the paper exercise, use the documentation addresses and ordinary synthetic names. With that discipline you can explain what a packet address shows without making a claim stronger than the observed evidence.

Inspect the local address and the outgoing route without sending a test packet

Use a Linux shell on your own computer or an authorized EC2 lab. The commands require the ip tool and access to read local network settings. They do not change network settings. If you are on Windows, use ipconfig to find the IPv4 address, subnet mask and default gateway of the connected adapter. On macOS, Network settings can show the address and router for the active connection. Use the Linux route lookup as an extra exercise if you already have a Linux terminal.

  1. First record which machine owns the output, then list IPv4 interfaces and routes.

    hostname
    ip -4 addr show
    ip -4 route show

    Look for the loopback interface and the separate interface you are using. Write down one non-loopback IPv4 value and the slash length beside it. In the route output, look for the connected prefix and a default route if the host has one. An interface name can differ from this lesson’s examples. Use the name your system actually prints.

  2. Ask Linux what it would do for a documentation address.

    ip -4 route get 203.0.113.20

    This does not attempt an HTTP connection. The rule lookup can return an interface and selected source, often with a next hop. Compare the selected source with the addresses you recorded. If there is no usable route, record the local error. Do not add a route to a shared machine merely to match the example.

  3. Use a connected lab address from your own subnet plan for the second lookup, or use the paper example of Asha’s printer if no second device is suitable. Compare the expected local decision with the default-routed result. The second result helps you explain the case where two similar-looking addresses use different next hops.

  4. Answer three questions in your notes. Which interface does the host plan to use? Which source address was selected for that request? Is a gateway listed as the next hop? Then say which of those lines establishes that a remote service responded. The route lookup supplies the local plan. It does not supply a remote response.

If the only listed IPv4 is loopback, you might be in a disconnected environment, a restricted container or a lab instance without the interface you expected. Confirm the host and interface configuration before trying external access. If the route points into a VPN, note which destination range caused that choice. End the lab by closing the temporary terminal. No routes, permissions or addresses need to be cleaned up because the commands only inspected them. Keep sensitive real addresses out of screenshots you plan to share publicly.

Verify your prefix prediction with Python’s offline address tools

This lab needs Python 3 with its standard library. The interpreter will compute information from example addresses without accessing a router or cloud provider. Start by predicting the first address, last address and range membership on paper. The exercise matters because your browser will not show the prefix length for an interface. A little offline arithmetic lets you verify what a networking diagram actually describes.

from ipaddress import ip_address, ip_interface

laptop = ip_interface("192.168.40.18/26")
printer_a = ip_address("192.168.40.50")
printer_b = ip_address("192.168.40.80")

print("address:", laptop.ip)
print("network:", laptop.network)
print("last address:", laptop.network.broadcast_address)
print("printer A in range:", printer_a in laptop.network)
print("printer B in range:", printer_b in laptop.network)

Expect to see 192.168.40.18 as the address, 192.168.40.0/26 as the range and 192.168.40.63 as its last address. Printer A fits; printer B does not. The last two lines are membership tests. They say nothing about whether either printer accepts an actual connection. The Python calculation confirms the range you wrote down rather than contacting a printer.

Now change the laptop lens to /24 on paper and repeat. Both sample printer addresses are inside that larger range. Only the interface prefix changed. Confirm that changing a prefix in a script is a safe learning experiment. Changing a live interface can affect real addresses, routes and permissions, and requires the lab owner’s plan. A prefix in a comparison is input to the calculation. It is not a setting you should alter on a network to make the arithmetic agree.

If Python raises an address parsing error, read each octet and separator. Check that IPv4 values use ordinary decimal octets and a slash length in range. Then check whether you asked to parse an individual interface address with a prefix or the exact network definition. In a teaching program, ip_interface can describe an address inside a range and gives you the network that contains it. Leave the interpreter when you finish. The experiment has not created files or cloud resources.

Confirm which address family a real browser or command used

Imagine the order name has an A record for an IPv4 listener and an AAAA record for an IPv6 listener. Asha’s shop can use both forms. Ravi’s temporary training environment currently has only IPv4 access. They can both type the same URL and see different paths and different symptoms. Their address lists are only the starting point. Compare the family and address the request actually selected. Then verify that family’s route, network rules and listener in the lab.

If you already operate a dual-stack test endpoint, use its exact hostname for the following checks. Substitute its complete approved URL. Do not put an address reserved for documentation into the command and expect a real webpage. Keeping the hostname the same checks the same application name and TLS identity while choosing a different way to reach it.

curl -4 -sS -o /dev/null -w 'IPv4 peer=%{remote_ip} status=%{http_code}\n' "$LAB_URL"
curl -6 -sS -o /dev/null -w 'IPv6 peer=%{remote_ip} status=%{http_code}\n' "$LAB_URL"

Imagine the IPv4 row returns status 200 and prints the IPv4 address of your expected endpoint. The IPv6 row reports that an address could not be found or that the connection could not be made. Read the exact error first. A missing address points to the result for the hostname and family. A returned address with a timeout is a different case. Check your client’s IPv6 route and the intended destination rules before concluding the whole site is down. If neither family can use the intended host name, retest the name and the current target configuration before reading application logs.

Compare ordinary requests before forcing either family. A normal client can make its choice using the results and connectivity it has. A working browser on one laptop may silently use the working path and hide that the other family needs review. An explicit two-row test gives a cloud team a way to report that issue precisely. If you have only one address family in your lab, apply the comparison on paper and inspect the documented connection settings. No resource changes or cleanup are required.

Track the address life cycle when a cloud server is replaced

Now put two dates on the dairy’s design board. Monday has an EC2 app called order-app-a with private address 10.30.8.15. Tuesday the app image is updated and a new instance is registered behind the same front door. In this example the new instance has private address 10.30.8.24. People can continue to use the front door’s service name. A peer configured with an old hard-coded backend address can still try the Tuesday request against the Monday machine.

Use two schedules for the replacement. In the first, a health check succeeds for the new target, the front door directs the approved test to it, and then the old target is removed according to the plan. In the second, a peer containing the old numerical value continues sending private requests to the old host. The public site can look healthy while that peer is broken. Map the clients that depend on the direct target before changing an address. Move chosen clients to a stable service entry where it is appropriate and give each migration a result you can verify.

An IP also has context. Another team’s VPC could have an overlapping CIDR and a machine using the same address as Monday’s app. Compare account, Region, VPC, subnet, interface ID and resource ID in both inventories. If somebody says “just connect to that IP,” this extra context is what determines whether the quoted target is the one they intend. Plan nonoverlapping address ranges when the two networks need to connect, or choose a supported design that handles the overlap deliberately. Do not test by trying the first similar private address you see.

Use this comparison in a ticket with a practical format. Write expected resource at start, current resource, service entry name, and last test result. Record which controller or admin assigns the addresses, and whether the observed numeric address is a local interface value, an association or a resolved endpoint. Then ask the caller to test the current intended endpoint. If one test still reports the old address, inspect its configuration or DNS answer before reassigning anything.

The underlying skill is to choose the right piece of identity for the task. A name can be a stable service label. A specific private IP says where a packet would be sent in a particular network at that time. An instance ID names an AWS resource and remains useful for comparing two console observations about that resource. When you need to talk to a service, choose its intended entry address or name. When you need to confirm which machine accepted your SSH session, verify its authorized host identity and the machine you are operating. Keep those checks in the notebook so a future reader can reproduce them.

Apply the address reading to an ordinary incident

  1. Recognize a stale host note. A colleague has written an EC2 public IPv4 in yesterday’s ticket. The test instance was stopped and started overnight, while its data volume remained attached. Check its current interface and public association, then compare with the old note. A successful answer states which resource remained and which observation needed to be updated.
  2. Choose a local and a remote test. The order app prints a listener address of 127.0.0.1:8000 on a lab host. Write one command you could run on that host and explain what the same URL does in the browser on a separate laptop. Draw a suitable public or private proxy path if another machine is intended to use the app.
  3. Diagnose a wrong expectation about identical digits. An employee says two devices share the prefix 192.168.40 so they must both be directly connected and reachable. Ask for both prefix lengths, the interface and intended subnet of each. Use the /26 printer example as evidence that the first three numbers alone are insufficient.
  4. Read a change of network honestly. A permitted public service worked from the office and is refused from a hotspot. Write which measurements you would collect before requesting a wider rule. A strong response includes the current network, source visible to the service, destination name and address, service port and whether the older policy intentionally required the office path.

Interview questions and worked answers

Why can one computer have more than one IP address?

It can connect through multiple interfaces such as Wi-Fi and a VPN. One interface can also have several addresses or support both IPv4 and IPv6. The relevant address comes from the interface and route used for the current destination.

Is the gateway IP the destination of every packet leaving the local network?

The gateway is often the first next hop for an external route. On that link the laptop sends the traffic to the gateway. The IP destination still identifies the remote service in the absence of destination rewriting. Drawing both values makes the roles clear.

How do you decide whether two IPv4 addresses share a subnet?

Find the configured prefix and calculate the range it describes. Then test whether the second address lies inside it and whether the actual hosts belong to the corresponding connected network. The number of matching displayed octets by itself does not establish that.

Why can the guest’s address differ from the public address shown in EC2?

EC2 can associate a public IPv4 with a private interface address. The internet gateway supports the public IPv4 mapping for that path. The guest can continue using its private address. Check the console association and the intended network entry separately.

Will a website always see the laptop address printed by ipconfig or ip addr?

It depends on where the website is and what path is used. A public site can see a translated outward address. A proxy can also make another connection to its target. Record where each address was observed before using it to explain a policy result.

Why use a hostname for an HTTPS service test?

The browser resolves the hostname and checks certificate coverage for the name it requested. Typing a raw address may test a different identity or web configuration. Use the intended URL for the customer experience and a separate controlled address test for network diagnosis.

Check your understanding of the address you are looking at

  1. The laptop uses 192.168.40.18/26. Is 192.168.40.80 in its connected address range? Choose yes or no and explain the boundary.

    Answer and reasoning

    No. The first /26 block spans .0 to .63, and .80 is in the next block. Routing can still connect those two ranges if designed.

  2. Which address describes IPv6 loopback: fe80::1, ::1, or 2001:db8::1?

    Answer and reasoning

    ::1. A fe80::-range example is link-local, while 2001:db8:: belongs to the documentation block.

  3. A student runs ip route get and sees a device and source address. Does the output prove the site has replied?

    Answer and reasoning

    No. It reports the kernel’s route lookup on that host. Make a separate authorized service request to observe the response.

  4. A browser and an SSH shell each try 127.0.0.1, with the shell logged into EC2. Are they guaranteed to reach the same machine?

    Answer and reasoning

    They can be on different hosts. The browser uses the laptop’s loopback. The remote shell uses the EC2 machine’s loopback.

  5. The same laptop uses an office VPN for a private app and Wi-Fi for another destination. Can it use different source addresses?

    Answer and reasoning

    Yes. The route for the destination and interface configuration can select different sources. Inspect each destination separately.

Revision cards

Interface owns the address in context
One device can have Wi-Fi, wired, VPN and loopback addresses. Select the address for the path you are demonstrating.
Same digits, different network
A private IP can repeat across independent networks. Compare the planned CIDR and actual route before connecting them.
Prefix says where the range begins and ends
Use the slash length to calculate the block. Equal leading octets do not automatically mean two hosts belong to the same subnet.
Next hop differs from final destination
The router can be the first link destination while the IP packet still names the far-away service.
Observe each side of translation
The local interface and outward public address can differ. A front door and its backend can also observe separate connections.
Name and application identity
DNS can change the address behind a service name. TLS checks the requested host, and application authorization decides what the signed-in user may do.

Technical references