Networking - LINUX: The Ultimate Beginner’s Guide! (2015)

LINUX: The Ultimate Beginner’s Guide! (2015)

Chapter 7: Networking

Linux is your best option when it comes to building a network. Here are some features of Linux that make it a great system for networking purposes:

· Networking is a built-in function of the operating system.

· Free networking tools and programs are available for free.

· The OS can be relied on even if the entire network experiences heavy loads.

In this chapter, you’ll learn about how you can use Linux for networking.

Networking – An Overview

A Simple Model

Simply put, a protocol is a group of rules used for communication.

To get information across the network, various software and hardware must work together harmoniously.

These pieces of software and hardware use different “languages.” For example, an email program communicates with the computer’s OS using a certain protocol. However, that same program cannot “talk” to the computer’s hardware. You have to use a special program that can perform this task.

In turn, the machine must communicate with the phone line (or other hookup method used to get online access). At the “backstage,” the hardware used for network connection must communicate with similar devices to successfully send the message.

These various kinds of protocols are grouped into seven layers, called the OSI Model (or Open Systems Interconnection Reference Model). To help you understand this concept, the OSI model is converted into a 4-layer protocol system. Check the list below:

· Network Layer – This layer uses the IP and IPv6 protocols.

· Transport Layer – This one uses the UDP and TCP protocols.

· Application Layer – This layer uses various protocols such as DNS, POP3, SMTP, and HTTP.

· Network Access Layer – This layer uses the Ethernet, PPP, and PPPoE communication protocols.

Network Information and Configuration

Network Interfaces – Basic Configuration

Each Linux system comes with built-in graphical tools. You can use these tools to connect to the internet or establish local networks. To access a graphical tool, you may use the command line or one of these options:

· For Ubuntu systems, go to System > Administration > Networking.

· For Gnome systems, run the gnome-network-preferences command.

· For KDE systems, run the knetworkconf command.

· For Mandriva/Mandrake systems, run the pre-installed tool called Network and Internet Configuration Wizard.

· For RedHat systems, you can run the redhat-config-network command. This command will give you two options: graphical mode and text mode.

Here are the things you should do when connecting to a network:

1. To connect to the internet – You need to provide the login information for your Internet Service Provider (ISP). If you are using a modem, you also need to give your telephone number. Once done, your ISP will give you all the things you need to be online (e.g. IP address).

2. To connect to a local network – You must give your IP address, hostname, and domain name. If you’re doing this at work, the computer will give you the information listed.

The Configuration Files

A graphical tool can help you modify network configuration files. The names and locations of network configuration files depend on the Linux system you are using. However, some configuration files exist in all types of Linux machines:

1. /etc/hosts – This file holds the localhost’s IP address (i.e. 100% of the time. You can use /etc/hosts to perform interprocess communications. No matter what you do, you should never delete this file.

Here’s a host file for a local network:

If you want to learn more about this file, run the man hosts command.

2. /etc/resolv.conf – This file regulates access to a domain name server. When checking this file, you’ll see your domain name and name server. Here’s a screenshot:

3. /etc/nsswitch.conf – This file determines how name services are contacted. If you are connecting to the internet, dns should appear in the line that says “hosts.” Here’s an example:

This data tells your machine to scan the /etc/hosts file for IP addresses and hostnames. If no hosts exist in that file, your computer will contact the domain name server. Alternatively, you may instruct your computer to contact other name services such as NIS, NIS+, and LDAP.

You can learn more about this file by running this command: man nsswitch.conf.

The Configuration Commands for Networking

The ip command

This command shows and controls the networking configuration of the kernel. To perform these tasks, ip uses graphical tools and distribution-specific scripts.

You can use this command to do cool things. Here are some examples:

· Assign an IP address to each interface

· Set up routes to local networks and the Internet

· Display the configurations of your machine’s TCP/IP

The screenshot below will show you two powerful commands. These commands can give you routing information and IP addresses.

The ifconfig command

This is one of the most popular commands on Linux systems. You may run it without an option to display some information about your network’s interface. Here’s a screenshot:

To get the most out of this command, you should know the two vital aspects of interface configurations. These are:

· “inet addr” – This marks the IP address.

· “HWaddr” – This tag shows the hardware address.

Both commands (i.e. ip and ifconfig) show detailed information about the network’s current configuration. They can also display multiple statistics about every interface. Lastly, they will tell you whether the system is active.