This tutorial explains how to prepare and setup a computer for RHCE practice lab with initial configuration (such as hostname, IP address, hosts entries, etc.) in detail with example. Build your own RHCE practice lab with this essential RHCE practice lab configuration guide.
This tutorial is second part of our article “Setup RHCE/RHCSA Practice Lab in VMware or Virtual Box step by step”. First part of this tutorial explains how to create, prepare and configure virtual machines in VMware or in Virtual Box for RHCE practice lab. You can read first part of tutorial here
For demonstration purpose I will use the practice lab which I created in first of this tutorial.
To use these computers in RHCE LAB, we need to make some essential configurations such as hostname and IP address.
In this tutorial we will understand these configurations in detail. Let’s start with host name and IP address.
|System/Virtual Machine||Host Name||IP Address||Subnet Mask||Default Gateway||DNS Server|
|First (compulsory)||server.example.com||192.168.1.1||255.255.255.0 (/24)||192.168.1.1||192.168.1.1|
|Second (optional)||ipa.example.com||192.168.1.2||255.255.255.0 (/24)||192.168.1.1||192.168.1.1|
|Third (compulsory)||client.example.com||192.168.1.100||255.255.255.0 (/24)||192.168.1.1||192.168.1.1|
|Fourth (optional)||win.example.com||192.168.1.101||255.255.255.0 (/24)||192.168.1.1||s192.168.1.1|
Every computer in a LAN segment requires a unique hostname. Hostname can contain alphabets, numbers, dash, underscore and dot characters. Maximum 64 characters are allowed in hostname. Usually hostname reflects the functionality of system. Hostname is stored in /etc/hostname file.
In earlier version of RHEL hostname was stored in /etc/sysconfig/network file.
We can read hostname directly from the file or we can use following commands to view it at command prompt
- uname –n
We can update hostname in two ways; either via command prompt or via directly editing in file.
I will explain both methods. Since in our lab two virtual machines (second and third) are cloned from first virtual machine,
they all have same hostname. We do not need to update the hostname on first virtual machine as it already has correct name.
Let’s update the hostname of second virtual machine from hostnamectl command.
This command will update the hostname in /etc/hostname configuration file.
New hostname will be applied on system at next boot. You can verify the change from hostname command which
read hostname from configuration file.
Let’s update the hostname of third virtual machine from second method. Open /etc/hostname file and set
the new hostname and save the file.
In our lab we have one more (optional) computer with window 7 installation. To update the hostname in Windows 7 follow the following steps:-
Click Start button and right click the Computer from open menu click Properties
Form Computer name sub section, update the computer name.
Restart the computers which hostname have been updated.
IP (Internet Protocol) Address
IP address is a 32 bit long software address. In IP network every computer needs this address to communicate with other computers.
A computer can obtain this address statically or dynamically. In static method we have to configure it manually.
In dynamic method it is leased from DHCP server. Static method is used for critical network resources such as server,
printer etc. Dynamic method is used for workstations or terminals.
To view the current IP configuration we can use ip addr show command.
In earlier version of RHEL ifconfig command was used to view the current IP configuration. ifconfig command has been deprecated from RHEL7.
As above figure shows NIC enol6777736 is configured with IP address 192.168.122.1/24.
If you have worked with RHEL-6 or earlier versions, you may be a little bit surprise about the name used by NIC.
A lot of things have changed in RHEL 7 including naming convention used by NIC. In earlier version NICs were named as
eth (Ethernet), em (embedded) and wlan (wireless lan). NICs were numbered based on the order of detection
during the system boot. For example first discovered Ethernet (eth) would be named and numbered as eth0.
This naming scheme has scalability issue. For example a system which has multiple NICs and NICs are dynamically
removed or added. In this situation this naming scheme will work not effectively.
Naming convention used for NIC in RHEL 7
From RHEL7 default naming convention for NICs is based on firmware, device, topology and device types. With new naming convention network card names always remain consist. In new naming convention :-
- First two letters represents the type of NIC. For Ethernet interface it always begins with en, for WLAN interfaces it begins with wl, for loopback adapters it starts with lo and for WWAN it begins with ww.
- Next letter represents the location of NIC. For onboard letter o is used, for hot plug slot letter a is
used and for PCI slot letter p is used.
- Remaining numeric numbers represents the index, port or ID number.
For example above figure illustrates the name used by NIC is eno16777734.
In this name en stands for Ethernet device, o stands for onboard and 16777734
stands for unique index number. Combinedly eno16777736 stands for an onboard Ethernet device (with its unique index number).
NIC Configuration files
Every NIC has an associated configuration file which stores its relative parameters such IP address, protocol and
configuration values. These configuration settings are automatically applied on NIC while it get activated.
RHEL uses a central location for all (NIC) configuration files which is /etc/sysconfig/network-scripts directory.
Configure IP Address
To configure IP address we have three options; nmtui text tool, nmcli command
and nm-connection-editor graphic utility. We will understand all three options one by one. Let’s start with nmtui text tool.
While running this tool make sure you are logged in from root user as normal user account is not allowed to make change in configuration. Execute nmtui command from root account on first computer (named – server).
Select “Edit a connection” and press enter key.
Select NIC from left pane on which you want to set the IP address and select Edit option from right pane and press Enter key.
Select Automatic from IPv4 configuration and press enter key
Select Manual from available options
Navigate to Show option and press Enter key
Set the IP address / subnet mask, Gateway IP address and DNS Server IP address.
Select OK and press Enter key to accept the change
Select Quit and press Enter key
When we exit from nmtui utility, it automatically updates the associated configuration files.
For instance in above example we have assigned IP configuration to NIC eno16777736.
In this case nmtui will update the
An interface restart is required to apply the new configuration.
We can use ifdown-[NIC] and ifup-[NIC] commands to
restart the interface.
So far we have assigned IP address to our first computer. Now we will assign IP address to second computer (named – ipa).
This time we will use graphical utility nm-connection-editor.
Login from root account and open terminal. In terminal execute nm-connection-editor command.
From opened window select appropriate NIC and click Edit option
Switch to IPv4 Settings and select Manual option from Method drop down menu.
Click Add button and configure IP addresses in respective fields and click Save button and Close button at main screen.
Restart the interface and verify the new IP configuration.
So far we have assigned IP addresses in two computers now it’s time to configure the third system (named – client).
This time we will use nmcli command to assign the IP addresses. Login from root account and assign IP addresses as
illustrate in following figure.
nmcli con show:- This command will list the available connections with their associated devices.
As above figure shows connection eno16777736 is associated with Ethernet device eno16777736. We have to modify this connection in order to update the IP configuration.
nmcli con mod eno16777736 ipv4.addresses 192.168.1.100/24 :- This command will update (modify) the connection with new IP address and subnet mask.
nmcli con mod eno16777736 ipv4.gateway 192.168.1.1 :- This command will update (modify) the connection with new default gateway IP address.
nmcli con mod eno16777736 ipv4.dns 192.168.1.1 :- This command will update (modify) the connection with new DNS Server IP address.
As we know new IP configuration applies on start-up. Next two commands will restart the interface.
ifdown eno16777736 :- This command will shut down the interface.
ifup eno16777736 :- This command will bring up the device back.
- nm-connection-editor is available only in X-Window system. It provides less but sufficient features for end users to manage the network connections. Network administrators rarely use this tool to manage the network connections.
- Usually nmcli command and nmtui tool are used to manage the network connection.
- nmcli command is provided by NetworkManager software package.
- nmtui tool is provided by NetworkManager-tui software package.
- Both packages are installed and enabled by default unless you manually remove or deactivate them.
- Among these options, nmcli command is the most powerful.
- nmcli command is little bit hard to learn but works in every condition.
- In exam you can use nmtui text tool instead of nmcli command.
- For real life system administration its worth to learn nmcli command as
it is available in most situations such as rescue mode, remote connection, terminal etc.
Finally let’s update the IP configuration in windows system. Open Network and sharing center and click Change adapter settings
Right click the “Local Area connection” and click Properties
Select “Internet Protocol Version 4 (TCP/IPv4)” and click Properties
Set the IP address, subnet mask, default gateway and DNS Server IP address and click OK twice to save and close the configuration.
Computers access each other through the IP address. So from computer’s prospective we are all set to go.
But from human’s point of view we need one more setting. We need to map IP address with hostname so it can be accessed from hostname as well.
Mapping hostname with IP address
In a mid or large size network this process is done by DNS Server. In our LAB we will configure DNS Server in our first system (named – sever). DNS Server adds its own complexity in network. Due to this administrators prefer to skip this in small size or internal network. In absence of DNS Server host tables are used to map the hostname with IP address. Host table is stored in /etc/hosts file. This table maps IP addresses with hostnames of all computers on the local network.
Once host table is updated we can access any computer from network with its hostname instead of IP address. Usually host table have three columns. First column contains the IP address, second column contains the official hostname and third column contains alias. If host have multiple aliases, they can be added in subsequently columns. Since all computers have entry for all computers in their host table, host table becomes identical on all computers.
Host table for our LAB will be following:-
19126.96.36.199 server.example.com server 192.168.1.2 ipa.example.com ipa 192.168.1.100 client.example.com client 192.168.1.101 win.example.com win
Updating host table in RHEL is relatively easy. Open /etc/hosts file for editing
default file may have entries for localhost which is the default hostname on RHEL system.
Remove the default entries and insert new entries as mentioned earlier and save the file.
That’s all, our first computer is ready to access other computers from name. Repeat same process on remaining two RHEL systems (ipa and client).
On windows system process will be different. Windows stores hosts file in windows\\system32\\drivers\\etc\\ directory.
Just like Linux we need administrator privilege to edit this file. Open Notepad with administrator privilege.
Based on UAC setting windows may ask you to confirm the action. If asks, click yes.
Open hosts file in notepad
Make entries for all LAB systems and save the file.
By default windows 7 has firewall turn on, which need to be properly configured before we can access it from network. Since we are preparing this LAB for RHCE and windows system will only be used to test services configured on Linux system, we can safely turn off the firewall.
Access Windows Firewall option from Control Panel
Turn off the firewall and save the setting.
That’s all setting we need. Now all LAB systems should be able to communicate with each other’s. Let’s test our configuration.
Testing the RHCE LAB Setup
We can use ping command to test the connectivity between computers. Ping all computers from server system. If ping command is getting reply from all computers then we have successfully setup the LAB for RHCE practice.
That’s all for this article.
Full Version EX300 Dumps
Try EX300 Dumps Demo