Linux
While the average user does not encounter the Linux operating system very often, Linux is widely used to support web-based enterprise-grade applications. If you work in a data center environment, in software development, or with automation, you will almost certainly encounter and use some variant of the Linux operating system.
![key_topic.jpg](/content/images/chap4_9780138213428/elementLinks/key_topic.jpg)
Linux’s most common commands used to display network configuration are ifconfig and ip. Figure 4-13 illustrates ipconfig on Ubuntu Linux.
![FIGURE 4.13](/content/images/chap4_9780138213428/elementLinks/04fig13.jpg)
FIGURE 4-13 ipconfig Output on Ubuntu Linux
The fields of interest are
inet: The IPv4 address.
netmask: The subnet mask. Here, it is 255.255.240.0, so the prefix length is /28.
inet6: The IPv6 address.
prefixlen: The prefix length.
scope: Whether this is a link-local or global address. Since the IPv6 address begins with fe80, this is a link-local address.
ether: The physical address.
RX packets: The number of packets received, dropped, etc.
TS packets: The number of packets transmitted, dropped, etc.
Figure 4-14 shows the output of the ip addr command.
![FIGURE 4.14](/content/images/chap4_9780138213428/elementLinks/04fig14.jpg)
FIGURE 4-14 ip addr Command on Ubuntu Linux
The output of ip addr shows the physical address, the IPv4 address (inet), and the IPv6 address (inet6). This output also includes some DHCP information: alid_lft forever preferred_lft forever means the DHCP lease lifetime is forever.
Configuring a static interface address requires editing /etc/netplan/01-netcfg.yaml, as Figure 4-15 illustrates, and then restarting the network software.
![FIGURE 4.15](/content/images/chap4_9780138213428/elementLinks/04fig15.jpg)
Figure 4-15 01-netcfg.yaml File in Ubuntu Linux
You can edit the file in any text editor, such as VI or Emacs, replacing the addresses: 203.0.113.4 /24 with the correct address and the default gateway, 203.0.113.1, with the correct default gateway address. The nameservers should also be replaced with their correct values.