Managing Networking
Tags: linux, programming
Published: 2022-10-02 15:40:45

**•TCP/IP Network Model**
The _TCP/IP network model is a simplified,_ four-layered set of abstractions that describes how different protocols interoperate in order for computers to send traffic from one machine to another over the Internet.
_Requirements for Internet Hosts -- Communication Layers_
1.Application
2.Transport
3.Internet
4.Link

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kb0ap6n4s3hyv0s5aknx.png)
**•Describing Network Interface Names**
Each network port on a system has a name, which you use to configure and identify it.
The name eth0 was the first network port detected by the operating system, eth1 the second, and so on. However, as devices are added and removed, the mechanism detecting devices and naming them could change which interface gets which name. Furthermore, the PCIe standard does not guarantee the order in which PCIe devices will be detected on boot, which could change device naming unexpectedly due to variations during device or system startup.
The names of network interfaces are assigned based on information from the firmware, the PCI bus topology, and type of network device.
Network interface names start with the type of interface:
- Ethernet interfaces begin 
  with en
- WLAN interfaces begin with 
  wl
- WWAN interfaces begin with 
  ww

**•IPv4 Networking**
IPv4 is the primary network protocol used on the Internet today. You should have at least a basic understanding of IPv4 networking in order to manage network communication for your servers.
~IPv4 Addresses
An IPv4 address is a 32-bit number, normally expressed in decimal as four 8-bit 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.
The lowest possible address on a subnet is sometimes called the network address. The highest possible address on a subnet is used for broadcast messages in IPv4, and is called the broadcast address.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3s6zoxs4ktciuszup4ur.png)
~IPv4 Routing
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. A routing table entry lists a destination network, which interface to use when sending traffic, and the IP address of any intermediate router required to relay a message to its final destination. The routing table entry matching 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.
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, or it may be forwarded on to another router. This process of forwarding continues until the traffic reaches its final destination.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izlkp6mjyar4wbn8ptrs.png)
~IPv4 Address and Route Configuration
A server can automatically configure its IPv4 network settings at boot time from a DHCP server. A local client daemon queries the link for a server and network settings, and obtains a lease to use those settings for a specific length of time. If the client does not request a renewal of the lease periodically, it might lose its network configuration settings.

**•IPv6 Networking**
IPv6 is intended as an eventual replacement for the IPv4 network protocol. You will need to understand how it works since increasing numbers of production systems use IPv6 addressing.
IPv6 can also be used in parallel with IPv4 in a dual-stack model. In this configuration, a network interface can have an IPv6 address or addresses as well as IPv4 addresses.
~IPv6 Addresses
An IPv6 address is a 128-bit number, normally expressed as eight colon-separated groups of four hexadecimal nibbles (half-bytes). Each nibble represents four bits of the IPv6 address, so each group represents 16 bits of the IPv6 address.
Some tips for writing consistently readable addresses:
>Suppress leading zeros in a group.
>Use :: to shorten as much as possible.
>If an address contains two consecutive groups of zeros, equal in length, it is preferred to shorten the leftmost groups of zeros to :: and the rightmost groups to :0: for each group.
>Although it is allowed, do not use :: to shorten one group of zeros. Use :0: instead, and save :: for consecutive groups of zeros.
>Always use lowercase letters for hexadecimal numbers a through f.
~IPv6 Subnetting
A normal IPv6 unicast address is divided into two parts: the network prefix and interface ID. The network prefix identifies the subnet. No two network interfaces on the same subnet can have the same interface ID; the interface ID identifies a particular interface on the subnet.
IPv6 has a standard subnet mask, which is used for almost all normal addresses, /64.In this case, half of the address is the network prefix and half of it is the interface ID.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2ymvk341msbcjxkh0sg.png)
A link-local address in IPv6 is an unroutable address used only to talk to hosts on a specific network link. Every network interface on the system is automatically configured with a link-local address on the fe80::/64 network. The usual procedure to convert the 48-bit MAC address to a 64-bit interface ID is to invert bit 7 of the MAC address and insert ff:fe between its two middle bytes.
>Network prefix: fe80::/64
>MAC address: 00:11:22:aa:bb:cc
>Link-local address:   fe80::211:22ff:feaa:bbcc/64
use ping6 to ping the link-local address fe80::211:22ff:feaa:bbcc using the link connected to the ens3 network interface, the correct command syntax is the following:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34npwx078eop9ur0i9h6.png)
Multicast plays a larger role in IPv6 than in IPv4 because there is no broadcast address in IPv6. One key multicast address in IPv6 is ff02::1, the all-nodes link-local address. Pinging this address sends traffic to all nodes on the link. Link-scope multicast addresses (starting ff02::/8) need to be specified with a scope identifier, just like a link-local address.
~IPv6 Address Configuration
IPv6 also supports manual configuration, and two methods of dynamic configuration, one of which is DHCPv6.
Interface IDs for static IPv6 addresses can be selected at will, just like IPv4.In IPv6, the following interface IDs are reserved and cannot be used for a normal network address on a host.
>The all-zeros identifier 0000:0000:0000:0000 (“subnet router anycast”) used by all routers on the link. (For the 2001:db8::/64 network, this would be the address 2001:db8::)
>The identifiers fdff:ffff:ffff:ff80 through fdff:ffff:ffff:ffff.
DHCPv6 works differently than DHCP for IPv4, because there is no broadcast address. Essentially, a host sends a DHCPv6 request from its link-local address to port 547/UDP on ff02::1:2, the all-dhcp-servers link-local multicast group. The DHCPv6 server then usually sends a reply with appropriate information to port 546/UDP on the client's link-local address.
In addition to DHCPv6, IPv6 also supports a second dynamic configuration method, called Stateless Address Autoconfiguration (SLAAC). Using SLAAC, the host brings up its interface with a link-local fe80::/64 address normally. It then sends a “router solicitation” to ff02::2, the all-routers link-local multicast group. An IPv6 router on the local link responds to the host's link-local address with a network prefix and possibly other information. The host then uses that network prefix with an interface ID that it normally constructs in the same way that link-local addresses are constructed. The router periodically sends multicast updates (“router advertisements”) to confirm or update the information it provided.
•Host Names and IP Addresses
It would be inconvenient if you always had to use IP addresses to contact your servers.And so Linux has a number of mechanisms to map a host name to an IP address, collectively called name resolution.
One way is to set a static entry for each name in the /etc/hosts file on each system. This requires you to manually update each server's copy of the file.
For most hosts, you can look up the address for a host name from a network service called the Domain Name System (DNS).DNS is a distributed network of servers providing mappings of host names to IP addresses. In order for name service to work, a host needs to be pointed at a name server. This nameserver does not need to be on the same subnet; it just needs to be reachable by the host. This is typically configured through DHCP or a static setting in a file called /etc/resolv.conf.
**Gathering Network Interface Information**

**•Identifying Network** Interfaces
The ip link command will list all network interfaces available on your system:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rn2b2dt6guhohud3dr4m.png)

**•Displaying IP Addresses**
Use the ip command to view device and address information. A single network interface can have multiple IPv4 or IPv6 addresses.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kfot0nuq8oe4w6rn9xq.png)

**•Displaying Performance Statistics**
The ip command may also be used to show statistics about network performance. Counters for each network interface can be used to identify the presence of network issues. The counters record statistics for things like the number of received and transmitted packets, packet errors, and packets that were dropped.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m6pedv46as2xlywrbou8.png)

**Checking Connectivity Between Hosts**
The ping command is used to test connectivity. The command continues to run until Ctrl+c is pressed unless options are given to limit the number of packets sent.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ddvb8hjx210q7nqxa6rb.png)
The ping6 command is the IPv6 version of ping in Red Hat Enterprise Linux. It communicates over IPv6 and takes IPv6 addresses, but otherwise works like ping.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx4ml2i3gk7ptrkhkel9.png)
Pinging ff02::1 can be useful for finding other IPv6 nodes on the local network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8la1t1eeliyutkep12m8.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2it9lhcmn6ww2z6ya2h.png)
Remember that IPv6 link-local addresses can be used by other hosts on the same link, just like normal addresses.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4jjqg0wl0uzmwo8ydjo.png)
Remember that IPv6 link-local addresses can be used by other hosts on the same link, just like normal addresses.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n0zsgrbipsrz6n22xla0.png)
**Troubleshooting Routing**

**•Displaying the Routing Table**
Use the ip command with the route option to show routing information.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xddfeot00guptb724nmu.png)
Add the -6 option to show the IPv6 routing table:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glgiyp6zgsk3djp236tl.png)
**•Tracing Routes Taken by Traffic**
To trace the path that network traffic takes to reach a remote host through multiple routers, use either traceroute or tracepath. The traceroute command has options to trace the path with UDP (default), ICMP (-I), or TCP (-T) packets. Typically, however, the traceroute command is not installed by default.
The tracepath6 and traceroute -6 commands are the equivalent to tracepath and traceroute for IPv6.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o5fju7ojyurarxawkuln.png)
**•Troubleshooting ports and services**
TCP services use sockets as end points for communication and are made up of an IP address, protocol, and port number.Well-known names for standard ports are listed in the /etc/services file.
The ss command is used to display socket statistics. The ss command is meant to replace the older tool netstat, part of the net-tools package, which may be more familiar to some system administrators but which is not always installed.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjxg035z1k7xlkf2q0mb.png)

**Validating Network Configuration**
Enter into the computer terminal.
Login as user, and enter password.
From workstation, run the lab net-validate start command. The command runs a start script that determine if the host, servera, is reachable on the network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2trr050m1dd50soa853x.png)

1. Use the ssh command to log in to servera as the user. The systems are configured to use SSH keys for authentication and passwordless access to servera.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6so4pxfbu8itzjb3kl64.png)
2. Locate the network interface name associated with the Ethernet address 52:54:00:00:fa:0a. Record or remember this name and use it to replace the enX placeholder in subsequent commands.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ryew3m5q51lzjcjvpjm.png)
3. Display the current IP address and netmask for all interfaces.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6h5pw8s5iyqqe2dtahse.png)
4. Display the statistics for the enX interface.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4i1qznbwef1w4vo80zy.png)
5. Display the routing information.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0z9iu7ebvsorvlf27ibn.png)
6. Verify that the router is accessible.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kejm8q06vu6mzz0ozll5.png)
7. Show all the hops between the local system and classroom.example.com.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmzm0x467ywc3efiqr2x.png)
8. Display the listening TCP sockets on the local system.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rei1uzaltx8dwy6inlye.png)
9. Exit from servera.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s78xixoczsc67b8p0u3x.png)
**Finish**
On workstation, run the **lab net-validate finish** script to finish this exercise.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxf25rmc65cs9cytro8v.png)

**Configuring Networking from the Command Line**

**•Describing NetworkManager Concepts**
Command-line and graphical tools talk to NetworkManager and save configuration files in the /etc/sysconfig/network-scripts directory.

**•Viewing Networking Information**
The **nmcli dev status** command displays the status of all network devices:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7365s7yrwu5cb66smslf.png)
The **nmcli con show** command displays a list of all connections. To list only the active connections, add the --active option.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsdykvlq7qtgyuv8mq71.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wqwlsktxs0oxfit54wmv.png)
**•Adding a network connection**
The **nmcli con add** command is used to add new network connections. 
The name of the configuration file is based on the value of the con-name option, eno2, and is saved to the /etc/sysconfig/network-scripts/ifcfg-eno2 file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypxooxpjfbajcguabwy4.png)
The next example creates an eno2 connection for the eno2 device with a static IPv4 address, using the IPv4 address and network prefix 192.168.0.5/24 and default gateway 192.168.0.254, but still autoconnects at startup and saves its configuration into the same file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0y3izf3s35pkbkq9wec1.png)
This final example creates an eno2 connection for the eno2 device with static IPv6 and IPv4 addresses, using the IPv6 address and network prefix 2001:db8:0:1::c000:207/64 and default IPv6 gateway 2001:db8:0:1::1, and the IPv4 address and network prefix 192.0.2.7/24 and default IPv4 gateway 192.0.2.1, but still autoconnects at startup and saves its configuration into /etc/sysconfig/network-scripts/ifcfg-eno2.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyocj6zmcq4dsrzdfo65.png)
**•Controlling network connections**
The nmcli con up name command activates the connection name on the network interface it is bound to. Note that the command takes the name of a connection, not the name of the network interface.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2zm16f0ed6hswqtpepu.png)
The nmcli dev disconnect device command disconnects the network interface device and brings it down. This command can be abbreviated nmcli dev dis device:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tdu5nng1hy3p9k8g6ru.png)
**•Modifying Network Connection Settings**
Network Manager connections have two kinds of settings. There are static connection properties, configured by the administrator and stored in the configuration files in /etc/sysconfig/network-scripts/ifcfg-*. There may also be active connection data, which the connection gets from a DHCP server and which are not stored persistently.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fs86injsz859xk8rxri.png)
To set the IPv4 address to 192.0.2.2/24 and default gateway to 192.0.2.254 for the connection static-ens3:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2numvgwfimpb3pisa58z.png)
To set the IPv6 address to 2001:db8:0:1::a00:1/64 and default gateway to 2001:db8:0:1::1 for the connection static-ens3:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w5t514bvp2dxzvf4zup.png)
**•Deleting a network connection**
The nmcli con del name command deletes the connection named name from the system, disconnecting it from the device and removing the file /etc/sysconfig/network-scripts/ifcfg-_name_.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8cslslhtnl7xzbvmwci.png)

**Configuring Networking from the Command Line**
Enter into the computer terminal.
Login as user, and enter password.
From workstation, run the **lab net-configure start** command. The command runs a start script that determine if the host, servera, is reachable on the network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbvcdw69ey4jr1yycspy.png)
1. Use the **ssh** command to log in to servera as the user. The systems are configured to use SSH keys for authentication, so a password is not required to log in to servera.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxv5d2qvlst4m1rnqduy.png)
2. Locate network interface names.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/40cny96rdxioqp78i7nn.png)
3. View network settings using nmcli.

3.1 Show all connections.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbx724e0sv48ail7sjp5.png)
3.2 Display only the active connection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57pck9kshz71zqfik0bc.png)
3.3 Display all configuration settings for the active connection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xz52i2g0zoat7cqkyput.png)
Press **q** to exit the command.
3.4 Show device status.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfrqekerep627ans8ym4.png)
3.5 Display the settings for the enX device.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/arb6g67sc6imiikll2x8.png)

4. Create a static connection with the same IPv4 address, network prefix, and default gateway. Name the new connection _static-addr._

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtm5qvrowbjfnlg5y0cj.png)
5. Modify the new connection to add the DNS setting.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ss39i89ik0ywsg7c6j6h.png)
6. Display and activate the new connection.

6.1 View all connections

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c95xjtrgur6h1fc3vbsf.png)
6.2 View the active connection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bn4yw6m08vyrwhryi1rj.png)
6.3 Activate the new static-addr connection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttppv6ugvy943k9w16ce.png)
6.4 Verify the new active connection

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ki04ooqt99agbyswlyjj.png)

7. Configure the original connection so that it does not start at boot, and verify that the static connection is used when the system reboots.

7.1 Disable the original connection from autostarting at boot.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5j6xlb9x6r33ii1zsn00.png)
7.2 Reboot the system.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0qhyomxynu7ccfpxuknw.png)
7.3 View the active connection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzdj3m9undwh0ht5rgal.png)

8. Test connectivity using the new network addresses.

8.1 Verify the IP address.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bd7a9swyw41jpkxlcnpa.png)
8.2 Verify the default gateway.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38st5953n5ri0efst9i4.png)
8.3 Ping the DNS address.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfp3x0tli5id2bl6cyfv.png)
8.4 Exit from servera.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dy1fvf6h7cjui1c0hw6w.png)

**Finish**
On workstation, run the **lab net-configure finish** script to finish this exercise.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4mfzzawhv3xqlerpf1b.png)

**Editing Network Configuration Files**

**•Describing Connection Configuration Files Objectives**
By default, changes made with nmcli con mod name are automatically saved to /etc/sysconfig/network-scripts/ifcfg-name. That file can also be manually edited with a text editor. After doing so, run nmcli con reload so that NetworkManager reads the configuration changes.
**•Modifying network configuration**
It is also possible to configure the network by directly editing the connection configuration files. These files are usually named /etc/sysconfig/network-scripts/ifcfg-name, where name refers to the name of the device or connection that the configuration file controls.
After modifying the configuration files, run nmcli con reload to make NetworkManager read the configuration changes. The interface still needs to be restarted for changes to take effect.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6aoxw9wb415zy5w1alyt.png)
**Editing Network Configuration Files**
Enter into the computer terminal.
Login as user, and enter password.
From workstation, run the **lab net-edit start** command. The command runs a start script that determine if the hosts, servera and serverb, are reachable on the network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imxpugehx0cldc60jqwi.png)
1. Use the ssh command to log in to servera as the user. The systems are configured to use SSH keys for authentication, so a password is not required to log in to servera.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iei046xc8tznyuy4psek.png)
2. Locate network interface names.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npd4tn0yn17bkqpw0pgu.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62wy3oxfnr8z4on5dytu.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fh1giluiamhknaz9sfm0.png)
3. On servera, switch to the root user, and then edit the /etc/sysconfig/network-scripts/ifcfg-Wired_connection_1 file to add an additional address 

3.1 Use the **sudo -i** command to switch to the root user. The password for the student user is student.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s22ch94pd8fq24jpa0hq.png)
3.2 Append an entry to the file to specify the IPv4 address.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccnvfju8ci063lv1z2xi.png)
3.3 Append an entry to the file to specify the network prefix.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wuimffzc4o1ilyeyo3xt.png)

4. Activate the new address.

4.1 Reload the configuration changes.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nuxezulw12ke7wica4ki.png)
4.2 Restart the connection with the new settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3xfu9n5xq8fu00ya57r6.png)

5. Verify the new IP address.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vlpy2zihsmbixmxpjdff.png)
6. Exit from servera to return to workstation as the user.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y29166a2ms3xhzux9hg.png)
7. On serverb, edit the /etc/sysconfig/network-scripts/ifcfg-Wired_connection_1 file to add an additional address,then load the new configuration.

7.1 From workstation, use the ssh command to log in to serverb as the student user.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ceey0xnhnli7xb7ilwn.png)
7.2 Use the sudo -i command to switch to the root user. The password for the student user is student.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lopvptlq5oz17j4mgqn8.png)
7.3 Modify the ifcfg-Wired_connection_1 file to add the second IPv4 address and network prefix.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfd3szsa18i8hts1ucd1.png)
7.4 Reload the configuration changes.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9wuab0r2h1tsmvqcinw.png)
7.5 Bring up the connection with the new settings.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8cr9f4oj1dnfs75thvt.png)
7.6 Verify the new IP address.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21roafwjk0h0qq576ilh.png)

8. Test connectivity using the new network addresses.

8.1 From serverb, ping the new address of servera.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c5jo6fgn8t2khyzzccag.png)
8.2 Exit from serverb to return to workstation.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gr4l46bkl27p1wyq9ukb.png)
8.3 From workstation, use the ssh command to access servera as the student user to ping the new address of serverb.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgj7ht07rbdv50n43zmn.png)

**Finish**
On workstation, run the **lab net-edit finish** script to finish this exercise.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vyic77c4sywnv6sc7ka.png)

**Configuring Host Names and Name Resolution**

**•Changing the system host name**
The hostname command displays or temporarily modifies the system's fully qualified host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykpsihki3kg9h5fb6xi6.png)
A static host name may be specified in the /etc/hostname file. The hostnamectl command is used to modify this file and may be used to view the status of the system's fully qualified host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yyfor38wfr59c8rrjgi9.png)

**Configuring name resolution**
The _stub resolver_ is used to convert host names to IP addresses or the reverse. It determines where to look based on the configuration of the /etc/nsswitch.conf file. By default, the contents of the /etc/hosts file are checked first.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onb9wth52q1gt4m4bi79.png)
The getent hosts hostname command can be used to test host name resolution using the /etc/hosts file.
If an entry is not found in the /etc/hosts file, by default the stub resolver tries to look up the hostname by using a DNS nameserver. The /etc/resolv.conf file controls how this query is performed:
> _search_: a list of domain names to try with a short host name. Both this and domain should not be set in the same file; if they are, the last instance wins. See resolv.conf for details.
> _nameserver_: the IP address of a nameserver to query. Up to three nameserver directives may be given to provide backups if one is down.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2372aq4owz4q249o2k5.png)
NetworkManager updates the /etc/resolv.conf file using DNS settings in the connection configuration files. Use the nmcli command to modify the connections.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9emphm04xidgq43giq08.png)
The default behavior of _**nmcli con mod ID ipv4.dns IP**_ is to replace any previous DNS settings with the new IP list provided. A + or - symbol in front of the _**ipv4.dns**_ argument adds or removes an individual entry.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lt23ev68xuyjjeoamvf9.png)
To add the DNS server with IPv6 IP address 2001:4860:4860::8888 to the list of nameservers to use with the connection static-ens3:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5f165iyq43p4zwdu9lu.png)

**Testing DNS Name Resolution**
The host HOSTNAME command can be used to test DNS server connectivity.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5re4na6n0hv9xc3wkm7v.png)
DHCP automatically rewrites the /etc/resolv.conf file as interfaces are started unless you specify PEERDNS=no in the relevant interface configuration files. Set this using the **nmcli** command.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqv7eop6yy4im4g3vh1w.png)

**Configuring Host Names and Name Resolution**
Enter into the computer terminal.
Login as user, and enter password.
From workstation, run the **lab net-hostnames start** command. The command runs a start script that determine if the host, servera, is reachable on the network.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckbxvo95bgddb6o6qnmd.png)
1. Use the **ssh** command to log in to servera as the user. The systems are configured to use SSH keys for authentication, so a password is not required to log in to servera.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v23ifnfep1v1wcrl0mew.png)
2. View the current host name settings.

2.1 Display the current host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgfo8rwa6ljlcvty9d6v.png)
2.2 Display the host name status.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h0fijtji89ivkijbj77.png)

3. Set a static host name to match the current transient host name.

3.1 Change the host name and host name configuration file.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2jbskrwc1cu5dz7yya3.png)
3.2 View the content of the /etc/hostname file which provides the host name at network start.
3.3 Display the host name status.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ja9uc286x88e4v2vfsv.png)

4. Temporarily change the host name.

4.1 Change the host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z3hmbzs5xto2aj9zmfo.png)
4.2 Display the current host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s72lswdauvy48yp2cw9b.png)
4.3 View the content of the /etc/hostname file which provides the host name at network start.
4.4 Reboot the system
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt4dmnkx8y2f98525b8u.png)
4.5 From workstation log in to servera as student user.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iif5xe5ww71s9j18dl76.png)
4.6 Display the current host name.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gngi36n5bukjhcd63dxc.png)

5. Add a local nickname for the classroom server.

5.1 Look up the IP address of the 
classroom.example.com.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ln798hjw8nc16yt071zf.png)
5.2 Modify /etc/hosts so that the additional name of class can be used to access the IP address.
5.3 Look up the IP address of class.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fp5yso9w6x22nc7j23oh.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slm6ofkb89pd1io9sf3f.png)
5.5 Ping class.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3598dcib3wz82tqxygqx.png)
5.6 Exit from servera.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7lmotl7d7ic4vouwuf3t.png)

**Finish**
On workstation, run the **lab net-hostnames finish** script to finish this exercise.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xh1hpiy8e5mwk8vtghhb.png)