Science and technology

Set up a static community connection in Linux

Configuring a community connection from a Linux machine might be difficult. Fortunately, many new Linux distributions include some sort of community administration device that may enable you routinely hook up with a wi-fi community. But would not it’s good to have the ability to arrange a static community connection from a Linux machine? This information will present you the best way to use totally different Linux instruments to test for community connections from a CentOS/RHEL machine and clarify the best way to add a static community utilizing the nmcli device.

Step 1: Check community connectivity

The ping command is a well known utility that rapidly checks for a connection to an deal with. Enter the next on the command line:

ping -c3

the place the -c3 parameter choice signifies you’ll name this area title solely 3 times.

If you might be linked to the web, you’re going to get a knowledge packet response just like the one on the backside of this screenshot.

Step 2: Check connection data

You can test community data utilizing the ip add command.

Running this command reveals system data, the IP deal with, and extra. You’ll want a few of this data, just like the system information and IP deal with, later to arrange a static connection, so go forward and seize it.

Step three: Check community data

Network data might be discovered contained in the /and many others/sysconfig/network-scripts listing by getting into:

ls /and many others/sysconfig/network-scripts

For instance, this screenshot reveals ifcfg-enp0s3 and ifcfg-lo, however this may differ relying on the place you might be working Linux and the way your system is ready up.

Step four: Show obtainable connections

The nmcli device reveals the obtainable connections presently used to connect with the community. Enter the next command:

nmcli con present

This screenshot reveals two units are lively: enp0s8 and enp0s3, and they’re referred to as Wired Connection 1 and 2. But this might be totally different, relying on how your Linux surroundings is ready up.

Step 5: Check that the community connection is on

You used the ping command above to test which you can obtain knowledge packets, however now use the systemctl command for community to watch, replace, and troubleshoot the community. The command is:

systemctl standing community

If the community utility has no points, you will notice the standing as lively whenever you run this command.

Step 6: Add the static connection

Now you are prepared so as to add a static connection. Using the system title you grabbed from ip add in Step 2, modify and enter the next command so as to add a brand new connection:

nmcli con add con-name "SomeName" ifname YOUR_DEVICE autoconnect sure sort YOUR_CONNECTION_TYPE

Change SomeName, YOUR_DEVICE, and YOUR_CONNECTION_TYPE based mostly in your configuration.

Step 7: Verify the connection is added to the network-scripts path

There are two methods to change the brand new connection information utilizing the nmcli device. One is through the use of the next command:

nmcli con mod

This command basically modifies the community configuration scripts underneath the /and many others/sysconfig/network-scripts listing, which is the opposite approach to modify connection data. Choose the choice to change the connection straight.

Look into the /and many others/sysconfig/network-scripts path once more by getting into:

ls /and many others/sysconfig/network-scripts

You can see that the connection ifcfg-MyFavoriteCafe was added.

Step eight: Confirm you’ll be able to see the connection

Check that MyFavoriteCafe is seen because the obtainable connection. Use the next command to deliver the connection up. Please be aware that SOME_CONNECTION_NAME is the title of your connection (it’s MyFavoriteCafe on this instance).


or deliver it down utilizing the next command:


When you added the brand new connection, autoconnect was set to be true, so it would routinely begin when you restart the community utility.

So far, so good. The connection reveals up whenever you run the next command:

Step 9: Modify the connection to be static

Open the file /and many others/sysconfig/network-scripts/ifcfg-SOME_CONNECTION_NAME (it’s MyFavoriteCafe on this instance), utilizing a textual content editor, equivalent to Vim, Emacs, or Nano. (If you need a fast introduction to Vi or Vim, try my intro information, “Getting started with Vim: The basics.”)

To make the connection static, modify one parameter and add three parameters:

  1. Modify BOOTPROTO to be static.
  2. Add IPADDR. This might be discovered from the ip add command or your linked community.
  3. Add NETMASK. This might be discovered from the ip add command or your linked community.
  4. Add GATEWAY. This might be discovered from the ip add command or your linked community.

You may additionally want so as to add DNS, PREFIX, or different data, relying on how your community and the machine are arrange.

Once you have finished this, save the file. Restart the community with the next command:

systemctl restart community

Check the standing with:

systemctl standing community

Step 10: Confirm the brand new connection is lively

That ought to do it! But be sure by checking if the brand new connection is working. Run the nmcli con present command once more to start out the brand new connection.

You may also ping an internet site deal with to confirm that the connection is working.

Finally, you’ll be able to test the system information utilizing the next command:

nmcli dev present DEVICE_NAME

the place DEVICE_NAME is the title of your community system.

If you may have any questions or suggestions, please go away them within the feedback.

Most Popular features the latest multimedia technologies, from live video streaming to audio packages to searchable archives of news features and background information. The site is updated continuously throughout the day.

Copyright © 2017 Breaking Express, Green Media Corporation

To Top