Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS 7 (aggregate links, GRUB profile)

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

CentOS 7 (aggregate links, grub profile)

Lab requirements:

1. Create an aggregation link

two。 View grub's configuration file

3. Set encryption for grub

4. Reset the password for users of root

The steps of the experiment:

I. Link aggregation

NIC teaming, to put it simply, means that multiple physical ports are bound together and used as a logical port to improve bandwidth, achieve load balancing or high availability. RHEL7 uses runner (which can be thought of as a piece of code) to achieve different purposes.

The basic process of configuration is to configure a connection to a logical port, which is treated as master;, and then configure the required physical port as a slave connection and bind it to the group. Then assign this logical port to IP and you can use it.

Team: high availability

First, prepare two network cards, which have different MAC addresses

Create a new connection of type team connection name team0.

Activebackup means hot backup, and loadbalance means load balancing.

When master is configured, you have to configure slave, that is, two network cards, eno16777736 and eno33554960, are added to team0.

Execute the nmcli connection show command to view the status of team0-1 and team0-2

Team0-2 is not enabled in the image above. Enable it before viewing:

Execute ifconfig and find that the address of the network card is the same, so that the switch can forward the packet to the same logical port.

Finally, assign an IP address to team0 (you can also set the IP address directly with the graphical tool)

II. Rhel7 grub configuration files and troubleshooting

RHEL7 uses grub2 instead of grub

The first 446 bytes of the MBR partition hold the system bootstrap program grub, the middle 64 bytes are the partition table, and the last 2 bytes indicate the end. So what is and how does grub work?

To put it simply, open an opportunity to go through the following steps:

1. BIOS self-test, check the hardware

2. The file system does not exist on the activated MBR,MBR and can be regarded as part of the hardware, so it can be read directly.

3. Grub is loaded into memory to generate a microsystem with a simplified version of the file system built into the microsystem.

4. Through this microsystem, he will boot the partition. For example, by default, sda1 will go up to find the kernel file such as vmlinuz, and then call the configuration file of grub.

Grub mainly puts his configuration file in three places.

/ boot/grub2/grub.cfg (/ etc/grub2.cfg is a symbolic link to the / boot/grub2/grub.cfg file)

/ etc/grub.d/

/ etc/default/grub

As shown below. Their relationship is that grub.cfg uses the format # BEGIN # to call the scripts in / etc/grub.d sequentially to achieve different functions. There are a lot of numeric scripts in the grub.d directory, executed in order from smallest to largest. Take 00__header as an example, he will call the / etc/default/grub configuration file to achieve the most basic boot interface configuration.

Example 1: modify the waiting time for startup

The default startup waiting time for rhel7 is 5 seconds. Change the startup time to 3 seconds. (note: if it is changed to-1, manual confirmation is required for each startup.)

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

Recompile to generate grub.cfg file after modification

Example 2: encrypt grub

If you enter e when you boot the interface, an editing window will open, and we can enter rescue, emergency or shell mode as needed. How to restrict access.

At the end of the / etc/grub.d/00_header file, add the following:

Recompile to generate a grub.cfg file

Type e after reboot, and you need a user and password to enter the editing window.

This is the configuration file for grub

So what if I forget my root password?

1. Restart the system and press e

2. Add a message at the end of the linux16 line

Rd.break console=tty0

3. Press ctrl+x to start

4. Re-attach to the file system

5. Change the root directory

6. Change the root password

7. Create a related file under the root directory (used to relabel the selinux environment value)

8. Exit and the system will restart

=

Through some experiments to verify the theory, welcome to reprint, learn!

Http://taoliang.blog.51cto.com/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report