Laughing Hyena
  • Home
  • Hyena Games
  • Esports
  • NFT Gaming
  • Crypto Trends
  • Game Reviews
  • Game Updates
  • GameFi Guides
  • Shop
Tag:

nmcli

Manage Linux Network Connections
Gaming Gear

How to manage Linux network connections via nmcli and the terminal

by admin June 14, 2025



We take graphical user interfaces (GUIs) for granted. They generally “just work” and we can largely go about our business without even thinking. The Linux networking GUI is very much now in this camp. We were there when networking with Linux was a chore, heck we remember setting up PPP to connect to the Internet via a modem, in Linux!

What happens when things go wrong? The GUI breaks down, or were left with just a Linux terminal? Perhaps we are installing Linux on a server with no GUI? In these circumstances we need to understand how to make, break and configure connections using the nmcli command.

The nmcli command is one of many command-line tools to manage your network connections, and in this how to we will use it to check the connections on a system, bring connections down (off) and up (on) and finally we shall create a static IP address.


You may like

Working with an Interface

Interfaces are our points of connection. They can be physical, for example Ethernet, or they can be radio based, Wi-Fi for example. Each interface has a unique name, to identify whether it is Ethernet or Wi-Fi. In the past these names were generic, eth0 for the first Ethernet connection and wlan0 for Wi-Fi. In more recent years, these interface names have changed to be more specific.

Our first task is to identify the available interfaces.

1. Open a terminal and list all of the available connection / interfaces. The nmcli command can be used on its own, but passing the -p option will produce a “prettier” output.

nmcli -p

(Image credit: Future)

2. The output for the previous command will show all of the connections / interfaces. To return just the active interface connections use this command. Again, using the -p option provides a clearer view of the output.

Get Tom’s Hardware’s best news and in-depth reviews, straight to your inbox.

nmcli -p dev status

(Image credit: Future)

3. Use this command to get the details of a specific connection. Remember to change the name of the connection to match the output of the previous command. There is a lot of output, and you can pipe the output of the command using grep to pick out specific details.

nmcli -p con show

(Image credit: Future)

4. Use this command to determine the default gateway for your connection. The default gateway is typically our home router, the hardware that enables us to connect to the Internet. The output should show the ipv4 and ipv6 gateway details.

nmcli -p con show | grep GATEWAY

(Image credit: Future)

5. To bring a connection down (disable / disconnect) use this command. This will disconnect your Linux device from the network. Remember to replace the connection name with your connection name.

nmcli -p con down

(Image credit: Future)

6. List the connections, this will show that your device is no longer connected to the network.

nmcli -p dev status

(Image credit: Future)

7. Bring the connection up using this command. Remember to change the connection name.

nmcli -p con up

(Image credit: Future)

Setting a static IP address

For many of us, a dynamically assigned IP address from our router is all we need to get online. What if we want to create a server? A server will need a static IP address to enable connecting devices to find it.

We’re going to use nmcli to modify the connection so that we have a specific IP address.

We’re using an Ubuntu LTS, but the instructions will also work on a Raspberry Pi running Raspberry Pi OS, or any other Debian / Ubuntu based machine.

1. Open a terminal and using nmcli set the connection details. The connection name is as we have used above. The required IP address is as per your requirements, but it should be within the range offered by the device. The gateway is typically the IP address of the router. The DNS server can be your router

nmcli connection modify “CONNECTION NAME” \
ipv4.addresses REQUIRED IP ADDRESS/24 \
ipv4.gateway YOUR GATEWAY \
ipv4.dns YOUR DNS SERVER \
ipv4.method manual

2. Bring the connection down. Remember to use your connection name.

nmcli -p con down

3. Now bring the connection back up. Remember to use your connection name.

nmcli -p con up

4. Check that the connection has been made correctly. The State column should show “connected”.

nmcli -p dev status

(Image credit: Future)

6. Check your IP address. Using the connection show command we pipe the output through grep, looking for “ipv4.addresses”.

nmcli -p con show <> | grep ipv4.addresses

(Image credit: Future)

7. Finally ping an IP address to ensure that your server can reach the outside world. You should see pings being sent within a few milliseconds, if there is a problem then the command will error. Press CTRL + C to end the ping command. We typically use Google’s DNS server IP address 8.8.8.8, but you can also use CloudFlare’s 1.1.1.1 or OpenDNS 208.67.222.123. Alternatively, you can ping a URL such as google.com.

ping 8.8.8.8

(Image credit: Future)

More Linux Tutorials

🐧 How To Dual Boot Linux and Windows 11

🐧 How to Create Custom Grub Menu Backgrounds for Linux Boots

🐧 How to Use Nohup to Run Linux Scripts Unattended

🐧 How To Find Large Files on Linux

🐧 How To Mount and Unmount Drives on Linux

🐧 How To Manage Users in Linux



Source link

June 14, 2025 0 comments
0 FacebookTwitterPinterestEmail

Categories

  • Crypto Trends (666)
  • Esports (505)
  • Game Reviews (476)
  • Game Updates (596)
  • GameFi Guides (666)
  • Gaming Gear (649)
  • NFT Gaming (644)
  • Product Reviews (646)
  • Uncategorized (1)

Recent Posts

  • Donkey Kong Bananza looks appealing in Direct
  • Nexar One dash cam review: a 4K dash cam with interior view and constant cloud connection
  • Shiba Inu (SHIB) Exchange Outflow Hits 481 Million: Details
  • Bitcoin Will Be $1 Million Per Coin
  • Animated Death Stranding movie gets its screenwriter

Recent Posts

  • Donkey Kong Bananza looks appealing in Direct

    June 19, 2025
  • Nexar One dash cam review: a 4K dash cam with interior view and constant cloud connection

    June 19, 2025
  • Shiba Inu (SHIB) Exchange Outflow Hits 481 Million: Details

    June 19, 2025
  • Bitcoin Will Be $1 Million Per Coin

    June 19, 2025
  • Animated Death Stranding movie gets its screenwriter

    June 19, 2025

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

About me

Welcome to Laughinghyena.io, your ultimate destination for the latest in blockchain gaming and gaming products. We’re passionate about the future of gaming, where decentralized technology empowers players to own, trade, and thrive in virtual worlds.

Recent Posts

  • Donkey Kong Bananza looks appealing in Direct

    June 19, 2025
  • Nexar One dash cam review: a 4K dash cam with interior view and constant cloud connection

    June 19, 2025

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

@2025 laughinghyena- All Right Reserved. Designed and Developed by Pro


Back To Top
Laughing Hyena
  • Home
  • Hyena Games
  • Esports
  • NFT Gaming
  • Crypto Trends
  • Game Reviews
  • Game Updates
  • GameFi Guides
  • Shop

Shopping Cart

Close

No products in the cart.

Close