centos 8 – ExpLinux https://www.explinux.com Explore Linux How to, Tutorials, Unix, Updates, Technology. Fri, 31 Dec 2021 11:18:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://www.explinux.com/wp-content/uploads/2023/04/cropped-favicon-32x32-1-32x32.png centos 8 – ExpLinux https://www.explinux.com 32 32 Bye Bye CentOS 8 with 2021 !!! Thanks for Everything . Best Alternative ? https://www.explinux.com/2021/12/bye-bye-centos-8-with-2021-thanks-for-everything-what-next.html https://www.explinux.com/2021/12/bye-bye-centos-8-with-2021-thanks-for-everything-what-next.html#comments Fri, 31 Dec 2021 11:12:42 +0000 https://explinux.online/?p=511 Bye Bye CentOS 8 with 2021 !!! Thanks for Everything . Best Alternative ? Read More »

]]>
Bye, Bye CentOS 8 with 2021 !!! Thanks for Everything. Best Alternative?

CentOS8 EOL 31 Dec 2021 Bye Bye CentOS 8 with 2021

Finally, Today is 31 December 2021 last day of the year and CentOS 8 End of Life. When we say bye to 2021 we will say goodbye to our CentOS 8 as well.

From 2004 to till now CentOS was used by many system administrators and companies. Even most open-source applications are still working on CentOS 8 till Dec 2021 application has not been migrated from CentOS to another OS or alternative of application.  Here I am talking about applications or solutions which some companies provide in an ovf or ova formate for VMware. After deployment, we got CentOS 8 even some paid tools as well.

2020  Dec Redhat Announced CentOS 8 EOL in Dec 2021 it was a deep loss for mostly Administrators and tool developers because it has supported them for 16 years in their administrator and developer journey. Even many organizations are relying on CentOS. Administrators know how to work is easily done on CentOS instead of RHEL. Even CentOS is forked by RHEL binary to binary. This is because we have more customization freedom on CentOS and all repo packaged already provided on CentOS. RHEL admins know that even a separate package installation can make REDHAT decline for support.

If you are using CentOS 7 then no need to change or upgrade OS urgently because CentOS 7  EOL is June 2024. Still, you have 4 years with your favorite CentOS 7. But for CentOS 8 today is the last day and maybe in the new year, 2022 vulnerability scanners show it as a vulnerability due to no support from the community.

Redhat has given the option also to switch from CentOS Linux to CentOS Stream. CentOS Stream is like the RHEL beta version. For test environments, it could be the best option.

So what next do we have to switch CentOS stream or RHEL  or any other option?

What is the best replacement for CentOS 8?

We have many options because we know the new Linux distro launch every month or week we can say. But for CentOS 8 replacement there are two options that suit better for replacement.

 

Alternatives

 

Rocky Linux

Rocky Linux is one of the best alternatives with bug-to-bug compatibility and it is created under the supervision of the same person Gregory Kurtzer who was responsible for CentOS birth. The best part is that this time Rocky Linux does not repeat the same mistake which was done at the time of CentOS which leads Redhat to takeover CentOS and not CentOS is dead or we can say the change in the lifecycle. Rocky Linux has registered its own trademark and done changes in RHEL forked version also. This is the reason before Rocky there are other distros released and Rocky Linux has taken its own time. Last month 25 Nov Rocky has celebrated its first anniversary .

Alma Linux

Alma is forked RHEL and created its own brand of Alma Linux it is 1:1 binary compatible with RHEL. It is funded by Cloudlinux but it is completely free and own by the community. This distro is a complete copy of RHEL you will not feel any difference only the name and some files. Till now alma gives a faster version release compared to Rocky or other distributions.

These two distros you can migrate from CentOS to Rocky or Alma in a very smooth way. Your data will not be lost. There are other alternatives also available Springdale, Oracle Linux, etc. After CentOS, you have to distro hopping if you have not decided till now.

Conclusion

CentOS 8 Linux has changed its lifecycle and from 1 Jan 2022 CentOS 8 life has been ended. A relief for CentOS users it’s EOL is June 2022. So you have sufficient time to think about your new distro. We have alternatives available like Rocky or Alma which is easy to migratable from CentOS.

Last we want to thank the CentOS community for maintaining and distributing an awesome distro.

]]>
https://www.explinux.com/2021/12/bye-bye-centos-8-with-2021-thanks-for-everything-what-next.html/feed 1
Mysql resource is unable to start after failover due to permission change on ‘/var/lib/mysql’ directory. https://www.explinux.com/2021/04/mysql-resource-is-unable-to-start-after-failover-due-to-permission-change-on-var-lib-mysql-directory.html https://www.explinux.com/2021/04/mysql-resource-is-unable-to-start-after-failover-due-to-permission-change-on-var-lib-mysql-directory.html#comments Thu, 08 Apr 2021 11:05:00 +0000 Mysql resource is unable to start after failover due to permission change on ‘/var/lib/mysql’ directory. Read More »

]]>
If you are working on a cluster, after a sudden failover you face the issue that Mysql is unable to start.

In this article, we will show you how to solve the issue.

Environment

  • Red Hat Enterprise Linux Server 6 (with the High Availability and Resilient Storage Add Ons)
  • Red Hat Enterprise Linux Server 7
  • Red Hat Enterprise Linux Server 8
  • MySQL

Issue

  • Permission of mount point of MySQL data directory gets changed.
  • Mysql resource is unable to start in the other node after failover from the first node.

    
    Sep  2 16:23:57 node A rgmanager[144383]: [fs] mounting /dev/dm-4 on /var/lib/mysql
    Sep  2 16:23:57 node A kernel: EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: 
    Sep  2 16:23:57 node A rgmanager[144527]: [mysql] Checking Existence Of File /var/run/cluster/mysql/mysql:DB_name.pid [mysql:DB_name] > Failed 
    Sep  2 16:23:57 node A rgmanager[144549]: [mysql] Monitoring Service mysql:DB_name > Service Is Not Running 
    Sep  2 16:23:57 node A rgmanager[144571]: [mysql] Starting Service mysql:DB_name
    Sep  2 16:24:27 node A rgmanager[145724]: [mysql] Starting Service mysql:DB_name > Failed - Timeout Error 
    Sep  2 16:24:27 node A rgmanager[4142]: start on mysql "DB_name" returned 1 (generic error)
    

Resolution

  • Change the UID and GID of the MySQL user and keep it the same across all the cluster nodes.
  • Also, check that the UID and GID which you are going to assign for the MySQL user should not be possessed by any other user. If any then kindly change the UID and GID before changing the MySQL credentials.
  • Once after changing the credentials now try to failover the service from one node to another and the service should start without any issue.

Root Cause

  • The User and Group credentials of Mysql are not the same in all the cluster nodes.

    On node A
    # ls -ld /var/lib/mysql/
    drwxr-xr-x 5 495 490 4096 Sep 11 00:21 /var/lib/mysql/
    # grep -i mysql /etc/passwd
    mysql:x:496:491:MySQL server:/var/lib/mysql:/bin/bash

    On node B
    # ls -ld /var/lib/mysql/
    drwxr-xr-x 5 496 491 4096 Sep 11 00:22 /var/lib/mysql/
    # grep -i mysql /etc/passwd
    mysql:x:495:490:MySQL server:/var/lib/mysql:/bin/bash

  • As it can be seen from the above output that  UID and GID of the MySQL user on the first node is 496 and 491 respectively. And the UID and GID of the MySQL user in the second node of the cluster is 495 and 490 respectively.

  • For mysql to access the data from /var/lib/mysql which is the default home directory, permission needs to be mysql:mysql.
    Because of the different UID and GID of the mysql the user on both the nodes, when the cluster relocates the mysql resource from one node to other node it mounts the mysql data on the second node with the same UID and GID of the first node which does not match the mysql credentials on the second node due to which the mysql resource was not able to start on the second node.
Now you have successfully recovered from the issue. Please let us know if this helped you.
]]>
https://www.explinux.com/2021/04/mysql-resource-is-unable-to-start-after-failover-due-to-permission-change-on-var-lib-mysql-directory.html/feed 2
Grub2 files are missing from /boot. How to recover ? https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html#respond Tue, 23 Feb 2021 02:13:00 +0000 Grub2 files are missing from /boot. How to recover ? Read More »

]]>
Repair Grub2

Grub2 or Boot Repair  

Due to some file corruption or mishandling we lost grub. This can cause the system to hang in the boot.

When you reboot the system it will not boot, So before rebooting the system check this file is in place or not. If you accidentally rebooted and the system is unable to boot then boot the server in rescue mode and follow the below steps.

Environment

  • Red Hat Enterprise Linux 7 
  • CentOS 7
  • RHEL 8

Issue

  • Missing the ‘/boot’, grub folder, and grub.conf file which are essential to boot the system.
  • How to recover missing boot files ?

Resolution

  • Verify Boot directory contents are really missing or the /boot is not mounted properly :
#ls /boot/grub2/
  • Install grub2:
#grub2-install /dev/<disk name>
  • Create grub.cfg file:
#grub2-mkconfig -o /boot/grub2/grub.cfg
  • Create device.map file if missing:
#vi /boot/grub2/device.map

(hd0) /dev/<disk name>
  • Reboot
Now the server or PC  will boot properly. In this article, we have learned the way to recover grub and save it from reinstallation.
]]>
https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html/feed 0
How to disable EEE feature on the nic on RHEL7-8/Centos7-8 https://www.explinux.com/2021/01/how-to-disable-eee-feature-on-the-nic-on-rhel7-8-centos7-8.html https://www.explinux.com/2021/01/how-to-disable-eee-feature-on-the-nic-on-rhel7-8-centos7-8.html#respond Tue, 19 Jan 2021 07:25:00 +0000 How to disable EEE feature on the nic on RHEL7-8/Centos7-8 Read More »

]]>
 

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • CentOS 7
  • CentOS 8

Issue

  • Would like to disable the (Energy Efficient Ethernet) EEE feature of the NIC.

Resolution

  • To disable EEE use the ethtool command. In the example below, EEE is disabled on eth0:
# ethtool --set-eee eth0 eee off
  • To make this change persist across reboots, please add the ETHTOOL_OPTS parameter to the interface’s interface configuration file found in the /etc/sysconfig/network-scripts/ directory. For example:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:21:97:2E:EE:77
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
ETHTOOL_OPTS="--set-eee ${DEVICE} eee off"

Diagnostic Steps

  • The ethtool command option –show-eee will display the current status of EEE:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# ethtool --show-eee eth0
EEE Settings for eth0:
EEE status: enabled - inactive
Tx LPI: 0 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Link partner advertised EEE link modes: Not reported
]]>
https://www.explinux.com/2021/01/how-to-disable-eee-feature-on-the-nic-on-rhel7-8-centos7-8.html/feed 0
How to reset my MySQL database root password? https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html#respond Sun, 17 Jan 2021 02:02:00 +0000 How to reset my MySQL database root password? Read More »

]]>
How to reset my MySQL database root password?
This is a very common issue if you are working in a big environment or a system where everything is automated. People always forgot their MySQL password. This article will help you recover your password without any data corruption.

Environment

  • Red Hat Enterprise Linux including:

    • Red Hat Enterprise Linux 3
    • Red Hat Enterprise Linux 4
    • Red Hat Enterprise Linux 5
    • Red Hat Enterprise Linux 6
    • Red Hat Enterprise Linux 7
    • Red Hat Enterprise Linux 8
  • MySQL-server

Issue

 Forgot the MySQL root password. And you want to know how to reset your password. How do I reset the mysql-server password?

# mysql -u root'
Access denied for user 'root'@'localhost' (using password: NO)'

Resolution

To reset the MySQL root password We have to follow the below procedure :

  1. The first Step stop the MySQL service:
    # service mysqld stop
    Stopping MySQL: [ OK ]
  2. Use the below command to start MySQL :

    # /usr/bin/mysqld_safe --skip-grant-tables &

    Note: On RHEL 3, mysqld_safe was called safe_mysqld:

    # /usr/bin/safe_mysqld --skip-grant-tables &

    Note: mysql_safe is a shell script this will only invoke mysqld but additionally traps any forceful terminations of the MySQL server and this will avoid any database corruption. 

  3. Change the password of the root user:

    # mysql -u root mysql
    mysql> UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
    mysql> FLUSH PRIVILEGES;
    mysql> exit;
  4.   Now Restart mysqld first use mysqladmin to ensure that the service shutdown successfully to avoid any other issue.

    # mysqladmin -p shutdown

  5. Now restart the MySQL service as per normal:

    # service mysqld start 

Root Cause

  • The root password for mysqld was forgotten or lost.
  • You are a new admin and the old admin did not handover passwords.
  • Other team members reset the password and missed it.
  • Use of file to create a new server but MySQL password is not mentioned in doc.
]]>
https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html/feed 0
How to set ulimit or change the default soft or hard limit for the number of user’s processes? https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html#respond Fri, 11 Dec 2020 10:56:00 +0000 How to set ulimit or change the default soft or hard limit for the number of user’s processes? Read More »

]]>
 

How to set ulimit unlimited

Environment

  • RHEL/CentOS 5
  • RHEL/CentOS 6
  • RHEL/CentOS 7
  • RHEL/CentOS 8

Issue

  • The default configuration file for ulimit  is   /etc/security/limits.d/90-nproc.conf  for (RHEL5RHEL6), /etc/security/limits.d/20-nproc.conf   for (RHEL7) and for RHEL 8 we have to create file  /etc/security/limits.d/20-nproc.conf specifies the default nproc limits as,:

    *            soft    nproc     1024
    root       soft    nproc     unlimited
  • Even  when logged in as root, the ulimit shows a different value:

    $ ulimit -u
    1024
    
  • It is a bit confusing that  it is not unlimited in this case?

  • Now we have a question in our mind that how to set or change the default soft or hard limit for the number of user’s processes?

Resolution

If we have to set the nproc limit to unlimited for all system , Need to change in the file  /etc/security/limits.d/90-nproc.conf (RHEL5RHEL6), /etc/security/limits.d/20-nproc.conf (RHEL7RHEL8) should read:

  • For the root user:

    root       hard    nproc     unlimited
    
  • For the ‘root’ user, both ‘soft’ and ‘hard’:

    root       -    nproc     unlimited
    
  • or, for default domain again both ‘soft’ and ‘hard’ for example:

    *          -    nproc     unlimited
    
  • The unlimited option applied to the soft value for a domain cannot go beyond its hard limit. 

  • Re-login for changes to take effect:

    $ ulimit -u
    
  • Another option to set the limits per session based is to specify it on the command line:

    $ ulimit -u unlimited
    
  • The above command applies to both soft and hard limits. 

Note: 

1- The pam of RHEL5 and RHEL8 don’t provide any files under /etc/security/limits.d. If necessary, make the file.

2- RHEL8 does not have the file  /etc/security/limits.d/20-nproc.conf, so if you want to limit nproc on RHEL8, you need to create a file like /etc/security/limits.d/20-nproc.conf in /etc/security/limits.d/.

Now you have successfully increased ulimit to unlimited. Please share this article if helpful 

]]>
https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html/feed 0
How To Enable X11 Forwarding in RHEL 8 / Centos 8 https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html#respond Tue, 07 Jul 2020 03:00:00 +0000 https://explinux.online/2020/07/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8/ How To Enable X11 Forwarding in RHEL 8 / Centos 8 Read More »

]]>
How To Enable X11 Forwarding in RHEL 8 / Centos 8

How To Enable X11 Forwarding in RHEL 8 / Centos 8

X11 is very important for a sysadmin because some applications only install or run on GUI. This always happen in case of third party applications. So in this article, we are talking about how to use x11 forwarding.
This is an awesome tool for every sysadmin who is working remotely via putty and need to work or install GUI applications.
Mostly cases we use it on java and KVM applications with the help of x11. 
If you are using it on the remote machine do not set any environment variable. Just enable x11 forwarding in ssh setting in putty and follow the below steps.
Putty Setting for x11

What is X11?

X11 is the final or 11th version of x windows system .Mostly places we see x window and in Linux we see x11. 
In this system, a program or we can say, x client display graphics on our localhost or windows computer and run on the remote machine. And receives its input from the screen for the remote machine. 
In Linux when we are working on the remote machine via putty and we required to work on any graphical application we use x11 forwarding on the Linux machine.

X11 Forwarding is Secure?

 The secure shell has the feature of x11 forwarding. So our all data travel from ssh to localhost. Then we can say x11 forwarding is secure as ssh connection is secure.

How To Enable X11 Forwarding in Linux?

Step-1 Install requires packages 

# yum install xterm xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils -y

Step-2 Change the ssh configuration file for X11

We need to do changes to access the GUI application over ssh. Search Address family and unhash and change it as below:
#Port 22
AddressFamily inet
#ListenAddress 0.0.0.0
#ListenAddress ::
Search X11Forwarding  and unhash it. Do not change any other setting or environment variable.
X11Forwarding yes

Step-3 Restart ssh 

Restart ssh daemon for apply changes 
# systemctl restart sshd

Step-4 You need an Application 

You need to install xming or any application where putty forward x11 requests and display graphics.
You can check by type xterm application.
# xterm 
This will open the application in GUI mode in your x display application 
xterm
Now at this point, you have successfully configured x11 to use the graphical application on putty.
Share the article if found helpful.
]]>
https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html/feed 0
How to Use vi Editor in Linux and vi Editor Cheat-Sheet with 38 Shortcut https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html#comments Sun, 05 Jul 2020 04:30:00 +0000 https://explinux.online/2020/07/05/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux/ How to Use vi Editor in Linux and vi Editor Cheat-Sheet with 38 Shortcut Read More »

]]>
How to Use vi Editor in Linux and vi Editor Command in Linux
How to Use vi Editor in Linux and vi Editor Command in Linux

How to Use vi Editor in Linux and vi Editor Command in Linux

vi Editor :

. vi is the symbolic link of vim and this default editor comes with Linux based OS. This is very popular among sysadmins. This a very simple and powerful editor. You can use it to make your rivels list, a letter to your valentine, script, code, and edit any source code. This is your best friend in the Linux system.

vi Editor modes:

vi Editor has 3 modes –

1- Command mode :

                                This is the default mode when we enter in vi editor. In this mode almost every key n keyboard has a function, so use it very carefully.
Command mode
Command mode when enter file using vi <filename>
Command mode when press esc key
Command mode when press esc key from any other mode

2- Insert Mode :

                         You can enter this mode by pressing the “i” key on the keyboard. In this mode, you can write anything your code, list, or edit file.
insert mode

3- Visual mode  or GUI mode :

                                                This is not available in all distro and less used feature of vi editor. You can enter this mode by pressing the “v” key on the keyboard from command mode.
visual mode
Note: By default vi editor mode is Command mode. You can enter any mode from command mode only and escape from that mode to command mode by pressing the “esc” key on the keyboard.
These are the modes of vi editor in Linux. Below you will see some vi editor cheat sheet which you can use in your sysadmin work and give you more understanding of vi editor commands in Linux.

vi Editor Basic Commands :

In this section, we will talk about the basic command of vi editor which has to know by every Linux user for use of the basic function of vi editor.

Create New File or Enter Any Existing File :

To enter any file use command vi <filename>. For example, see below
# vi explinux
enter vi editor
you will enter in command mode as default by this command.

Write or edit in vi editors:

Press lowercase i to enter in edit mode. Now you can write anything or delete and navigate by keyboard navigation arrow key.
insert mode

vi Editor Save and Exit :

When you finished your editing you have to come in command mode for exit or save the file. Please find below the steps to save and exit from the file.
  1. Press esc key on the keyboard to change command mode from insert mode.
  2. write “:wq! ” in lowercase. Press enter key to execute the command to save and exit from file. Please check below pic to understand more.
vi editor save and exit
w – stands for save file 
q – stands for quit from file 
! – do not ask anything just run my command 

vi Editor Cheat Sheet :

Now you have learned how to use vi editor and basic commands of vi editor which every Linux user should have known. Now we will talk about some advance command which should be known by every Linux sysadmin or any advance user.
These commands will run only in command mode as mentioned earlier. By default vi is in command mode if you are in another mode press esc key to enter in command mode.
Linux is a case sensitive so be careful about it.

List of Commands :

Open or edit any file :

# vi <filename>

Enter to Insert mode 

i

Enter in Command Mode:

esc key on the keyboard
Save the file and Continue Editing:
:w
Save and quit vi Editor :
:wq!
Quit from file and do not write change :
:q!

Yank :

Copy or yank line :
yy
Copy X number of lines :
Xyy
for example 3 lines – 3yy
Paste Yanked File Below the Cursor Line :
p
Paste Yanked File Above the Cursor Line :
P    or  shift+p
This is the yank function that can be used to reduce time. This is a very useful command.
Create a New Line below the current line of Cursor :
o
Create a New Line Above the Current Cursor Line:
O  or shift+o
Go To End of Line and Switch To Insert Mode for Write:
A  or shift+a
Switch To Insert Mode At Start Of Line:
a
Switch to Insert Mode at the Beginning of Line :
I   or  shift+ i
Move to Begin of the Word :
b
Move to End of  the Word:
e
 
Go to the Last Line of Open file :
G  or shift+g
Go to the X Number Line of Open file :
XG
for example, we have to go on 3rd line: 3G
Go to the X Number Line of Open file :
gg
Delete a Single Letter or Character:
x
Delete a Single Word in Open File:
dw
Delete X Number of Words in Open File :
Xdw
for example, delete 3 words: 3dw
Change Any Word in vi Editor :
cw
Delete an Entire Current Line :
dd
Delete X Lines in One Command :
Xdd
For example, we have to delete 3 lines then: 3dd
Change or Replace Any Character or Letter :
r
Overwrite All Characters form onwards Cursor Position: 
R  or shift+r
Get the Current Line’s line Number in Open File:
:num  and press enter
Get All Lines’s Line Number in Open File:
:set nu  and press enter key
Undo Last Change in vi Editor :
u
Undo Last Change in entire Line vi Editor :
U  or shift+g

Search in vi Editor :

/<yourstring>
or
?<yourstring>
press n for the next result in an open file in vi editor .

Navigation In vi Editor :

Move left :
h
Move Down:
j
Move up :
k
Move right :
l
At this point, you are familiar with vi editor commands. Practice more to become pro at vi editor.

Summary :

  • The vi editor is most popular and distributed in every Linux distribution to edit almost all types of files.
  • There are 3 modes of vi editor
  • In this article, we covered almost all commands of vi editor
Share Article if you like it or report any bug in comments
]]>
https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html/feed 1
How to Create Network Bridge in RHEL 8 /Centos 8 https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html#respond Thu, 02 Jul 2020 04:55:00 +0000 https://explinux.online/2020/07/02/how-to-create-network-bridge-in-rhel-8-centos-8/ How to Create Network Bridge in RHEL 8 /Centos 8 Read More »

]]>

How to Create Network Bridge in RHEL 8 /Centos 8

How to Create Network Bridge in RHEL 8 / Centos 8


Network Bridge is a link layer device based on mac address that foreword traffic between networks. In Linux, software bridge uses to emulate a hardware bridge that can be used in the virtual applications with one or more virtual application virtual nic. For example, if we are installing KVM we have to create bridge for the internal network. This can not be used in the wi-fi network due to the IEEE 802.11 standard of wi-fi.

There are three methods to create a bridge in RHEL 8. 

1 – Using Command-line nmcli 
2 – Edit eth file and create bridge file using the command line 
3 – Using graphical nmtui 
In this article, we will see how to create a bridge in the existing setup which is already in use. In our setup static IP is assigned to ens192 and we have to create a bridge br0. We will use nmtui and vi editor to create bridge.

Steps To Create Network Bridge 

Step 1 – Check the existing network and mac address 

Check existing network and mac address to avoid mistakes and take backup in case we have to revert back.
# ip a 
ip a
Above pic, you can see one ethernet port ens192 with static ip. save this ip and mac address. The Mac address is not mandatory.

Step 2 – Open Network Manager TUI 

# nmtui
This command will open TUI for the network manager. Here you can edit and create new connections.
nmtui
Here go to “Edit a connection” to add or change the setting of the ethernet port.

Step 3 – Create Bridge and Assign Slave Ethernet Port 

In this step, we will create a bridge with ens192 port slave.
first, perform step 2 you will see pic below :
edit connection
Click on “Add” to add a new connection. Scroll down to Bridge and press tab to move on create.
scroll down to bridge
Press enter on create. Now you will see below options on the screen. Where you need to give a name to bridge and assign IP as per your requirement or you can leave default names.
edit profile
In the above pic, change the highlighted area and click on add to add a physical nic port that will carry bridge network.
add slave
In the above pic, you can see options. Select Ethernet and press tab to jump on create and press enter to move on the next step.
In the below pic, enter the ethernet port name and mac address. Mac address is not mandatory you can leave it also.
Change profile and mac address
Click ok to save the setting.
Now in the next step assign  Ip on the bridge. Make sure to assign the same series IP which your network provider to network team provides you to avoid any network loss. IN our case we will assign the same IP which was assigned to ens192 because it was tested and working.
For that go to IPv4 Configuration and click and select manual.
Add IP manually
Click on “Show” to assign IP 
Add IP
Enter IP in the format of 192.168.11.123/24 gateway 192.168.11.1. 
After that click ok to save the configuration.
Add IP
In the below pic you can see Bridge is created name br0 and now move to ok and press enter 
Bridge is created
Now all bridge configuration has been done use down arrow ket to move to quit and press enter to exit nmtui.
quit nmtui
Now you have created bridge with slave ens192. But now we have to tell ens192 that his master is br0.

Step 4 – Edit Ethernet File For Bridge Communication 

Now we have to edit the ethernet configuration file in my case it is ens192. In your case, it could be eth0, eth1 or ens0, etc. 
use below command to edit :
# vi /etc/sysconfig/network-scripts/ifcfg-ens192
Make the same entry as shown in below 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=ens192
UUID=ceb12aa6-afa5-4365-946b-4b573fe0c43e
DEVICE=ens192
ONBOOT=yes
MASTER=br0
Save configuration. Press esc then:wq!  press enter 
Now restart Network Manager by below command 
# systemctl status NetworkManager

Step 5 – Confirm bridge is configured correctly 

Check this via below command 
# ip a
bridge configured

Now here you can check two-point to verify the bridge is configured correctly.

  1. The IP address will show only on the bridge, not on the ens192 port.
  2. Mac Address will be the same as the bridge and our ethernet port which was the slave of the bridge.
At this point, you have successfully configured the bridge. Now you can use it in any KVM machine or application which required a bridge network.
If this article helps you share it because sharing will motivate us .
]]>
https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html/feed 0