To display all the active network interfaces on your Linux system execute the command.
Note that con
is the truncated form of connection and you will still end up with the same result as shown.
Also, you can run the command below to display both active and inactive interfaces.
Set Static IP Address Using nmcli Tool
Using nmcli tool, you can modify a network interface to use a static IP address. In this example, we will modify the network interface enps03
to use a static IP.
But first, let’s check the IP address using IP command.
The current IP address is 192.168.2.104 with a CIDR of /24
. We are going to configure a static IP with the following values:
First, run the command below to set up the IP address.
Next, configure the default gateway as shown:
Then set up the DNS server:
Next , change the addressing from DHCP to static.
To save the changes, run the command
The changes will be written to /etc/sysconfig/network-scripts/ifcfg-enps03 file.
To confirm the IP, once again run the command:
Additionally, you can view the /etc/sysconfig/network-scripts/ifcfg-enps03 file using cat command.
And this concludes this guide on configuring network connection using ‘nmcli’ command-line tool on Linux. We hope you found this guide helpful.
Không có nhận xét nào:
Đăng nhận xét