Bookmark this page

Chapter 11. Managing Red Hat Enterprise Linux Networking

Abstract

Goal To configure basic IPv4 networking on Red Hat Enterprise Linux systems.
Objectives

  • Explain fundamental concepts of computer networking.

  • Test and review current network configuration with basic utilities.

  • Manage network settings and devices with nmcli and NetworkManager.

  • Modify network settings by editing the configuration files.

  • Configure and test system host name and name resolution.

Sections
  • Networking Concepts (and Practice)

  • Validating Network Configuration (and Practice)

  • Configuring Networking with nmcli (and Practice)

  • Editing Network Configuration Files (and Practice)

  • Configuring Host Names and Name Resolution (and Practice)

Lab
  • Managing Red Hat Enterprise Linux Networking

Networking Concepts

List features of computer networking.

Objectives

After completing this section, students should be able to explain fundamental concepts of computer networking.

IPv4 networking

TCP/IP standards follow a four-layer network model specified in RFC1122.

  • Application

    Each application has specifications for communication so that clients and servers may communicate across platforms. Common protocols include SSH (remote login), HTTPS (secure web), NFS or CIFS (file sharing), and SMTP (electronic mail delivery).

  • Transport

    Transport protocols are TCP and UDP. TCP is a reliable connection-oriented communication, while UDP is a connectionless datagram protocol. Application protocols use TCP or UDP ports. A list of well-known and registered ports can be found in the /etc/services file.

    When a packet is sent on the network, the combination of the service port and IP address forms a socket. Each packet has a source socket and a destination socket. This information can be used when monitoring and filtering.

  • Internet

    The Internet, or network layer, carries data from the source host to the destination host. Each host has an IP address and a prefix used to determine network addresses. Routers are used to connect networks.

    ICMP is a control protocol at this layer. Instead of ports, it has types. The ping utility is an example of using ICMP packets to test connectivity. ping sends an ICMP ECHO_REQUEST packet. A successful ping receives an ICMP ECHO_REPLY acknowledgment. An unsuccessful ping may receive ICMP error messages such as "destination unreachable" or may not receive any response.

  • Link

    The link, or media access, layer provides the connection to physical media. The most common types of networks are wired Ethernet (802.3) and wireless WLAN (802.11). Each physical device has a hardware address (MAC) which is used to identify the destination of packets on the local network segment.

Figure 11.1: IPv4 addresses and netmasks

IPv4 addresses

An IPv4 address is a 32-bit number, normally expressed in decimal as four octets ranging in value from 0 to 255, separated by dots. The address is divided into two parts: the network part and the host part. All hosts on the same subnet, which can talk to each other directly without a router, have the same network part; the network part identifies the subnet. No two hosts on the same subnet can have the same host part; the host part identifies a particular host on a subnet.

In the modern Internet, the size of an IPv4 subnet is variable. To know which part of an IPv4 address is the network part and which is the host part, an administrator must know the netmask which is assigned to the subnet. The netmask indicates how many bits of the IPv4 address belong to the subnet. The more bits that are available for the host part, the more hosts can be on the subnet.

The lowest possible address on a subnet (host part is all zeros in binary) is sometimes called the network address. The highest possible address on a subnet (host part is all ones in binary) is used for broadcast messages in IPv4, and is called the broadcast address.

Network masks are expressed in two forms. The older syntax for a netmask which uses 24 bits for the network part would read 255.255.255.0. A newer syntax, called CIDR notation, would specify a network prefix of /24. Both forms convey the same information; namely, how many leading bits in the IP address contribute to its network address.

The examples which follow illustrate how the IP address, prefix (netmask), network part, and host part are related.

Table 11.1.  Calculating the network address for 192.168.1.107/24

Host addr

192.168.1.107

11000000.10101000.00000001.01101011

Network prefix

/24 (255.255.255.0)

11111111.11111111.11111111.00000000

Network addr

192.168.1.0

11000000.10101000.00000001.00000000

Broadcast addr

192.168.1.255

11000000.10101000.00000001.11111111


Table 11.2.  Calculating the network address for 10.1.1.18/8

Host addr

10.1.1.18

00001010.00000001.00000001.00010010

Network prefix

/8 (255.0.0.0)

11111111.00000000.00000000.00000000

Network addr

10.0.0.0

00001010.00000000.00000000.00000000

Broadcast addr

10.255.255.255

00001010.11111111.11111111.11111111


Table 11.3.  Calculating the network address for 172.16.181.23/19

Host addr

172.168.181.23

10101100.10101000.10110101.00010111

Network prefix

/19 (255.255.224.0)

11111111.11111111.11100000.00000000

Network addr

172.168.160.0

10101100.10101000.10100000.00000000

Broadcast addr

172.168.191.255

10101100.10101000.10111111.11111111


The special address 127.0.0.1 always points to the local system ("localhost"), and the network 127.0.0.0/8 belongs to the local system, so that it can talk to itself using network protocols.

Figure 11.2: Network routing and DNS concepts

IPv4 routing

Whether using IPv4 or IPv6, network traffic needs to move from host to host and network to network. Each host has a routing table, which tells it how to route traffic for particular networks. The routing table entries will list a destination network, which interface to send the traffic out, and the IP address of any intermediate router that is required to relay the message to its final destination. The routing table entry which matches the destination of the network traffic is used to route it. If two entries match, the one with the longest prefix is used.

If the network traffic does not match a more specific route, the routing table usually has an entry for a default route to the entire IPv4 Internet, 0.0.0.0/0. This default route points to a router on a reachable subnet (that is, on a subnet that has a more specific route in the host's routing table).

If a router receives traffic that is not addressed to it, instead of ignoring it like a normal host, it forwards the traffic based on its own routing table. This may send the traffic directly to the destination host (if the router happens to be on the destination's subnet), or it may be forwarded on to another router. This process of forwarding continues until the traffic reaches its final destination.

Table 11.4. Example routing table

DestinationInterfaceRouter (if needed)
192.0.2.0/24wlo1 
192.168.5.0/24enp3s0 
0.0.0.0/0 (default)enp3s0192.168.5.254

In this example, traffic headed for the IP address 192.0.2.102 from this host will be transmitted directly to that destination via the wlo1 wireless interface, because it matches the 192.0.2.0/24 route most closely. Traffic for the IP address 192.168.5.3 will be transmitted directly to that destination via the enp3s0 Ethernet interface, because it matches the 192.168.5.0/24 route most closely.

Traffic to the IP address 10.2.24.1 will be transmitted out the enp3s0 Ethernet interface to a router at 192.168.5.254, which will forward that traffic on to its final destination. That traffic matches the 0.0.0.0/0 route most closely, as there is not a more specific route in the routing table of this host. The router will use its own routing table to determine where to forward that traffic to next.

Names and IP addresses

The IP protocol uses addresses to communicate, but human beings would rather work with names than long and hard-to-remember strings of numbers. DNS, the Domain Name System, is a distributed network of servers that maps host names to IP addresses. In order for name service to work, the host needs to be pointed at a nameserver. This nameserver does not need to be on the same subnet; it just needs to be reachable by the host.

DHCP or static network configuration

Many systems are configured to obtain network settings automatically at boot time. The local configuration files indicate that DHCP should be used and a separate client service queries the network for a server and obtains a lease for network settings.

If a DHCP server is not available, the system must use a static configuration where the network settings are read from a local configuration file. The correct network settings are obtained from the network administrator or architecture team to ensure there are no conflicts with other systems.

Since DHCP uses the hardware address to track assignments, only one address may be assigned per interface with DHCP. Multiple static addresses may be assigned to a single interface. This practice is common in systems hosting services for multiple clients, such as HTTP IP-based hosting. Red Hat Enterprise Linux interfaces typically have an IPv4 address and an IPv6 local-link address, but may have more addresses assigned.

Network interface names

Traditionally, network interfaces in Linux are enumerated as eth0, eth1, eth2, and so on. However, the mechanism which sets these names can cause changes to which interface gets which name as devices are added and removed. The default naming behavior in Red Hat Enterprise Linux 7 is to assign fixed names based on firmware, device topology, and device type. Interface names have the following characters:

  • Ethernet interfaces begin with en, WLAN interfaces begin with wl, and WWAN interfaces begin with ww.

  • The next character(s) represents the type of adapter with an o for on-board, s for hotplug slot, and p for PCI geographic location. Not used by default but also available to administrators, an x is used to incorporate a MAC address.

  • Finally, a number N is used to represent an index, ID, or port.

  • If the fixed name cannot be determined, the traditional names such as ethN will be used.

For example, the first embedded network interface may be named eno1 and a PCI card network interface may be named enp2s0. The new names make it easier to distinguish the relationship between a port and its name if the user knows both, but the trade off is that users cannot assume a system with one interface calls that interface eth0.

Note

Network interface naming can be overridden. If the administrator has installed and enabled the biosdevname package or set customized udev device naming rules, those settings will override the default naming scheme. Depending on support for biosdevname in the system BIOS, names such as em1, em2, etc. may be used for on-board network cards (corresponding to their names on the chassis). PCI(e) cards are represented with pYpX (e.g., p4p1), where Y is the PCI slot number and X is the number for the port on that specific card.

References

services(5), ping(8), biosdevname(1), and udev(7) man pages

Additional information may be available in the chapters on configuring networking and consistent network device naming in the Red Hat Enterprise Linux Networking Guide for Red Hat Enterprise Linux 7, which can be found at https://access.redhat.com/documentation/

Revision: rh124-7-1b00421