Intro to Linux (SYS 255) - Chromosom3/TechNotes GitHub Wiki
Linux Configuration
Network Configuration on CentOS
You can configure the network settings on CentOS in two different ways. The first is with a utility called nmutil and the second is editing your network configuration file. First I will cover using nmutil then I will go into editing the config file.
Using NMTUI
To open nmtui simply type nmtui
and a dialog will appear. On that dialog select edit a connection. Select the dive you want to edit and then select edit. You will want to change your IPv4 (or IPv6 depending on your network setup and use case) configuration from automatic to manual. Next, you want to show the configuration for the selected IP version that you are working on. You will specify your address (what this machine will use), the gateway, the DNS servers, and the search domain. For this lab the config was similar to the following, the only difference being the search domain. For my system, I did dylan.local, where the example has devin.local. Once you have your settings select OK.
You will also want to set a system hostname. On the screen where you select your interface to edit hit back. This will take you to the original dialog where you can select set system hostname. Once you select that option type in the hostname you desire and hit ok. Make sure to restart your network service to apply (systemctl restart network
).
Editing a config file
Before you assign the network setting to your system you need to know what interface you are going to edit. To see your interfaces you can do ifconfig
or ip addr
. Next navigate to the directory /etc/sysconfig/network-scripts
and open the ifcfg file for your network interface. Next you can edit your network config to be similar to the one below. This example is based on the lab network settings. Make sure to restart your network service to apply (systemctl restart network
).
BOOTPROTO=none
ONBOOT=yes
IPADDR=10.0.5.200
PREFIX=24
GATEWAY=10.0.5.2
DNS1=10.0.5.5
DOMAIN=dylan.local
To set the hostname you can use the following command:
hostnamectl set-hostname HOSTNAME_YOU_WANT
Adding a User
For this lab, we needed to create a privileged user. For more in-depth information on adding a user account and securing them click here. Simply for this lab all you need to do is create a new user using the useradd
command, set a password with the passwd
command, and then add the user to the wheel (admin) group using usermod -aG wheel username
.