Bookmark this page

Guided Exercise: Edit Network Configuration Files

In this exercise, you manually modify network configuration files and ensure that the new settings take effect.

Outcomes

  • Configure additional network addresses on each system.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start net-edit

Instructions

  1. On the workstation machine, use the ssh command to log in to the servera machine as the student user.

    [student@workstation ~]$ ssh student@servera
    ...output omitted...
    [student@servera ~]$
  2. Locate network interface names with the ip link command.

    Important

    Network interface names are determined by their bus type and the detection order of devices during boot. Your network interface names might vary according to the course platform and hardware in use.

    Locate the network interface name that is associated with the Ethernet address on your system. Record or remember this name, and use it to replace the enX placeholder in subsequent commands. The active connection is called Wired connection 1, and the configuration is in the /etc/NetworkManager/system-connections/"Wired connection 1.nmconnection" file.

    [student@servera ~]$ ip link
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
        link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff
        altname enp0s3
        altname ens3
    [student@servera ~]$ nmcli con show --active
    NAME                UUID                                  TYPE      DEVICE
    Wired connection 1  a98933fa-25c0-36a2-b3cd-c056f41758fe  ethernet  eth0
    [student@servera ~]$ ls /etc/NetworkManager/system-connections/
    'Wired connection 1.nmconnection'
  3. On the servera machine, switch to the root user, and then edit the /etc/NetworkManager/system-connections/"Wired connection 1.nmconnection" file to add the 10.0.1.1/24 address.

    1. Use the sudo -i command to switch to the root user.

      [student@servera ~]$ sudo -i
      [sudo] password for student: student
      [root@servera ~]#
    2. Edit the configuration file. Add the 10.0.1.1/24 address as the second address below the first address in the file.

      [root@servera ~]# vim /etc/NetworkManager/system-connections/"Wired connection 1.nmconnection"
      ...output omitted...
      [ipv4]
      address1=172.25.250.10/24,172.25.250.254
      address2=10.0.1.1/24
      ...output omitted...
  4. Activate the new network address with the nmcli command.

    1. Reload the configuration changes for NetworkManager to read the changes.

      [root@servera ~]# nmcli con reload
    2. Activate the connection with the changes.

      [root@servera ~]# nmcli con up "Wired connection 1"
      Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
  5. Verify that the new IP address is assigned successfully.

    [root@servera ~]# ip -br addr show eth0
    eth0:       UP       172.25.250.10/24 10.0.1.1/24 fe80::6fed:5a11:4ad4:1bcf/64
  6. Return to the workstation machine as the student user.

    [root@servera ~]# exit
    logout
    [student@servera ~]$ exit
    logout
    Connection to servera closed.
    [student@workstation ~]$
  7. On the serverb machine, edit the /etc/NetworkManager/system-connections/"Wired connection 1.nmconnection" file to add an address of 10.0.1.2/24 and load the new configuration.

    1. Log in to the serverb machine as the student user and switch to the root user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]#
    2. Edit the configuration file. Add the 10.0.1.2/24 address as the second address below the first address in the file.

      [root@serverb ~]# vim /etc/NetworkManager/system-connections/"Wired connection 1.nmconnection"
      address1=172.25.250.11/24,172.25.250.254
      address2=10.0.1.2/24
    3. Reload the configuration changes for NetworkManager to read the changes.

      [root@serverb ~]# nmcli con reload
    4. Activate the connection with the changes.

      [root@serverb ~]# nmcli con up "Wired connection 1"
      Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
    5. Verify that the new IP address is assigned successfully.

      [root@serverb ~]# ip -br addr show eth0
      eth0       UP       172.25.250.11/24 10.0.1.2/24 fe80::6be8:6651:4280:892c/64
  8. Test connectivity between the servera and serverb machines by using the new network addresses.

    1. From the serverb machine, ping the new address of the servera machine.

      [root@serverb ~]# ping -c3 10.0.1.1
      PING 10.0.1.1 (10.0.1.1) 56(84) bytes of data.
      64 bytes from 10.0.1.1: icmp_seq=1 ttl=64 time=1.30 ms
      64 bytes from 10.0.1.1: icmp_seq=2 ttl=64 time=0.983 ms
      64 bytes from 10.0.1.1: icmp_seq=3 ttl=64 time=0.312 ms
      
      --- 10.0.1.1 ping statistics ---
      3 packets transmitted, 3 received, 0% packet loss, time 2003ms
      rtt min/avg/max/mdev = 0.312/0.864/1.297/0.410 ms
    2. Return to the workstation machine as the student user.

      [root@serverb ~]# exit
      logout
      [student@serverb ~]$ exit
      logout
      Connection to serverb closed.
      [student@workstation ~]$
    3. Access the servera machine as the student user to ping the new address of the serverb machine.

      [student@workstation ~]$ ssh student@servera ping -c3 10.0.1.2
      PING 10.0.1.2 (10.0.1.2) 56(84) bytes of data.
      64 bytes from 10.0.1.2: icmp_seq=1 ttl=64 time=0.876 ms
      64 bytes from 10.0.1.2: icmp_seq=2 ttl=64 time=0.310 ms
      64 bytes from 10.0.1.2: icmp_seq=3 ttl=64 time=0.289 ms
      
      --- 10.0.1.2 ping statistics ---
      3 packets transmitted, 3 received, 0% packet loss, time 2047ms
      rtt min/avg/max/mdev = 0.289/0.491/0.876/0.271 ms

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish net-edit

This concludes the section.

Revision: rh199-9.0-4fecb06