From charlesreid1

Revision as of 05:19, 13 March 2016 by Admin (talk | contribs)

networking

ping

Okay, you have managed to run ping. You have even figured out how to use the -c flag. In this case, ping will attempt four times, stop, and then report some basic statistics to you.

Knowing how to check whether or not you're connected is one thing, but what do you do when you're not? Or what if your network connection is active, but reports invalid information and you need to reconfigure it?

First, let's explore how to check our current configuration. In Debian, the file that controls the network devices by default is the following:

/etc/network/interfaces

Depending on several variables, which include how you configured your Debian installation, this file may be created differently. First, you may see several interfaces listed, such as your loopback adapter, wired Ethernet, and wireless. If you have more than one wired interface, you'll see any additional adapters here as well. This file is, simply put, a configuration file. It's a text file that contains information that the underlying Linux system understands, and causes a device to be configured as designated in the file.

To edit files such as these, there are many Linux text editors available, both GUI and terminal based. My personal favorite is vim, though many administrators typically start off with nano. The nano text editor is fairly easy to use, though very light on features. Alternatively, vim has many more features than nano but is a bit harder to get used to. Take your pick. To open a file in nano, all you need to do is type nano along with the name of a text file you would like to edit. If the file doesn't exist, the command will create it if you save the file. In the case of our /etc/network/interfaces file, the command will be similar to this:

# vim /etc/network/interfaces

continuing

back to the subject of our /etc/network/interfaces file. It's important to note that this file is not required for the purposes of ethernet and wireless adapters. If you see nothing in this file at all (other than the loopback device) it means that the network connections are being managed by Network Manager. Network Manager is a graphical tool for managing client-side network connections (which we'll discuss later in this chapter). For our purposes in this section, Network Manager is typically installed when you decide to include a graphical desktop environment when setting up Debian for the first time. If you did opt for a graphical environment (such as GNOME, Xfce, and so on), then Network Manager was more than likely set up for you and is handling the job of configuring your interfaces. If your interfaces file is blank other than the entry for the loopback adapter, then that means Network Manager is handling this task.

With Debian, it's extremely common to see installations in the wild with no graphical environment installed at all. A GUI is usually not necessary for the server to fulfill its purpose. A typical Linux administrator will configure a server with the minimum required packages for it to do its job, which often will not include a desktop environment. In this case, Network Manager may not be installed at all. If it's not, the /etc/network/interfaces file will then be responsible for setting up the connection. In other cases, perhaps Network Manager is installed, but was disabled by the administrator whom configured the network connections in this file instead.

So, when should you use Network Manager, and when should you just configure your connections in the interfaces file? In the case of end-user workstations (desktops and laptops), Network Manager is almost always preferred. In the case of servers, setting up the configuration in /etc/network/interfaces is preferred, especially when setting up a static IP address.

We've discussed what the interfaces file is, and when you'd want to use it. Now, let's take a look at some various types of configurations you can expect to see. First, let's gander at the interfaces file when only the local loopback adapter is listed:

cat /etc/network/interfaces

  1. The loopback network interface

auto lo iface lo inet loopback