RHEL7 network adapter link aggregation and grub troubleshooting tutorial, rhel7grub

Source: Internet
Author: User

RHEL7 network adapter link aggregation and grub troubleshooting tutorial, rhel7grub

1. Nic link Aggregation

NIC teaming, simply put, is to bind multiple physical ports together as one logical port for higher bandwidth and load balancing or high availability.

In RHEL7, runner (which can be regarded as a piece of code) is used to achieve different purposes.

The basic process of configuration is to configure a logical port connection as a master, and then configure the required physical port as a slave connection and bind it to the group. Then, allocate the logical port to an IP address.

Team: High Availability

(1) first prepare two NICs with different MAC addresses.

(2) create a new connection. The connection type is "team connection name" is "team0 ".

[root@kang ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
Activevbackup indicates hot backup and loadbalance indicates load balancing.

For example, change activebackup to loadbalance.

[root@kang ~]# nmcli connection  modify  team0 team.config '{"runner":{"name":"loadbalance"}}'
(3) After the master is configured, You have to configure slave to add two NICs eno16777736 and eno33554960 to team0.
[root@kang ~]# nmcli connection  add type team-slave con-name team0-1 ifname eno16777736 master team0 
[root@kang ~]# nmcli connection  add type team-slave con-name team0-2 ifname eno16777736 master team0  
(4.) execute the nmicli connection show command to view the status of the team0-1 and team0-2
[root@kang ~]# nmcli connection show   
(5.) It can be seen that the team0-1 and the team0-2 are not connected, execute the following command to connect the team0-1 and the team0-2
[root@kang ~]# nmcli connection up  team0-1Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)[root@kang ~]# nmcli connection up team0-2Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
(6) execute ifconfig and find that the network adapter address is the same so that the switch can forward packets to the same logical port.

Test it. First, check the current status of team0.

Disable the eno16777736 connection and automatically switch to the second physical connection port. The test is successful.

[root@kang ~]# nmcli connection  down  team0-1

Ii. RHEL7 grub configuration file and troubleshooting

RHEL7 uses grub2 instead of grub.

The first 446 bytes of the MBR partition are stored in the system boot program grub. The middle 64 bytes are the partition table, and the last two bytes indicate the end. How does grub work?

To put it simply, take the following steps:

1. BIOS self-check and check hardware;

2. Activate MBR. The MBR does not have a file system. It can be regarded as a part of hardware and therefore can be directly read.

3. Load grub to the memory to generate a Microsystem. The microsystem has a built-in lite file system.

4. Through this microsystem, it will guide the partition, for example, the default is generally sda1 to find the kernel file such as vmlinuz, and then call the grub configuration file.

Grub stores its configuration files in three places.

/Boot/grub2/grub. cfg (/etc/grub2.cfg is/boot/grub2/grub. cfg file Symbolic Link) # begin format #/etc/grub. d/# Run the executable scripts in ascending order./etc/default/grub # Take 00_header as an example. Call this configuration file to implement the most basic boot interface configuration.
[root@kang ~]# ls /boot/grub2/grub.cfg /boot/grub2/grub.cfg[root@kang ~]# ls /etc/grub.d/00_header  01_users  20_linux_xen     30_os-prober  41_custom00_tuned   10_linux  20_ppc_terminfo  40_custom     README[root@kang ~]# ls /etc/default/grub /etc/default/grub[root@kang ~]# 
In the/etc/grub2.cfg file, call/etc/grub. d/10_linux to configure different kernels. Here there are two menuentries (menu entry), so we will see two default options when starting the system. One is normal mode, one is the rescue mode.

This is the/etc/default/grub file. Compared with other scripts, it is very simple and intuitive. Next we will illustrate how to modify

Note that it is best not to directly modify the/etc/grub2.cfg file. This is because all configurations will fail if the kernel is upgraded later. If you need to customize this file, you can modify the corresponding script or/etc/default/grub file, and then regenerate the grub. cfg file through the grub2-mkconfig.

Example: (1) modify the startup wait time

RHEL7 has a default wait time of 5 seconds. The following changes the start time to 3 seconds (Note: if it is changed to-1, you must manually confirm the start time)

Modify the/etc/default/grub file, as shown in:

[root@kang ~]# vim /etc/default/grub 

After modification, recompile and generate the grub. cfg file.

[root@kang ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

For example, (2.) encrypt grub

Add the following content at the end of the/etc/grub. d/00_header file:

Cat <
 
  
Recompile and generate the grub. cfg file
  

After the system is restarted, enter e and enter the user name and password to enter the editing window.

How can I set the ciphertext password? Tip: the encryption password is generated by the command grub2-mkpasswd-pbkdf2

[root@kang ~]# grub2-mkpasswd-pbkdf2 
Add the following content at the end of the/etc/grub. d/00_header file:
Cat <
   
    
As shown in:
    

Recompile and generate the grub. cfg file

grub2-mkconfig–o /boot/grub2/grub.cfg
Restart Verification

Insert a tip:? In text terminal mode, you can copy and paste the gpm tool after it is installed and enabled.

Note: If you enter e on the boot page, the edit window is opened. You can enter rescue mode, emergency mode, or shell mode as needed.

How to restrict access.

In this editing window, we can solve system faults and perform troubleshooting based on the three boot modes.

(1) rescue mode: Add s at the end of commandline configuration, similar to the previous single-user mode of rhel6.

Press Ctrl + x to start

The normal mode requires a lot of loading modes, but this rescue mode requires a lot of loading, and you can enter the administrator password.

(2) the ememergency mode is similar to the rescue mode, but there are fewer loaded services. Just change s to emergency.

What if I forget the root password?

Method 1:

1. restart the system and press e

2. Add rd. break console = tty0 at the end of line Linux16

3. Press Ctrl + x to start

4. Re-mount the File System

5. Change the root directory

6. Modify the root password

7. Create related files in the root directory (used to re-mark selinux environment values)

8. Exit. The system will restart.

Method 2:

Delete the rhgb quiet in the last row of Linux16, and add init =/bin/sh. The default daemon process is replaced by shell.

Press Ctrl + x to start

Mount the file system in writable mode. The reason is simple: the root directory is loaded with ro, read-only, and re-loaded with rw permissions.

At this time, you can change the password. Execute passwd and follow the prompts to change the root password.

If selinux is enabled, run the following command. Otherwise, the system cannot be started properly:

When this file is created, the tag is automatically re-added when it is enabled, that is, the selinux environment value is re-marked.

Run exec/sbin/init to start the instance normally, or run exec/sbin/reboot to restart the instance.

Boot troubleshooting:

Example 1: grub fault: for example, the first 446 bytes of MBR are overwritten.

After the system is restarted, the following fault occurs:

Boot automatically tries to load the boot program from the local device, CD, and network (openoperatiing system not found if boot fails, such as the CD and network );

This is loaded from my CD, because the local boot program is no longer available.

Select troubleshooting (troubleshooting)

Select resure a red hat? Enterprise? Linux? System

Choose continue. Be patient and wait for a while. Sometimes the response will be stuck for 10 seconds.

Follow the prompts to switch the root to the local system

Fdisk-l to see which Shard to start.

Reload grub2 to start the partition.

Restart.

Example 2: If the grub boot program is okay, but we delete the kernel file or the grub. cfg configuration file, what should we do?

After the restart, go to the grub rescue mode. This indicates that the boot program is normal, but the boot file cannot be found.

As before, the disc starts, switches the root directory, and mounts the disc to the disc mount point. By the way, check the/boot directory. The directory is empty and the kernel file and configuration file are missing.

The solution is to re-install the kernel. You can use rpm or yum. To use yum, you must first uninstall the current kernel and then install it. rpm can force -- force overwrite the installation.

Therefore, it is installed in rpm mode.

After installing the kernel, reinstall grub2 and enter grub-install? /Dev/sda and recompile grub2.

Restart the system.

After the restart, if you encounter the following problems:

Start the system and enter command line mode. Even if runlevel displays 5, an error is returned when stastartx is entered manually.

The solution is to reinstall the graphical interface.

yum grouplistyum groupinstall 'Server with GUI'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.