Networking · foundation

IP address and network interface

A network interface is an operating-system attachment point for sending and receiving network packets, whether backed by hardware or software. An IP address and prefix assigned to an interface identify an IP endpoint and its on-link network within a particular network configuration.

Why it matters

Connectivity failures often come from the wrong source address, missing route, down interface, or incorrect prefix rather than from the application. Inspecting interfaces and routes locates the problem before higher-level debugging.

Mental model

How to reason about ip address and network interface

The OS chooses a route for each destination, then selects an outgoing interface and source address consistent with that route. An address belongs to a configured network context; it is not an immutable serial number for a physical machine.

Analogy

An interface is a building's doorway and an IP address is a delivery address currently assigned to that doorway. A building can have several doors and addresses, and an address can be reassigned later.

Examples

See the boundary, not just the happy path

Worked example · Inspect configured addresses

ip address show

On Linux, this lists interfaces, their state, and assigned IPv4 or IPv6 prefixes. An interface can have multiple addresses, including temporary or link-local ones with different scopes.

Worked example · Ask which route will be used

ip route get 1.1.1.1

The kernel evaluates its routing policy and reports the chosen next hop, interface, and usually source address. This is more reliable than guessing from the interface list alone.

Useful contrast · IP address versus link-layer address

192.0.2.10 is an IP address; 02:42:ac:11:00:02 resembles a MAC address

IP addresses support routing across networks. Link-layer addresses identify interfaces on a local link and serve a different protocol layer and scope.

Common mistakes

Misconceptions to remove early

Assuming a host has exactly one IP address

A system can have several interfaces, IPv4 and IPv6 addresses, virtual interfaces, and multiple addresses per interface. The route can select different source addresses for different destinations.

Reading the prefix as part of the host address

In 192.0.2.10/24, /24 states how many leading bits form the network prefix. It is routing information, not an extra decimal component of the address.

Quick check

Can you predict the result?

1. What determines which local interface sends a packet to a destination?
  • The operating system's routing and policy decision.
  • The alphabetically first interface name.
  • The DNS record's time to live.
Answer: The operating system's routing and policy decision.
2. Why might one machine legitimately have several IP addresses?
Answer: It can have multiple interfaces, address families, scopes, or several addresses configured on one interface.

Keep building

Authoritative references

Make the idea retrievable.

Study this concept with spaced repetition, next to the commands where you use it.

Get Terminaster