Configuring network settings interactively
Often, we don't have access to GUIs and GUI-based configuration tools. If we need to configure network settings, this can lead to a bunch of problems. Either we need to learn the syntax of /etc/sysconfig/network-script
files (not user-friendly), or we need to use the tools that are at our disposal to configure network settings from the CLI. Let's learn how to use nmcli
for that purpose.
Getting ready
Before you start this recipe, you need to make sure that you are using our cli2
CentOS machine as Ubuntu doesn't use nmcli
by default. Once you've done that, you're all set!
How to do it…
Configuring network settings via nmcli
isn't difficult, but at the same time, it's far from super user-friendly. There's quite a bit of syntax involved and sometimes, that can get a bit overwhelming. So, let's create a script that's going to do three things for us:
- Configure network...