Even non-computer geeks have probably heard of “TCP / IP”, but does everyone know what it is and how to configure it on a Linux server using the command line?
This helps to define the basic terminology first. At the very least, it allows you to develop a framework for your understanding. TCP / IP is no exception.
This section of terminology is not an exhaustive list. This will give you a foundation to begin your journey to understanding networking and configuring TCP / IP files in Linux.
Ever wonder what * nix means? How about how Unix and Linux are related (not to mention the different versions of each)?
* nix is a method of referencing Linux and / or Unix (or any other distribution) using a wildcard (asterisk) for this.
* Nix was developed in the late 1960s. Around the same time, AT&T Bell Labs developed Unix. Through various iterations and developments, Linux was also born.
– /
The result of these concurrent innovations is that when you learn how to install on a single server using the command line, you will acquire a skill that is probably compatible with many other tasks on various Unix or Linux servers.
Man Pages – information at your fingertips
Like Google, Linux has its own set of search and exploration tools that enable users to find the resources they need. These resources are known as “man pages”. When you are logged into a Linux server (or Linux based operating system), you can open a command line application and enter what you want to investigate, such as entering a search term in an online documentation file.
If you choose a topic that you want to research, such as a Linux utility, tool, daemon, script, you can find it by typing “man” followed by the word. You will learn how to do this later in this article.
The man pages are easy to use. Just start typing a few words and Linux will start returning information to you. If there is no man page for a specific topic, Linux will let you know.
For the most part, the man pages are accurate enough for the version of the software in which they appear. For example, if you are logged into a Linux server that is 10 years old, the man page displays information pertaining to that version (and age).
The man pages are easy to use and accurate, but there are a few caveats. Let’s illustrate these caveats with images.
The image below on the man page for ARP indicates that ARP is deprecated (in the Notes section) and that you should look for ip neigh instead. From this entry, you can enter “man ip neigh” to access information about the replacement tool / protocol.
However, entering “man ip neigh” does not lead to a search for the man page for “ip neigh”. Instead, it will find two manual pages one for “ip” and one for “more”.
While it is true that you get the man page if you type “man ip neigh”, if you are not paying close attention, you may miss that this is not quite what you were looking for.
You can add a dash (even if it is not what is displayed on the man page when accessing the replacement tool) So if you add a dash and type “man ip-neigh” it will work fine too, but that is not correct either.
You can try typing “man ip neighbor†(note the British spelling). When you type that particular phrase, you will see the correct manual page for replacing the ARP man page (or replacing the ARP protocol). The bottom line is this: if you can’t find what you need, try different combinations until you get the man page you want.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
As an example, try searching the man page for the nslookup tool. You do this by typing “man nslookup“. When you do, you will see a man page that looks like the image / screenshot below. Learn everything there is to know about the nslookup tool.
After the man page appears on your screen, you can scroll down, read, apply, test, and even close the man page (by typing the letter “q” and letting the man page close automatically).
If you ask for a manual page that does not exist, Linux will inform you that there is no entry for that manual page, and you will try another.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
IPv4 and IPv6
Both IPv4 and IPv6 are technically the same, but to us humans, they don’t seem the same. They are a means of identifying machines or devices on a local area network (LAN). They are confidential in the sense that they identify devices on the local network.
IPv4 uses numbers separated by dots / dots. Most of us are familiar with the types of IP addresses we see for computers connected to our private networks using IPv4 format.
The computers on the network also have an IPv6 address, but it looks different. IPv6 consists of alphanumeric characters separated by colons (:).
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
So what’s the difference between IPv4 and IPv6? Think of it like a network name. One looks like a first name, and the other looks like a last name. Both names refer to the same person (or in this case, a computer). Just as we usually have a different name from our last name, an IPv4 “name†will be different from an IPv6 “name†even if they both point to the same computer.
Karla Schroeder has written a handy and helpful article on IPv4 and IPv6.
Root Access on Linux Server (plus su and sudo)
Many tasks that need to be performed require root access (aka administrator or superuser). This is because many of these utilities and applications are so sensitive that their use is restricted for security reasons.
An alternative solution for logging in as superuser or starting superuser (su) access is to add a command with “sudo” telling the Linux machine that this particular command should be run as superuser / root, but subsequent commands do not (unless also with the addition of the “sudo” directive).
In cases where “sudo” is used and appended to a command, Linux prompts for the su password to authenticate the identity and superuser rights.
Network Protocols
There are many different protocols to consider when discussing Linux. This article uses two main protocols: TCP and IP.
Transmission Control Protocol (TCP)
Transmission Control Protocol, more commonly referred to as TCP, is the protocol used to transfer packets, as the name suggests.
See below for a description of various tools, including a Linux tool called Traffic Control (tc).
TCP tells the Linux operating system how packets should move from one location to another. It also monitors network traffic and directs the transmission of packets of information (for example, data folders moving from one location to another).
This is why the protocol is called Transmission Control Protocol (TCP).
Internet Protocol (IP)
The Internet Protocol is usually abbreviated as IP.
In the case of IP , you have a wider area (Internet) for packet transmission. It’s like a wider, longer and more passable superhighway called the Internet. While TCP controls the movement of packets across the network, IP controls the movement of packets across the Internet.
ICMP protocol
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
ICMP stands for Internet Control Messaging Protocol. Although this protocol is available on most Linux distributions, it may not be available on all Linux distributions This is evidenced by the lack of a man page in the current Centos installation.
At first glance, it might seem that this particular protocol is not that important, but in fact it is. ICMP is responsible for providing error messages if / when a packet does not reach its destination as expected. ICMP is required to receive status updates upon delivery (or receipt) of packets of transmitted information.
User Diagram Protocol (UDP)
User Diagram Protocol (UDP), like Transmission Control Protocol (TCP), is a protocol for transferring packets of information from one point to another. In the case of TCP, as part of the process / transmission, there is a successful delivery check for the packet (s), making it more reliable than UDP.
In the case of UDP, there is no validation process, so you will not know if packets were sent or received successfully and without errors. Thus, it is a simple enough protocol to use, but it cannot be verified or authenticated.
Linux Configuration
Several configuration files are available on the Linux operating system.
For example, if you are running Apache server on a Linux machine, the Apache configuration files are important. These files allow the Apache web server to know what is happening with the domain and, in particular, with the site that is hosted on that server.
The configuration file is sometimes referred to as httpd.conf. It is sometimes called apache.conf. Or it could be a completely different label / name. You may find configuration files in one place on one server, and in other cases they are in a completely different location on another server.
Fortunately, there are useful commands that can help you find specific configuration files. For example, you can enter the following to find the “httpd.conf” configuration file, if it exists:
find / -name “httpd.conf”
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
The first word, “find”, tells Linux which command / utility you are using, in this case the utility “find”. The second command line component is the “/” character, which tells find to look for a path starting at the root of the server.
If you were looking in a more specific location, you might have something like “/ etc†so Linux knows to start in the etc directory and follow that path. By specifying a specific path / location, you can potentially speed up the process as Linux doesn’t have to look in places that are redundant.
The -name parameter lets Linux know what you are looking for in a file or directory name. It is useful to enclose the name in quotation marks, and also to use the asterisk (*) as a wildcard when searching.
Some examples of configuration files and directories in the / etc directory / path include:
- pam.d – Directory containing utilities related to authentication modules. “Su” and “sudo” are there as examples.
- sysconfig is a directory that includes computer functions such as power management, mouse, and more.
- resolv.conf is a file that helps in the operation of the domain name server, if this is a Linux machine.
- services – This file contains the available connections (i.e. open ports) available on the Linux machine.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
If you’re wondering if any files, paths, or utilities are out of date, use the man pages to check. It’s a useful way to keep track of what’s new and what’s changed.
Understanding the Linux file system
In many Linux distributions, configuration files are located in the network scripts directory under the path “etc / sysconfig”. If they are not located there, there is probably a similar location / path. The files that are present in this particular case are shown in the screenshot below.
As you can see in the screenshot below, there are two configuration files. Each of them is labeled according to their respective interfaces (eg ifcfg-eth0).
Configuration files are preceded by “ifcfg”, which replaces the ifconfig command (and also becomes part of the interface file name). However, it has now also been replaced somewhat since ifcfg is not IPv6 compatible.
The two interface references (ifcfg-eth0 and ifcfg-lo) refer to specific interface types. The Linux developers have been helpful in this area by providing definition and direction in the form of filenames. In the case of an interface ending with “eth0”, this is the interface connected via “Ethernet” or has Ethernet capabilities.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Using the letters “eth” will point you in the right direction. The number following “eth” indicates the device number. So the next Ethernet device might be something like “ifcfg-eth1” and so on.
A file name that ends in “lo” refers to a loopback interface. It is also called localhost This is a network connection and is not technically a real network connection. It simply allows processes to communicate on the device without communicating over the network. When thinking about this particular interface, think “virtuallyâ€.
All Linux distributions can have loopback (or localhost</a and are usually configured for it by default. They use an interface ending in “-lo”. The localhostIP address is usually 127.0.0.1. In many cases, the loopback virtual interface can be used to test connections and rule out other potential network problems.
Files
There are different ways to edit configuration files (as well as view them). One way is to use the “vi editor”, which is accessed with the “vi” command followed by the filename. In this case, when someone types “vi ifcfg-eth0” (without quotes), they can view the network information for that particular interface (eth0).
However, it would be more advisable to do it the traditional way and follow the network setup instructions provided on the ifcfg man page.
It can also be easier for a non-technical person. Using the vi editor requires some attention to detail, so if you are detail oriented (or you are already a programmer or sysadmin), vi may be the optimal solution for working with Linux configuration files.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
By accessing the man pages, we can view information about the ifcfg script, which replaced the ifconfig script (as shown in the screenshot above). Also, looking at the list of interfaces in the Linux distribution, we notice the ifup and ifdown commands. They can also be viewed on their man pages.
A screenshot of the man page is shown in the image below. As you will see in the man page, there are additional Linux configuration files (and paths to those files) that can be accessed (and modified) when installing and configuring TCP / IP files on Linux. </ P>
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
If you use a command line text editor like vi to view the configuration file, you will notice some specific options. For example, when looking at a network interface, you might see words written in capital letters, followed by an equal sign (=), and then another word.
For example, there might be an “ONBOOT” directive and it might have “ONBOOT = yes” as an example of a configuration parameter. There are several other configuration points and options as well. For example, another one is NETMASK.
If you see the “NETWORKING” configuration directive, it should be followed by “yes”. If it is followed by “no,†it may indicate a problem, as it means that the network interface is not activated for networking.
Here’s a step-by-step process to fix the situation just described:
- Make a copy of the config file just in case. There are several ways to do this. One of the simplest is the command window.Enter: cp ifcfg-eth0 ifcfg-eth0_20200101
Then on the next line enter: mv ifcfg-eth0_20200101 / home / mydirectory / ifcfg-eth0_20200101
This moves the copy of the file you just created to the directory you are using for backup. - Now that you’ve backed up your configuration file, it’s time to make changes to that configuration file. If you are using vi editor, enter the following:vi ifcfg-eth0
This will open the file in a terminal / command application (similar to how the man page opens when you run).
After opening the configuration file, you should find the line containing “NETWORKING = no” and delete that line or change it to “NETWORK = yes”. This can be done using the “cw” directive in the vi editor. By typing a forward slash, you tell vi that you are looking for something. In this case, you tell the editor that you are looking for “NETWORK”, and when it is found (by pointing the mouse at this location), you can use the right arrow key to navigate to the word “no”.
When you get to the word “no”, stop at “n” and enter “cw”, which will allow you to change “no” to “yes”. “Cw” means change a word, and Linux allows you to completely change a word from one word (“no”) to another (“yes”). If you only want to change one letter, you can use “r” to replace one letter or character.
The screenshots show this process below. - After saving the config file (ie typing esc to exit INSERT mode and then double Z to save the file), it’s time to restart the service or computer. This can be done in several ways. One way to restart the computer is to enter the following command line:shutdown -r now
The shutdown command tells the Linux machine to shut down. The -r option tells the command that this is not just a shutdown, but a reboot and that it should be done now.
Tip: If you want to know when a computer or server has finished rebooting, enter “ping” followed by the public IP address of the computer / server (or the domain name of a site hosted on a Linux server).
Using the ping command, you will see that the server is not “pingable” (which happens during a reboot), and then when the server reboots successfully, ping will respond positively, indicating a successful reboot.
Below are some images to help illustrate the steps in the above list.
Step 1:
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Step 2:
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Tip: keep in mind that there is nothing special about the server world. For example, you can change the configuration for a specific interface (in this case eth0), but it can only be one interface on the network and it can be affected (or affected) by another server.
So in the example above, restarting the server will initiate a restart of the network devices. This is not the only option for this interface, but it will be affected by the restart command.
File (s) / etc / hosts
The / etc / hosts file may or may not exist. If it exists, it may or may not be used in the configuration. For example, you might have another system that handles host configurations rather than managing the file directly. The hosts file itself also changes. For example, IPv4 and IPv6 handle configuration differently, as you can see in the image below.
Configuration files; Locations / Paths; Timing; and much more
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Here are some additional useful filenames and locations:
-
- / etc / sysconfig / network-scripts / (path to configuration file)
- / etc / sysconfig / network-scripts / ifcfg -eth0 (config file)
- / etc / hosts (config file)
- /etc/resolv.conf (config file with nameserver information)
In many cases, the system or server software generates configuration files automatically. In addition, if DHCP is used, there are other aspects of the network configuration that are calculated on the fly, since static IP addresses are not used in this case.
The following command line (CL) commands have been (or are in use) in most Linux distributions If they are out of date or deprecated, a replace command is displayed.
-
-
- route (deprecated / deprecated): Used to display and edit routes. Replaced with ip route .
- hostname: Used to display or manipulate and edit the hostname of the computer.
- netstat: View network connections, routing tables, interface statistics, multicast membership, and more.
- arp: (deprecated / deprecated) Used to display IPv4 information; in particular, the cache of the network neighbor. IPv6 became a network address, replacing the IPv4 set of four numbers separated by dots. In light of these changes, this deprecated command has been replaced with ip neigh .
- ip: IP not only stands for “Internet Protocol”, but also the destination WAN (Wide Area Network), but it is also a utility that allows the system administrator or computer user to view TCP / IP settings as well as configure them as needed.
- tc: This stands for “Traffic Control” and is a utility to help manage inbound and outbound traffic on a Linux machine.
-
configuration tools: GUI vs. Command Line (CL)
As a guide, the following three images show a graphical user interface (GUI) engine for managing network configuration including TCP / IP.
The first image is the Apple Mac GUI (System Preferences> Network), and the second two images are the Windows operating system (although it varies from version to version). It is accessed through Microsoft Control Panel and Network Connections as you can see in the screenshots.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Pros and cons of a GUI versus a text editor or command line (CL)
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
While many people prefer graphical user interfaces (GUIs) because of their ease of use, visual presentation, and overall simplicity, it is helpful to understand the configuration files (in this case networking) so you can troubleshoot and fix any problems.
You may want to use the graphical interface first, but it will help you get the full details just in case. Also, there are some operating systems that don’t necessarily have a graphical interface (or don’t have one yet), so again; it’s good to be prepared.
In the next section, we’ll cover configuration files and how to access them, update them, and manage files and utilities.
Linux (CL) command-line tools, utilities, scripts, and Daemons
There are many tools available for Linux distributions Again, like other commands, there are similarities (and differences) in the way these tools are used across distributions. In some cases, tools are available, but they need to be installed first, and the installation process is often different.
The command line tool is often referred to as the shell , and in its early days, the terminal . There are other terms for this, but usually it is an application that allows the user to access operating systems by typing commands in a window.
Let’s take a look at a couple of examples. The first is related to the Windows operating system and is probably familiar to Windows users. The tool opens when you type CMD (as shown in the screenshots below).
The second screenshot is an application called Terminal that comes preinstalled on most Apple computers.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
NSLookup (nslookup</a
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
In the case of nslookup , ns means nameserver , and the lookup part of the command is “look up” information. So, the name of this tool tells us that it will look for information usually available through a nameserver.
NSLookup is a handy tool. In this case, we use it to find information about eBay. To do this, we type “nslookup ebay.com” and we are presented with information similar to the one shown in the image below.
The command appears at the top of the screenshot (after blurry private information). Then the result of this query (nslookup</a is shown below with information like server (public IP), specific IP, etc.
Traffic Control (tc)
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Another tool is the Traffic Control tool (also called “tc”). It is a tool for planning and processing data packets.
The command tells you how packets travel across the network. This how aspect includes answers to questions such as time, speed, devices, etc. Here is a command line (CL) view of using traffic control (tc):
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
While this may sound like gibberish to some, every word on the command line represents something important. Here is the list:
- tc : This is a tool, in this case Traffic Control (also known as “tc”). This tells the command line application / software which Linux tool to use.
- qdisc : This abbreviation stands for queuing discipline and is another way of describing a simple scheduler.
- add : Since we are creating a config (yes, technically a file), we are telling the tool to add to the controls.
- dev eth0 : “dev†refers to “deviceâ€, telling the tool that we are going to detect a device. “Eth0” in this case is a device reference. You will notice that this is similar to what is displayed in the graphical user interface (GUI) for the device tag.
- root : This tells the tool that we are modifying the outbound traffic from the root level or outbound.
- netem : This word represents the phrase “network emulator”. While it may not be a hardware network, it mimics the same. This is similar to how Parallels software emulates Windows software for Apple computers. Of course, this is a completely different software, but it is emulation software just like netem simulates a network. In this case, netem is a WAN (Wide Area Network) as opposed to a LAN (Local Area Network).
- delay : This word tells the tc tool that we are changing the “delay” component of the transaction.
- 400ms </ em>: We have already told the tool that we are affecting latency, but now we need to determine how much we are affecting latency. In this case, it is 400 milliseconds.
Network Manager
Network Administrator
The purpose of Network Manager is to simplify and automate your network configuration. For DHCP users, Network Manager can obtain an IP address, replace default routes, and automatically swap nameservers.
The nmtui tool for using your Network Manager is available on most, but not all, Linux distributions Also keep in mind that some tools are “available†but not yet available. In other words, there are some tools and daemons that need to be installed, and they do not need to be pre-installed on the Linux distribution in question.
Other networking topics
There are many aspects of networking and TCP / IP that are particularly interesting, especially when working with a Linux distribution. Don’t forget that you have man pages (also known as man pages) available right in your Linux installation. So, while this may seem like a kind of unrelated list of what you shouldn’t be doing, you can always use the man page to figure out what you should be doing.
Linux as a router
Most people these days use equipment designed for routing tasks (such as a router) to manage the network route task
In many cases, this is because the routers are part of a home or office internet package / contract. Usually the buyer is caught paying a monthly (or yearly) rent or having to buy a router.
Be that as it may, Linux practically does not need a router, even if it can work as one. The above scenarios create a near-pseudo-obsolescence situation for Linux, but that doesn’t mean Linux is completely out of the game. If necessary, you can configure the Linux server as a hardware (and subsequent software) router.
IP Route (formerly “Route”)
The following image shows a screenshot of the man page for “Route” and the directives that are possible with this tool.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
SNORT – Intrusion Detection System
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Snort Software is an open source intrusion detection system (IDS) originally developed by Martin Roche and later acquired by Cisco Systems. It operates on the basis of rules that use TCP / IP layers on the network. Defining these rules allows you to identify intrusions to protect your network.
How to Setup Linux TCP / IP Settings for Linux
The following mini-tutorials will help you with some of the common tasks you may encounter in the Linux world.
Keep in mind that times change quickly, so it is helpful to use their help pages as well as google searches to check the next steps and make sure there are no other tools out there that could do the job better. At the time of this writing, this is not the case.
Lesson 01: Assigning a Static IP Address to a Linux Machine
The first question you should ask is whether the computer / server needs a static IP address (one that does not change) or a changeable IP address (for example, DHCP – Dynamic Host Configuration Protocol). If this is your personal computer (not a server), chances are you are using DHCP to access the Internet.
This means you don’t have to fiddle with assigning a static IP address to your computer. Your Internet Service Provider (ISP) and any equipment provided / leased will automatically calculate the IP address on the fly so you can connect to the Internet. In other words, if you don’t need a static IP address, a dynamically changing one is fine for your non-server computer.
If you have a server and need to make it accessible to others (e.g. outside of your home; WAN / Internet; non-LAN), you will need a static IP address so that whatever domain you use is mapped with him. through a hosting name server assigned to the domain, or directly accessible through a static IP address
If no one needs access to your computer or server outside of your home, then changing the IP address (dynamic; non-static) is fine, because no one uses a static IP address
Note. Some people have used the DHCP IP for public access (yes, even as a server), but,
- it takes a very tech-savvy person to do this, so it’s not that common.
- It is much more difficult to maintain (due to its ever-changing nature) than a static IP address
If you really want a static IP, go ahead and follow the instructions here. Otherwise, you can skip this section.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
As you will see, the command (shown above) includes “sudo” at the beginning of the line. While it is possible to use the “su” (superuser) command and log in as the superuser, using “sudo” only runs that command as the superuser.
Another method, logging on as superuser, allows you to perform all tasks as superuser, making it easier to perform the required actions.
However, this comes with a security risk, so it’s safer to just run the command with sudo and allow the app to prompt for a password (if necessary) to run the command as superuser for that task / command.
The choice is yours and should be based on a simpler method. The file shown in the screenshot below can be accessed with the following command:
sudo vi / etc / sysconfig / network-scripts / ifcfg-eth0
Before using this command, the network device number is checked (eth0) to make sure it is correct. As you remember, Linux configurations are managed in the interface file, so it is very important that the interface number is checked from this file before editing the configuration file.
Another aspect of the configuration file to watch out for is the use of the word “static”. Since we are adding a static IP address, it is important to tell the config file that this is the case.
Notes have been added to the screenshot below for illustrative purposes, but should not be included in your config file. Also, some Linux distributions require quotation marks. There were no quotes in this particular config file in the auto-generated config file, so the trend continued and no quotes were added.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
The following screenshot shows what the file will actually look like with removed annotations and extra spaces.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
The following (and last) configuration file can be accessed for editing by typing:
sudo vi /etc/resolv.conf
Inside this file, you can add (or modify) name servers. These nameservers must match the other configuration file that you just changed. In this case, in / etc / sysconfig / network-scripts / ifcfg-eth0 (screenshot above).
The verbiage “name server” will be used. So, if the device config file specifies DNS1 = 8.8.8.8, the resolv.conf file must specify the nameserver 8.8.8.8.
Analogue DNS2 = 4.4.4.4 will appear as nameserver 4.4.4.4 in resolv.conf file.
In general terms, the steps above work with a Red Hat Linux distribution, but there is no guarantee that it will work in the future given this technological change. This is why configurations should be tested and verified.
After completing the configuration, restart the network interface using the preferred method as described above. This will apply the changes. It is also helpful to check the static IP address You can do this by trying to connect to this public static IP address from another device (preferably on a different network).
You can also call a friend or colleague and ask them to try to connect to a static IP from a different geographic location (and a different network).
Lesson 02: Network IP Aliases
More than one IP address can be assigned to a single network card (NIC). This is called a network IP alias because there will only be one actual IP address, so the additional IP addresses are aliases for the same card. To assign an IP address, use your favorite method of assigning an IP address, as described in Lesson 01.
It’s not that it has to be static, but in order to assign multiple IP addresses using network IP aliases, you need to assign IP addresses using a static IP address
Lesson 03: Changing the Hostname for a Linux Machine
Follow these steps to change the hostname of your Linux computer using your preferred editor:
1. Modify the hostname configuration file by typing the following in your command line application:
sudo vi / etc / hostname
If you see the old hostname in this config file, replace it with the new hostname
2. Modify the hosts configuration file by typing the following in your command line application:
sudo vi / etc / hosts
If you see an old hostname in this file, replace it with the new selected / assigned hostname in the same way as you did with the hostname config file in the previous step.
3. Reboot the Linux server or computer. One way to do this (depending on your Linux distribution) is to enter the following in your command line application:
sudo shutdown –r now
This restart is required for the changes to take effect.
Lesson 04: Enabling and Disabling a Network Card
One of the most interesting things you can do via the command line in Linux is enable or disable your Ethernet connection.
To do this, enter the appropriate command of these two:
sudo ip link setup sudo ip link setdown
On older versions of Linux, you can run ifconfigup or ifconfigdown, but it is possible that these commands are outdated or deprecated in newer Linux distributions In this case, the newer ip command is preferred.
Lesson 05: Enabling Network Forwarding
Your Linux operating system is capable of connecting many networks and can act as a router. All you have to do is uncomment the net.ipv4.ip_fporward = 1 line, which will allow you to forward the IP address
The required configuration file is usually stored in /etc/sysctl.conf:
For examples of how to set it up, see How to enable IP forwarding on Linux (IPv4 / IPv6)
If you are configuring your Linux server using DHCP (instead of a static IP address</a, you can choose one of the network forwarding forms. This is uncommon, but is mentioned here because it is doable and presents a case where someone might be tempted to do it.
Lesson 06: Remote Commands Through the Shell
In the event that you need to access a Linux server and that server is not geographically located in the same location as you, you may need to use remote commands to access this remote Linux server.
It is normal for programmers or system administrators to “connect” to the server remotely.
One of the most popular ways to do this is to use the “ssh” command, which tells the command line application that you want to securely access the Linux server, even if you are doing so over an insecure connection.
Apart from using the “ssh” command, you need to provide information about where and how you are connecting (among other available options).
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
You can use a domain name to access your Linux server, or even a public static IP address The name or IP address tells the ssh command what it is accessing and where to find it.
Other parameters may include the username that will be used to log into the remote server. If this parameter is not specified, it can be requested, but it can also be specified at the same time as the ssh command.
For example:
ssh username myserver.com
The password can also be configured in the command, but for security reasons it is recommended to enter it when connecting to a remote server.
Why? If the password is entered in a command in plain text, the next person using the same computer can access it and they will have access to the password.
For additional security reasons, you may need to access the Linux server on a specific port. By assigning a port that can be used, you can block other ports and prevent hacker attempts or DOS (denial of service) attacks.
There are many different configuration points for ssh. Some of them are listed on shellhacks.com
Lesson 07: Network Monitoring Tools
One of the important components of network management is making sure everything is up and running. You can do this through network monitoring. The tools that allow you to monitor your network vary, but ultimately achieve similar goals and objectives.
One such network monitoring tool is Cacti. Cacti is an open source network monitoring tool. Cacti monitors the network and provides a graphical representation of what has been registered. This helps users (especially newbies) identify where problems might be.
The frontend can accommodate many users and is sometimes used by hosting services to display real-time bandwidth information and other data in the following graphs.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
Data can be loaded into Cacti using any external script or command. Cacti will pull the data together using a cron job and populate your MySQL database before presenting it as a custom graph.
TCP/IP Files On Linux (TCP/IP Settings For Linux)”/>
To handle the collection of data, you can feed cacti the paths to any external script / command along with any data the user needs to “fill in”. Cacti will then collect this data in a cron job and populate the MySQL database.
Cacti is a useful tool for network administrators who want to track network usage and provide consumers with easy-to-understand visuals. Cacti can be downloaded for free at cacti.net The website has documentation for installing and configuring the network monitoring tool.
Cacti alternatives you can try include Solarwinds NPM, PRTG, and Nagios. Solarwinds will support SNMP as well as ICMP / Ping, WMI, Netflow, Sflow, Jflow, and IPFIX to name just a few. Ready-made templates, graphs and alerts help you quickly start monitoring your network.
PRTG provides up to one hundred sensors free of charge. It has features similar to Solarwinds, as well as flexible alerts and apps for smartphones, tablets and iPads.
Nagios has all the tools you find in Cacti, but it requires a little more configuration. There are many plugins to choose from. It has a solid reputation for being one of the oldest network management and monitoring tools. But you’ll have to get your hands dirty while serving up its config files.
–