Enable Network Redhat 7
When a system administrator wants to increase the bandwidth available and provide redundancy and load balancing for data transfers, a kernel feature known as network bonding allows to get the job done in a cost-effective way.
Chkconfig network on service network start Restart the network on CentOS 7, CloudLinux 7, or RHEL 7. Systemctl enable network.service systemctl start network.service. Setup network on CentOS 7 minimal. First, type “nmcli d” command in your terminal for quick list ethernet card installed on your machine: “nmcli d” command output. Type “nmtui” command in your terminal to open Network manager. After opening Network manager chose “Edit connection” and press Enter (Use TAB button for choosing options).
Read more about how to increase or bandwidth throttling in Linux
How to Limit the Network Bandwidth Used by Applications in a Linux with Tricklehttp://t.co/It2ccJeAih
Via @tecmintpic.twitter.com/nzKwF3ec2O
— TecMint.com (@tecmint) September 17, 2015
In simple words, bonding means aggregating two or more physical network interfaces (called slaves) into a single, logical one (called master). If a specific NIC (Network Interface Card) experiences a problem, communications are not affected significantly as long as the other(s) remain active.
Read more about network bonding in Linux systems here:
Enabling and Configuring Network Bonding or Teaming
By default, the bonding kernel module is not enabled. Thus, we will need to load it and ensure it is persistent across boots. When used with the --first-time
option, modprobe will alert us if loading the module fails:
The above command will load the bonding module for the current session. In order to ensure persistency, create a .conf
file inside /etc/modules-load.d
with a descriptive name, such as /etc/modules-load.d/bonding.conf
:
Now reboot your server and once it restarts, make sure the bonding module is loaded automatically, as seen in Fig. 1:
In this article we will use 3 interfaces (enp0s3
, enp0s8
, and enp0s9
) to create a bond, named conveniently bond0
.
To create bond0
, we can either use nmtui, the text interface for controlling NetworkManager. When invoked without arguments from the command line, nmtui brings up a text interface that allows you to edit an existing connection, activate a connection, or set the system hostname.
Choose Edit connection –> Add –> Bond as illustrated in Fig. 2:
Create Network Bonding Channel
Redhat 7 Download
In the Edit Connection screen, add the slave interfaces (enp0s3
, enp0s8
, and enp0s9
in our case) and give them a descriptive (Profile) name (for example, NIC #1
, NIC #2
, and NIC #3
, respectively).
In addition, you will need to set a name and device for the bond (TecmintBond
and bond0
in Fig. 3, respectively) and an IP address for bond0
, enter a gateway address, and the IPs of DNS servers.
Note that you do not need to enter the MAC address of each interface since nmtui will do that for you. You can leave all other settings as default. See Fig. 3 for more details.
When you’re done, go to the bottom of the screen and choose OK (see Fig. 4):
Configuration of bond0
And you’re done. Now you can exit the text interface and return to the command line, where you will enable the newly created interface using ip command:
After that, you can see that bond0
is UP and is assigned 192.168.0.200, as seen in Fig. 5:
Testing Network Bonding or Teaming in Linux
To verify that bond0
actually works, you can either ping its IP address from another machine, or what’s even better, watch the kernel interface table in real time (well, the refresh time in seconds is given by the -n
option) to see how network traffic is distributed between the three network interfaces, as shown in Fig. 6.
The -d
option is used to highlight changes when they occur:
Check Kernel Interface Table
It is important to note that there are several bonding modes, each with its distinguishing characteristics. They are documented in section 4.5 of the Red Hat Enterprise Linux 7 Network Administration guide. Depending on your needs, you will choose one or the other.
In our current setup, we chose the Round-robin mode (see Fig. 3), which ensures packets are transmitted beginning with the first slave in sequential order, ending with the last slave, and starting with the first again.
The Round-robin alternative is also called mode 0
, and provides load balancing and fault tolerance. To change the bonding mode, you can use nmtui as explained before (see also Fig. 7):
If we change it to Active Backup, we will be prompted to choose a slave that will the only one active interface at a given time. If such card fails, one of the remaining slaves will take its place and becomes active.
Let’s choose enp0s3
to be the primary slave, bring bond0
down and up again, restart the network, and display the kernel interface table (see Fig. 8).
Note how data transfers (TX-OK and RX-OK) are now being made over enp0s3
only:
Bond Acting in Active Backup Mode
Alternatively, you can view the bond as the kernel sees it (see Fig. 9):
Summary
In this chapter we have discussed how to set up and configure bonding in Red Hat Enterprise Linux 7 (also works on CentOS 7 and Fedora 22+) in order to increase bandwidth along with load balancing and redundancy for data transfers.
As you take the time to explore other bonding modes, you will come to master the concepts and practice related with this topic of the certification.
If you have questions about this article, or suggestions to share with the rest of the community, feel free to let us know using the comment form below.
This scope of this tutorial is to explain how we can edit and make changes to Network Configurations on RHEL/CentOS 7.0 from command line only, and, more specific how we can set up a Static IP addresses on network interfaces using system network scripts, which is a must be configured to serve Internet-facing network services, and how to configure or change RHEL/CentOS 7.0 system hostname.
Also will show you, how we can manage or disable unwanted system services, such as Network Manager, which is no longer needed in-case you use a manual static IP configured on network scripts, Avahi-Daemon which is, also, not needed on a server and represents a seriously security gap, unless you installed the server on your Laptop and you want to instantly browse your network for other services, and on the final will present you Network Manager Text User Interface – nmtui, a system utility that can ease the job of editing your system network settings with advanced Interface configurations like creating Bond, Bridge, Team and VLAN Interfaces.
Requirements
Also be aware that most of configurations offered by editing system files should not be performed from a remote location using SSH service until you establish an continue and reliable network connection using a fixed IP address.
Step 1: Disable Unwanted System Services
1. Before actually starting to do anything we need to make sure that our system has some necessary editing and networking tools like netstat, ifconfig, wget and curl installed, some of them will not be used on this step but
it’s better to have them installed for future configurations.
Install wget in Linux
Install lsof in Linux
2. After the tools have installed run ifconfig to get your Network Interfaces settings and status, and, then run netstat or lsof command to check what services are running by default on our server.
3. The netstat command output is pretty self-explanatory and shows a list of sockets associated with their running program name.
If, for example, our system will not be used as a mail service you can stop Postfix master daemon which runs on localhost and, also stop and disable other unwanted services using the following commands – the only service I advise not to stop or disable for now is SSH, if you need remote control over server.
Stop Avahi Daemon
4. You can, also, use old init commands to stop or disable services but since Red Hat now implements systemd process and service management, you should better get used to systemctl command and use it often.
If you used Arch Linux then it should be a piece of cake to switch to systemd – although all init commands now are linked and pass-through systemd filter.
5. If you want to get a list of all started services run service command and for an exhaustive report use systemctl.
List All Services in Linux
6. To manage services run systemctlcommand using the most important switches: start, stop, restart, reload, disable, enable, show, list-dependencies, is-enabled etc. followed by your service name.
Also, another important feature that systemctl command can also run on remote server through SSH service on a
specified host using –H option and perform the same actions as locally. For example, see the command and screenshot below.
Run systemctl on Remote Server
Step 2: Configuring Static IP and Set Hostname
7. Before starting editing Network Interface Card system files make sure that from now on and until you set static IP, you have physical or any other type of access to your server, because this step requires bringing down your network interface and connections.
Although it can be done smoothly without disrupting your connectivity and activate connection after reboot. There is no way you can test it before reboot, if you only have a single NIC attached. Still I will present you the entire method and indicate the steps needed to be avoided in case you want to maintain your connectivity and test it afterwards.
For beginning start by stopping and disabling NetworkManager service.
8. Now move to /etc/sysconfig/network-scripts/ path, open and choose your Network Interface you want to assign static IP for editing – to get all NICs names use ifconfig -a or ip -a commands.
9. Use the next template to edit file and make sure that ONBOOT statement is set on YES , BOOTPROTO is set to static or none and don’t change HWADDR and UUID values provided by default.
10. After finishing editing the file, close it and move to resolv.conf file if you want DNS servers enabled system wide.
Here just add your DNS servers using nameserver statement.
11. Now Network Interface is configured with a static IP, the only thing remaining is to restart your network or reboot your system and use ifconfig or ip command to view IP address and test configuration using ping command.
NOTE: After restart use the newly static IP address configured to perform remote login with SSH.
Start Newtork in Linux
12. To adjust system hostname system-wide, open hostname and hosts file located on /etc path and edit both the following way.
Hostname File
Here you can add just the name of the system but it’s a good idea to append the .dot domain to.
Hosts File
Here add the same hostname as above on 127.0.0.1 line before localhost.localdomain statements.
To test if your hostname is correctly set use hostname command.
Step 3: Use Network Manager Text User Interface
13.NetworkManager Text User Interface (TUI) tool, nmtui, is a RHEL intuitive tool which provides a text interface to configure networking by controlling Network Manager, which helps editing advanced network settings such as assign static IP addresses to Network Interfaces, activate or disable a connection, edit WI-FI connections, set your system hostname or create advanced Network interfaces like InfiniBand, bond, bridge, team or VLAN.
NetworkManager-tui is installed by default in RHEL/CentOS 7.0, but if for some reasons its missing issue the following command to install it.
14. To start Network Manager Text User Interface run nmtui command and use TAB or arrow keys to navigate through and press Enter to select an option. If you want to directly edit or connect a specific interface run the following options.
NetworkManager Text User Interface
If you want to set static IP you can, also, use Network Manager Text User Interface as a facile alternative to actually edit network interfaces files, with a limited number of options that method has to offer, but make sure Network Manager service is enabled and started on your system.