cancel
Showing results for 
Search instead for 
Did you mean: 
Vincent2
Mission Specialist
Mission Specialist
  • 11.2K 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.

1 Solution

Accepted Solutions
UWillC
Mission Specialist
Mission Specialist
  • 7,324 Views

Based on my experience I would recommend to use nmtui

From the exam perspective you will provide jus one command and then choose proper options to set all the options required for network configuration as well as to easily change the hostname if required.

With nmtui you will be able to set the ip address, subnet mask, default gateway and DNS server in one tool which comparing to nmcli will be long command to modify the existing connection

nmcli connection modify CONNECTION_NAME ipv4.method manual ipv4.address A.B.C.D/MASK_IN_BIT_NOTATION ipv4.dns A.B.C.D

or to create new one

nmcli connection add type ethernet ifname INTERFACE_NAME ipv4.method manual ipv4.address A.B.C.D/MASK_IN_BIT_NOTATION ipv4.dns A.B.C.D connection.id CONNECTION_NAME

after this you will nedd to brint the connection up

nmcli connection up CONNECTION_NAME

and to verify the settings manually, moreover you can easily forget to add something where in nmtui you have all the options avaiable opn one screen.

nmtui - Edit a connectionnmtui - Edit a connection

View solution in original post

Tags (1)
18 Replies
74razor
Flight Engineer
Flight Engineer
  • 7,998 Views

I'm new to studying myself, so I can just tell you what I've learned thus far. You can always just navigate to /etc/sysconfig/network-scripts/. This location will have the network interface profile file. Use VIM to edit the file to change the IP information. Then ESC, :wq to write changes. Now, I am not sure, but I think you might have to actually reboot the box for these changes to take effect. I could be wrong, someone please correct me if that is the case. 

Also, you can use the nmcli as you mentioned. The documentation is located here - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-c...

Fran_Garcia
Starfighter Starfighter
Starfighter
  • 7,964 Views

Besides restarting the system, you can also stop/start the affected network configuration with "nmcli connection down 'TheConectionName' ; nmcli connection up 'TheConecctionName'" or alternatively restarting network-manager with systemctl restart NetworkManager . Hardly ever you need to restart a system to make network changes -- that'd be difficult to address in a production scenario.

Remzi
Flight Engineer
Flight Engineer
  • 7,987 Views

Hi Vincent,

Best way using nmcli.  nmcli is very usefull tools.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and...

 

Good luck.

 

Tags (2)
JustinP
Flight Engineer
Flight Engineer
  • 7,345 Views

RH's official docs (under access.redhat.com) aren't available during exams, and the OP is studying for RHCSA; so even though I do like that doc, it won't help come exam time (unless someone has a photographic memory :)

 

Some folks have replied rather obtusely about this (ex: "only docs shipped with product are available") -- I find it best to just be blunt about this, say "no online docs", and reference man pages if the OP is asking about an exam. 

Also, I cannot remember all the VARS needed in the ./network-scripts/ dir ... so folks suggesting manually editing files, I ask: can folks really remember all those VARS?

There's actually a LOT of examples in the man pages:

man nmcli

man nmcli-examples

--
Sr. Solution Architect
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 7,965 Views

Besides editing files directly and using nmcli, you can also use nmtui -- the text user interface that allows easier configuration. You need to know how to navigate the tool, anyhow.

varelov
Flight Engineer Flight Engineer
Flight Engineer
  • 7,597 Views

At exam time I stick to manually editing the ifcfg-xxx config files. nmcli might be a useful tool for some, or even for the majority, but I find its syntax of building the final command string out of blocks of options unweildy during the exam. It's feedback when used for inspection of network setup is unnecessarily verbose, another turnoff. nmtui might be another useful tool to handle network setup during an exam, allegedly it is deprecated, but in lieu of graphical tools, and for the exam, it is good enough.

Edit ifcfg-xxx files and then nmcli dev dis enxxx nmcli con some_connection up and your settings take effect instantly. No need to reboot or reset NetworkManager.

Outside of the exam scope and when in a need to configure network, I prefer graphical tools, the Network part of the Settings menu (quickly accessed from the upper right corner by the Power button) offers plenty of what I need.

UWillC
Mission Specialist
Mission Specialist
  • 7,325 Views

Based on my experience I would recommend to use nmtui

From the exam perspective you will provide jus one command and then choose proper options to set all the options required for network configuration as well as to easily change the hostname if required.

With nmtui you will be able to set the ip address, subnet mask, default gateway and DNS server in one tool which comparing to nmcli will be long command to modify the existing connection

nmcli connection modify CONNECTION_NAME ipv4.method manual ipv4.address A.B.C.D/MASK_IN_BIT_NOTATION ipv4.dns A.B.C.D

or to create new one

nmcli connection add type ethernet ifname INTERFACE_NAME ipv4.method manual ipv4.address A.B.C.D/MASK_IN_BIT_NOTATION ipv4.dns A.B.C.D connection.id CONNECTION_NAME

after this you will nedd to brint the connection up

nmcli connection up CONNECTION_NAME

and to verify the settings manually, moreover you can easily forget to add something where in nmtui you have all the options avaiable opn one screen.

nmtui - Edit a connectionnmtui - Edit a connection

Tags (1)
JustinP
Flight Engineer
Flight Engineer
  • 7,309 Views

I'll practice on nmtui.

I've never given these console UIs much love ... but you make a case for their value in a timed exam.

 

ty!

--
Sr. Solution Architect
Tess
Flight Engineer
Flight Engineer
  • 4,911 Views

I am 100% onboard with @UWillC 

That's the biggest take-away I had when I worked on my RHCSA and RHCE, back in the day. Forget about manual work, because Network Manager will take care of everything! nmtui is by far the easiest way to quickly get your network interfaces set up. 

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