(RHCSA) Manage Basic Networking

This is part of the RHCSA Exam Study Guide series

image

This is part of the independent and unofficial RHCSA Exam Study Guide series providing free šŸ¤‘ resources to prepare for the exam.

This post covers the objectives under the section:

“MANAGE BASIC NETWORKING”

It contains two main parts:

  • Resources: with links to learn and practice for each objective.
  • Cheatsheet: containing some examples of commands and actions performed in each objective (when applied).

šŸ“š Resources:

CONFIGURE IPV4 AND IPV6 ADDRESSES
CONFIGURE HOSTNAME RESOLUTION
CONFIGURE NETWORK SERVICES TO START AUTOMATICALLY AT BOOT
RESTRICT NETWORK ACCESS USING FIREWALL-CMD/FIREWALL

šŸ“‘ Cheatsheet:

CONFIGURE IPV4 AND IPV6 ADDRESSES
  • Change IPv4 address manually editing the network script file:

    • ifconfig or ip a āž” display information of all network devices.
    • /etc/sysconfig/network-scripts/enp7s0 āž” edit this file to update the connections settings.
      BOOTPROTO=static
      IPADDR=192.168.1.5
      NETMASK=255.255.255.0
      GATEWAY=192.168.1.1
      
    • nmcli connection down enp7s0 && nmcli connection up enp7s0 āž” restart the connection.
  • Change IPv4 address using nmcli tool:

    • nmcli connection modify enp7s0 IPv4.address 192.168.1.5/24 āž” change IP address.

    • nmcli connection modify enp7s0 IPv4.gateway 192.168.1.1 āž” change gateway address.

    • nmcli connection modify enp7s0 IPv4.method manual āž” sets BOOTPROTO option to none.

  • nmcli connection modify enp7s0 ipv6.method "disabled" āž” Disable ipv6 using nmcli tool.

  • ping -c2 alldrops.info āž” test IPv4 connection issuing two ping packets to alldrops.info.

  • ping6 -c2 alldrops.info āž” test IPv6 connection issuing two ping packets to alldrops.info.

  • nmtui āž” command line tool with graphical interface to manage network connections.

CONFIGURE HOSTNAME RESOLUTION
  • cat /etc/resolv.conf āž” check DNS lookup definitions.

  • 192.168.0.120 server20.example.com server20 on /etc/hosts file āž” map hostname server20 to the ip provided.

  • ping -c2 server20 āž” test hostname resolution issuing two ping packets to server20.

  • dig, host, nslookup, getent āž” tools to query DNS.

CONFIGURE NETWORK SERVICES TO START AUTOMATICALLY AT BOOT
  • Configure a Network Connection manually at network-scripts dir:

    • ip address or ip a āž” verify info for network interfaces.
    • /etc/sysconfig/network-scripts/ifcfg-enp7s0 āž” create this file to add a new profile for the network interface (use antoher file in the folder as a starting point).
    • ifdown enp7s0, ifup enp7s0 āž” reactivate interface.
  • Configure a Network Connection using nmcli (preferred way):

    (Requires NetworkManager service)

    • systemctl status NetworkManager āž” check if enabled and active.
    • nmcli d s, nmcli device show āž” check presence of a new interface.
    • nmcli con add type Ethernet ifname enp7s0 con-name enp7s0 ip4 172.10.10.120/24 gw4 172.10.10.1
    • nmcli c s, nmcli connection show āž” confirm new connection status.
    • cat /etc/sysconfig/network-scripts/ifcfg-enp7s0
    • ip a āž” confirm ip assignments for the new connection.
    • nmcli c down enp7s0 āž” deactivate connection.
    • nmcli c up enp7s0 āž” deactivate connection.
RESTRICT NETWORK ACCESS USING FIREWALL-CMD/FIREWALL
  • firewall-cmd --state, systemctl status firewalld āž” check if the service is enabled and active.

  • firewall-cmd --get-default-zone āž” display default zone name.

  • firewall-cmd --get-active-zones āž” display active zones.

  • firewall-cmd --get-zones āž” display all available zones.

  • firewall-cmd --set-default-zone=home āž” set default zone to home.

  • firewall-cmd --list-all āž” display information about the defualt zone.

  • firewall-cmd --list-all --zone=home āž” display information about home zone.

  • firewall-cmd --list-all-zones āž” list all zones.

  • firewall-cmd --list-services āž” list allowed services in the current zone.

  • firewall-cmd --list-ports āž” list allowed ports in the current zone.

  • firewall-cmd --zone=public --list-services āž” list allowed services for the specific zone.

  • Permanently add a Port to a zone:

    • firewall-cmd --add-port 443/tcp --zone=public --permanent āž” add port to public zone.

    • firewall-cmd --reload āž” reload to apply the changes.

  • Permanently add a Service to a zone:

    • firewall-cmd --add-service=httpd --zone=public āž” add port to public zone.

    • firewall-cmd --runtime-to-permanent āž” make changes persist.

  • firewall-cmd --change-interface=enp7s0 --zone=home --permanent āž” change specified interface to specified zone.


Next:

(RHCSA) Manage Users and Groups

…or back to Red Hat Certified System Administrator (RHCSA) Exam Study Guide



Footnotes:

  • Follow me on Twitter to get more posts like this and other quick tips in your feed.
  • If you have any doubts or tips about this article, Iā€™d appreciate knowing and discussing it via email.
  • Do you have any other Linux tips? Would you like to publish that in this blog? Please send an email to all drops.
  • As English is not my native language, I apologize for the errors. Corrections are welcome.
  • Contact: contact [@] alldrops [.] info.

Read more on linux drops: