cancel
Showing results for 
Search instead for 
Did you mean: 
Vincent2
Mission Specialist
Mission Specialist
  • 7,270 Views

nmcli vs manually configuring files

Jump to solution

I am currently studying for the RHCSA and my practice exams are asking me to configure the IP address, gateway ip address and nameserver ip.

What are the commands for achieving this and/or what are the manual ways of achieving this. Or is just best doing it with nmcli only?

Thank you for your help.

18 Replies
Boda
Mission Specialist
Mission Specialist
  • 1,741 Views

I had network config issues while taking ex200 exam.
I used the exam provided addresses for ip dns, gateway, nameserver and netmask but I was unable to connect my VM1 and VM2 via nmcli
tools. All address entries were correct but the VMs failed to connect with this error "172.24.1.10 icmp_seq=1 Destination Host Unreachable"
I have done a couple online research but I truly don't know what I am missing or getting wrong. I have tried re-create the error on my home lab
but I failed. Can you help, please?

Chetan_Tiwary_
Moderator
Moderator
  • 1,609 Views

Hi @Boda ,

Please verify the network configuration with the objective. Try to troubleshoot /edit any wrong or missed part of network configuration. 

You can use several commands to check the current config or status of your network settings :

Command Purpose
nmcli dev status Show the NetworkManager status of all network interfaces.
nmcli con show List all connections.
nmcli con show name

List the current settings for the connection name.

 

nmcli con mod name    Modify the connection name.
nmcli con reload Reload the configuration files, after manual file editing.
nmcli con up name Activate the connection name.

 

nmcli dev status  & nmcli dev show

 will show you the state of the desired connection and the network settings like : ( example)

IP4.ADDRESS[1]:                 172.25.250.10/24
IP4.GATEWAY:                    172.25.250.254
IP4.ROUTE[1]:                   dst = 172.25.250.0/24, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                   dst = 0.0.0.0/0, nh = 172.25.250.254, mt = 100
IP4.DNS[1]:                     172.25.250.220
IP4.SEARCHES[1]:                lab.example.com

 Match the settings with the objective and try to find out the error or issue. Also check the 

ipv4.method & connection.autoconnect 

 and then try to ping the DNS / Gateway server. if everything is correctly set , this ping should get pong. 

DONT forget to restart / reload  your connection if you edit any network configuration.

Trevor
Starfighter Starfighter
Starfighter
  • 1,634 Views

Hello Boda,

I may have to ask you a series of questions through multiple posts.  I'll begin with this question:   When you configured your IP address information for your 2 VMs, did you verify that you ethernet interfaces, on both VMs, were in an "up" state?

 

Trevor "Red Hat Evangelist" Chandler
Boda
Mission Specialist
Mission Specialist
  • 1,622 Views

Thanks for your reply, yes, I did "nmcli con show --active" on VM1 and it showed "name and device" like "device = enp and virbr0" Name " enp and virb". when i tried to configure the connection by using " nmcli con modify " then i tried to write enp then press tab to continue the name of the connection but failed when i tried to use virb then press tab it worked. 

I tried to write " nmcli con modify enp0s03 ipv4.addresses "ip address" but failed. I don't know, what is the mistake? can you help me? 

Note: when I started the exam " I did " status, console, shutdown and rebuild" on VM1 "

rp_rhel
Cadet
Cadet
  • 768 Views

It seems editing the ifcfg- files directly messes up NetworkManager.

nmcli (NM or Networkmnagaer) is not helpful. Best way is to do by hand - directly edit ifcfg files.

that way you konw exactly what is the config.

Akyuz_Remzi
Mission Specialist
Mission Specialist
  • 757 Views

The use of ifcfg files has been removed by default in rhel8/9. for backwards compatibility it is still usable.
It is therefore useful to learn how to use Network manager(nmtui or nmcli) .
I have been using the nmcli command for a long time without any problems.

 

rp_rhel
Cadet
Cadet
  • 729 Views

Hello Akyuz,

Are you RedHat employee? I am more comfortable with CLI editing. Dont know in which many temp/cache/folder locations GUI component stores data.

Or otherwise GUI tools should spit out the series of command sthey run behind the scene to get the taks done. So that we know exactly where to look if things mess up.

Finally, from RedHat I want to know what effect does it has on config if I do everything by creating/editing files in network-scripts folder?

Thank you.

Akyuz_Remzi
Mission Specialist
Mission Specialist
  • 710 Views

Hi,
I am not a red Hat employee or developer. I am linux system engineer.

However I have enough knowledge and experience with linux systems(RHEL base, Debian base or SuSe base linux distro).

Using a network manager is not exclusive to RHEL. All current distributions have started using Network Manager. You can look at Ubuntu as an example. https://ubuntu.com/core/docs/networkmanager. Frankly, I'm glad most distributions started using Network Manager, because each distribution used its own unique settings file. Now the network configuration is standardized.

To learn the details, you can learn about NetworkManager and its infrastructure. This is not a Red Hat issue.

The following link may be useful to start learningn in detail.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager

The following image is from a rhel 9 system with minimal installation.

Akyuz_Remzi_0-1704346327182.png

 



Have a fun day with linux.

Chetan_Tiwary_
Moderator
Moderator
  • 691 Views

@rp_rhel I second what @Akyuz_Remzi has mentioned. I think it is better to be familiarize with NM as this is what is going to be there.

Here please read this blog : https://www.redhat.com/sysadmin/becoming-friends-networkmanager 

0 Kudos
Join the discussion
You must log in to join this conversation.