Configuring network settings is an essential task when managing servers. The nmcli command-line tool provides a straightforward way to manage NetworkManager from the terminal. In this guide, we will walk you through 20 examples of configuring networking on AlmaLinux 8, CentOS 8, or Rocky Linux 8 using the nmcli command. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial covers all the necessary steps.

Step 1: Check Network Status

To check the status of your network interfaces, use the following command:

nmcli device status

Step 2: List Available Network Connections

To list all available network connections, run:

nmcli connection show

Step 3: Create a New Connection

To create a new connection, use:

nmcli connection add type ethernet con-name my-connection ifname eth0

Step 4: Set a Static IP Address

To set a static IP address, use:


nmcli connection modify my-connection ipv4.addresses 192.168.1.100/24
nmcli connection modify my-connection ipv4.gateway 192.168.1.1
nmcli connection modify my-connection ipv4.dns 8.8.8.8
nmcli connection modify my-connection ipv4.method manual
            

Step 5: Enable the Connection

To enable the newly created connection, run:

nmcli connection up my-connection

Step 6: Set Up DHCP

To set up DHCP for an existing connection, use:

nmcli connection modify my-connection ipv4.method auto

Step 7: View Current IP Address

To view the current IP address assigned to your interface, use:

nmcli -p device show eth0

Step 8: Delete a Connection

To delete a specific connection, run:

nmcli connection delete my-connection

Step 9: Modify a Connection

To modify an existing connection, use:

nmcli connection modify my-connection ipv4.addresses 192.168.1.101/24

Step 10: Set Connection to Auto-Connect

To make a connection auto-connect at boot, use:

nmcli connection modify my-connection connection.autoconnect yes

Step 11: Disable a Connection

To disable a connection, run:

nmcli connection down my-connection

Step 12: Restart NetworkManager

If you need to restart NetworkManager, use:

sudo systemctl restart NetworkManager

Step 13: View Connection Details

To view detailed information about a connection, use:

nmcli connection show my-connection

Step 14: Configure VLANs

To create a VLAN connection, run:


nmcli connection add type vlan con-name my-vlan ifname eth0 id 10
            

Step 15: Set up Bridge Connection

To create a bridge connection, use:

nmcli connection add type bridge con-name my-bridge ifname br0
nmcli connection add type ethernet con-name my-bridge-slave ifname eth0 master br0
            

Step 16: Monitor Network Activity

To monitor network activity, use:

nmcli monitor

Step 17: Set MTU

To set the MTU (Maximum Transmission Unit) for a connection, use:

nmcli connection modify my-connection 802-3-ethernet.mtu 1500

Step 18: Set IPv6 Configuration

To enable IPv6 and set its configuration, run:


nmcli connection modify my-connection ipv6.method auto
            

Step 19: Backup Connection Configuration

To backup your connection configuration, copy the configuration file:

nmcli connection export my-connection > my-connection.backup

Step 20: Restore Connection Configuration

To restore a connection configuration from a backup, run:

nmcli connection import my-connection.backup

You have learned how to configure networking on AlmaLinux 8, CentOS 8, or Rocky Linux 8 using the nmcli command with 20 practical examples. For reliable and scalable hosting solutions, consider using Windows VPS UK. They offer a variety of hosting options, including windows virtual private servers, windows vps hosting, and windows virtual dedicated server hosting. Whether you're looking for windows vps italy or uk vps windows solutions, their hosting services provide the performance and flexibility needed to support your networking tasks.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)