Everyday Guidebooks
Cover of Linux IP Address Troubleshooting

Cybersecurity & IT

Linux IP Address Troubleshooting: Multiple Interfaces

A Practical Guide to Addresses, Routes, Interface State, and Source Address Selection

by Todd Michael

Available now

Searching for “linux how to get ip address” is a useful starting point—but what happens when a machine has several interfaces and several possible addresses?

Linux IP Address Troubleshooting: Multiple Interfaces gives you a practical way to inspect the evidence and predict which source address a connection is likely to use. Through text-based examples, you’ll learn to read interface state, distinguish assigned addresses from usable paths, examine routing tables, and use route lookups for specific destinations. You’ll also work through common mistakes, including assuming that the first address displayed or the default route tells the whole story.

Designed for Linux learners and IT certification candidates, this focused guide combines command output, interpretation exercises, and worked troubleshooting scenarios. Rather than asking you to memorize isolated commands, it helps you connect addresses, routes, and source selection into a repeatable diagnostic process.

Contents
  1. 1. The Multihomed Host: What You Are Trying to Find
  2. 2. Reading Interface State
  3. 3. Finding Assigned IP Addresses
  4. 4. Prefixes, Subnets, and Directly Connected Networks
  5. 5. Reading the IPv4 Routing Table
  6. 6. Looking Up a Route for a Destination
  7. 7. Understanding IPv4 Source Address Selection
  8. 8. Two Interfaces, Competing Paths
  9. 9. IPv6 Addresses and Route Lookups
  10. 10. Policy Routing and Lookup Context
  11. 11. Common Output and Interpretation Mistakes
  12. 12. A Repeatable Troubleshooting Workflow
  13. Start with a Testable Question
  14. Step 1: Check Interface State
  15. Step 2: Inventory Addresses
  16. Step 3: Inspect Rules Before Assuming a Table
  17. Step 4: Inspect Relevant Routes
  18. Step 5: Ask for the Destination-Specific Decision
  19. Step 6: Compare Equivalent Contexts
  20. Step 7: Compare the Prediction with the Connection
  21. Record the Investigation as Evidence
  22. A Compact Workflow for Everyday Use
  23. 13. Worked Multihomed Troubleshooting Scenarios
  24. 14. Practice Cases and Answer Explanations
  25. Other Books by Todd Michael

Read a sample: 1. The Multihomed Host: What You Are Trying to Find

A Linux host can have several IP addresses and several ways to reach a destination. A laptop might be connected to a wired network and a wireless network at the same time. A server might have separate interfaces for application traffic and management access. A virtual machine might have one connection to an internal network and another to a network that reaches the internet.

In each case, a common question sounds simple: Which IP address will this host use?

The useful answer begins with another question: Use for what destination, under what conditions? An address assigned to the host is not automatically the source address of every connection it makes. The destination matters, as do the selected route, the available addresses, and sometimes the application’s own choices.

This chapter establishes the vocabulary and the investigation sequence used throughout the book. The goal is not to memorize a single command, but to learn how the pieces of evidence fit together.

Consider a Linux workstation named atlas. It has two active network interfaces:

- enp1s0 is connected to a wired network. - wlp2s0 is connected to a wireless network.

For this example, assume the host has the following IPv4 configuration:

The addresses in this example are used for documentation. Treat the networks as a hypothetical lab rather than public destinations to test.

The workstation also has routes that, in simplified form, say:

- The network 192.0.2.0/24 is reachable through enp1s0. - The network 198.51.100.0/24 is reachable through wlp2s0. - Other destinations can use a default route through gateway 192.0.2.1 on enp1s0.

Now suppose a user on atlas wants to connect to 198.51.100.44. That destination is on the wireless network in this example. A route lookup would ordinarily select wlp2s0, and the likely source address would be 198.51.100.20.

If the user instead connects to 203.0.113.80, the destination does not match either of the two directly connected networks. Under the simplified routing arrangement above, the default route sends the packet through enp1s0 toward 192.0.2.1. The likely source address is then 192.0.2.10.

The same host therefore has two assigned IPv4 addresses and, depending on the destination, may use either one as a source. The configuration permits a more useful statement than “the machine’s IP address is 192.0.2.10.” It permits a destination-specific prediction:

> For a lookup to 203.0.113.80 in this example, the expected outgoing interface is enp1s0, and the expected source address is 192.0.2.10.

That statement is still a prediction. An application can introduce additional context, and the actual configuration may differ from the simplified example. But the statement identifies what was investigated and what result is expected.

A network interface is a point through which the Linux networking stack can send or receive traffic. Some interfaces correspond to physical devices, such as an Ethernet adapter or wireless adapter. Others are virtual: a virtual machine interface, a bridge, a tunnel, or the loopback interface can all appear in the interface list.

An interface name identifies the interface on that system. Names such as enp1s0 and wlp2s0 are examples, not names you should expect on every host. Your system might use different names.

The existence of an interface does not establish that it is ready to carry useful traffic. An interface can be administratively disabled, lack a physical or wireless link, or have another condition that prevents normal communication. Conversely, seeing an interface in an active state does not prove that a remote service is reachable.

An initial view of the host’s interfaces is available with:

text ip link show

This command reports link-layer information and interface state. It answers questions such as “Does the interface exist?” and “What state does Linux report for it?” It does not, by itself, answer which source IP address will be used for a particular destination.

Chapter 2 examines the state information in detail. For now, keep the distinction clear: an interface is a potential path, but its name alone is not an IP address, a route, or proof of connectivity.

An IP address is assigned to an interface so that the host can participate in IP communication. In the example, 192.0.2.10 is assigned to enp1s0, and 198.51.100.20 is assigned to wlp2s0.

A useful starting command is:

text ip address show

A shortened example of the relevant IPv4 output might look like this:

text 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWERUP> mtu 1500 state UP inet 192.0.2.10/24 scope global enp1s0 3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWERUP> mtu 1500 state UP inet 198.51.100.20/24 scope global wlp2s0

The word inet identifies an IPv4 address in this output. The /24 is a prefix length; it helps describe the network associated with the address. Chapter 3 covers address output, and Chapter 4 works through prefixes and directly connected networks.

The important observation here is that this output is an inventory of assignments. It shows that the host has these addresses on these interfaces. It does not say that 192.0.2.10 will be the source of every packet, or that the first address displayed is preferred for all destinations.

An interface can also have more than one address. For example, enp1s0 could have both 192.0.2.10/24 and 192.0.2.11/24. Merely knowing that a route uses enp1s0 would then be insufficient to identify the source address without more evidence.

Likewise, a host can have IPv4 and IPv6 addresses at the same time. The principles of inspecting the destination, route, and source remain useful for both, but IPv6 has additional scope and address-preference considerations. Chapter 9 treats…

More Cybersecurity & IT

Cover of The White Hat Bible, Volume 1The White Hat Bible, Volume 1Available nowCover of The White Hat Bible, Volume 2The White Hat Bible, Volume 2Available nowCover of The White Hat Bible, Volume 3The White Hat Bible, Volume 3Available nowCover of The White Hat Bible, Volume 4The White Hat Bible, Volume 4Available nowThe White Hat Bible, Volume 5Available nowCover of The White Hat Pocket GuideThe White Hat Pocket GuideAvailable now

About Todd Michael

Todd Michael is an American author and the founder of ToddMichael.tv. He writes practical, plain-English books on money, health, preparedness, technology, games, humor and more.

About the author Todd Michael · Todd Michael’s author site

Part of the ToddMichael.tv network.