Configure networking and hostname resolution statically or dynamically

Jamal is a RHEL Sysadmin at IBM. Today, he has to teach a class of 12 interns the following: Configure networking and hostname resolution statically or dynamically. He has to show them sample commands, and explain everything that he is doing. His server is RHEL_Server_147 and his username is jamal.boyd. He NEVER runs commands as the root user.

To teach the interns how to configure networking and hostname resolution on RHEL_Server_147, Jamal will demonstrate the process with sample commands and explanations. Here's what he will cover:

  1. Check the current network configuration:

    • ip addr show
  2. Configure networking statically:

    • Edit the network configuration file:
      • nano /etc/sysconfig/network-scripts/ifcfg-<interface_name>
      • Replace <interface_name> with the name of the network interface (e.g., eth0).
    • Modify the file as follows:
      • TYPE=Ethernet
        BOOTPROTO=none
        NAME=<interface_name>
        DEVICE=<interface_name>
        ONBOOT=yes
        IPADDR=<IP_address>
        NETMASK=<netmask>
        GATEWAY=<gateway_IP>
        DNS1=<DNS_server_IP>
        DNS2=<optional_secondary_DNS_server_IP>
      • Replace <IP_address>, <netmask>, <gateway_IP>, <DNS_server_IP>, and <optional_secondary_DNS_server_IP> with the appropriate values.
      • Save the changes and exit the editor.
  3. Restart the network service:
    • systemctl restart network
  4. Check the network configuration to verify changes:
    • ip addr show
  5. Configure hostname resolution dynamically using DHCP:
    • Edit the network configuration file for the interface:
      • nano /etc/sysconfig/network-scripts/ifcfg-<interface_name>
      • Replace <interface_name> with the name of the network interface (e.g., eth0).
      • Modify the file as follows:
        • TYPE=Ethernet
          BOOTPROTO=dhcp
          NAME=<interface_name>
          DEVICE=<interface_name>
          ONBOOT=yes
      • Save the changes and exit the editor.
  6. Restart the network service:
    • systemctl restart network
  7. Check the network configuration to verify changes:
    • ip addr show
  8. Verify hostname resolution using DNS:
    • Check the current hostname:
      • hostname
    • Edit the hostname configuration file:
      • nano /etc/hostname
    • Modify the file to set the desired hostname:
      • <desired_hostname>
      • Replace <desired_hostname> with the hostname you want to set.
      • Save the changes and exit the editor.
  9. Update the hostname without a system reboot:
    • hostnamectl set-hostname <desired_hostname>
    • Replace <desired_hostname> with the hostname you want to set.

Jamal will demonstrate each step and explain its purpose to the interns. By following these instructions and practicing the commands, the interns will gain the knowledge and skills to configure networking and hostname resolution statically or dynamically on RHEL systems.

 

You should also read:

Configure a caching DNS server

Segun is a RHEL Sysadmin at Red Hat. He administers RHEL_Server_047, and his username is segun.okuns. His supervisor wants Segun to demonstrate how…