Viewing IP configuration and routes

4.4 Your Computer on the Network (Weight: 2)

📘Linux Essentials (LPI 010-160)


1. What is IP Configuration?

IP configuration refers to the network settings assigned to a computer so it can communicate with other systems on a network.

Important IP configuration information includes:

SettingDescription
IP AddressThe unique address assigned to the computer
Subnet Mask / PrefixDefines the network portion of the IP address
Default GatewayThe router used to reach other networks
Network InterfaceThe hardware or virtual network adapter
DNS ServersServers used to resolve domain names

A Linux system may have multiple network interfaces, each with its own configuration.

Example interfaces:

  • eth0 – traditional wired interface name
  • enp0s3 – modern predictable interface name
  • wlan0 – wireless interface
  • lo – loopback interface

2. Network Interfaces in Linux

A network interface is the connection point between the computer and the network.

Linux systems commonly use these interface types:

InterfacePurpose
loLoopback interface for internal communication
ethXEthernet wired interface
wlanXWireless interface
enpXsYPredictable network interface names

Loopback Interface

The loopback interface (lo) is used for internal communication within the system.

Important loopback address:

127.0.0.1

This allows software running on the system to communicate with itself.

Example IT usage:

  • Database server communicating with a web server running on the same machine
  • Local testing of network services

3. Viewing IP Configuration

Linux provides several commands to display the current IP configuration.

The most common commands are:

  • ip
  • ifconfig (older command)

For the exam, the ip command is the modern and recommended tool.


4. The ip Command

The ip command is part of the iproute2 package and is used to view and manage networking settings.

It can display:

  • IP addresses
  • network interfaces
  • routing tables
  • statistics

Basic syntax:

ip [OPTIONS] OBJECT COMMAND

Example objects:

  • addr – addresses
  • link – interfaces
  • route – routing table

5. Viewing IP Addresses

To display the IP configuration of all interfaces:

ip addr

or

ip a

Example output:

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP>
inet 192.168.1.25/24
inet6 fe80::a00:27ff:fe4e:66a1/643: lo: <LOOPBACK,UP,LOWER_UP>
inet 127.0.0.1/8

Important information in the output

FieldMeaning
Interface nameExample: enp0s3
inetIPv4 address
inet6IPv6 address
/24Network prefix length
state UPInterface is active

Example:

inet 192.168.1.25/24

Means:

  • IP address: 192.168.1.25
  • Network prefix: /24

6. Viewing Interface Status

To display detailed interface information:

ip link show

Example output:

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP>

Important interface states:

StateMeaning
UPInterface is active
DOWNInterface is disabled

7. The ifconfig Command (Legacy)

Older Linux systems use the ifconfig command.

Example:

ifconfig

Example output:

eth0      Link encap:Ethernet
inet addr:192.168.1.25
Mask:255.255.255.0

Information displayed:

  • IP address
  • subnet mask
  • broadcast address
  • network interface status

However, modern Linux systems prefer the ip command.


8. Understanding Network Routes

When a system sends data to another system, it must know where to send the packets.

This information is stored in the routing table.

A route tells the system:

  • which network can be reached
  • which gateway should be used
  • which interface should send the traffic

Without routing information, a system cannot communicate with networks outside its local network.


9. Viewing the Routing Table

The routing table can be displayed with:

ip route

Example output:

default via 192.168.1.1 dev enp0s3
192.168.1.0/24 dev enp0s3 proto kernel scope link src 192.168.1.25

Explanation:

FieldMeaning
defaultDefault route
viaGateway address
devNetwork interface
srcSource IP address

10. Default Gateway

The default gateway is the router used when the destination network is not local.

Example entry:

default via 192.168.1.1 dev enp0s3

Meaning:

  • The system sends external traffic to the router
  • Router IP address: 192.168.1.1
  • Interface used: enp0s3

Example IT environment usage:

A workstation inside an office network sends traffic to the default gateway, which then forwards the traffic to:

  • the internet
  • another internal network
  • cloud services

11. Viewing Routes with Older Tools

Older Linux systems may use:

route

or

netstat -r

Example:

route -n

Example output:

Destination  Gateway      Genmask         Iface
0.0.0.0 192.168.1.1 0.0.0.0 eth0

Meaning:

  • 0.0.0.0 represents the default route

12. Example of Network Configuration in an IT Environment

A Linux server inside an internal network may have the following configuration:

SettingValue
Interfaceenp0s3
IP Address192.168.10.15
Subnet192.168.10.0/24
Gateway192.168.10.1

The routing table may contain:

192.168.10.0/24 dev enp0s3
default via 192.168.10.1 dev enp0s3

This means:

  • Traffic inside the local network stays within the interface.
  • Traffic to other networks is sent to the gateway.

13. Troubleshooting Network Configuration

Viewing IP configuration is useful when diagnosing network problems.

Common checks include:

Verify the interface is active

ip link

Check the assigned IP address

ip addr

Check the routing table

ip route

Typical problems discovered during troubleshooting:

  • Interface is DOWN
  • Missing IP address
  • Incorrect subnet
  • Missing default gateway

14. Key Commands for the Exam

You should remember the following commands for the Linux Essentials exam:

CommandPurpose
ip addrShow IP addresses
ip aShort version of above
ip linkShow network interfaces
ip routeShow routing table
ifconfigLegacy IP configuration tool
routeLegacy routing command
netstat -rShow routing table

15. Key Concepts to Remember for the Exam

  • Every network interface can have its own IP address.
  • The loopback interface (lo) is used for local communication.
  • The ip command is the modern tool for viewing networking configuration.
  • ip addr displays interface IP addresses.
  • ip route displays the routing table.
  • The default gateway sends traffic to other networks.
  • Older commands such as ifconfig and route may still appear on some systems.

Exam Tip (Important for LPI 010-160):

The exam commonly tests whether you know:

  • how to view an IP address
  • how to view network interfaces
  • how to view routing tables
  • the difference between ip, ifconfig, and route

Focus especially on:

ip addr
ip link
ip route
Buy Me a Coffee