technical skills grow

Responsive Ads Here

Saturday, July 24, 2021

How to configure bridging or teaming or bonding | TCP and UDP protocol | resolve.conf | /etc/hosts |nmap |run levels of linux

From RHEL - 6 - What is bonding and how to configure bonding?

From RHEL - 7 :- What is link aggregation or bridging or teaming and how to configure teaming? 


Bonding or Teaming or Bridging:
Collection of multiple NIC cards and make them as single connection (virtual) NIC card is called bonding.
It is nothing but backup of NIC cards.
In RHEL - 6 it is called as Bonding or Bridging.

In RHEL - 7 it is called as Teaming or Link aggregation.
There are 3 types of backup in Bonding or Teaming.
(a) Mode 0 -----> Round Robbin
(b) Mode 1 -----> Activebackup
(c) Mode 3 -----> Broadcasting
Mode 0 : It provides load balancing and fault tolerance.
Data will be shared by both NIC cards in round robbin.
If one NIC card failed then another NIC card will be activated to communicate with the server
So, there is a load balancing and fault tolerance features.
Mode 1 : Active backup means only one NIC card is activated at a time and another one is in down state.
So, there is no load balancing.
But if one NIC card is failed then another NIC card will be activated automatically.
Mode 3 : In this mode broadcasting is done.
In this the same data will be transferred through two NIC cards.
So there is no load balancing. But if one NIC card is failed then second NIC card will be activated automatically. So, all the 3 modes are supports only fault tolerance, but round robbin is the only one mode that provides load balancing.
Requirements to configure :
(i)Minimum two NIC cards.
(ii)One IP address.
(iii)Connection type is bond (in RHEL - 6) and team (in RHEL - 7) not the ethernet type. Here no need to assign the IP addresses for two NIC cards and we are giving only one IP address to bond or team.
 

Bonding configuration : (in RHEL - 6)
(i) # vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IP ADDR=<IP address>
TYPE=ethernet
NETMASK=255.225.225.0 or <IP address class netmask>
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=yes
BONDING_OPTS="mode0 or mode1 or mode3 miimon=50"  

(Save and exit this file)
(ii) vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
(Save and exit this file)
(iii) vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
(Save and exit this file)
(iv) To add virtual NIC cards eth1 and eth2 :
# setup -----> Networking -----> Device configuration -----> New Device -----> eth1
Name : eth1
Device : eth1
(save and exit this setup)
# setup -----> Networking -----> Device configuration -----> New Device -----> eth2

(v) Name : eth2
     Device : eth2      (save and exit this setup)
Adding bond0 connection :
# setup -----> Networking -----> Device configuration -----> New Device -----> bond0
Name : bond0
Device : bond0
IP address : <IP address>
Netmask : 255.255.255.0
Default gateway : <gateway IP address>
(save and exit this setup)
# ifdown bond0
# ifdown eth1
# ifdown eth2
# ifup bond0
# service NetworkManager stop
# service network restart
# chkconfig network on
# service NetworkManager restart
# cat /proc/net/bonding/bond0   (to check the bonding  information)
# watch -n 1 cat /proc/net/bonding/bond0  (to check the bonding information for  every 1 minute)
# echo "eth1" > /sys/devices/virtual/net/bond0/bonding/active_slave (to put the eth1 NIC in active state)
Teaming configuration :
(i) Add the team0 connection by
# nmcli connection add con-name team0 ifname team0 type team
config ' { "runner" : { "name" : "roundrobbin" or "activebackup" or
"broadcasting" }} '
(ii)Add the two NIC cards one by one to the above created connection by
# nmcli connection add con-name port1 ifname eth1 type team-slave master team0
# nmcli connection add con-name port2 ifname eth2 type team-slave master team0
(iii) Assign the static IP address to the team0 connection by
#nmcli connection modify team0 ipv4.addresses <IP address>/<netmask> ipv4.method
static
(iv) Up the connection by
# nmcli connection up team0
(v) To see the team0 connection up details by
# teamdctl team0 state
(vi) To check the connection communication by
# ping -I team0 <IP address>
(vii) To down the one NIC card in team0 by
# nmcli connection down port1
(viii) teamdctl team0 state (to check the team0 NIC card up or down details)

Q2:-What is the difference between TCP and UDP protocol?

TCP is a connection oriented protocol and contain the information of sender as well as receiver.

Example : HTTP, FTP, Telnet

TCP is slower than UDP due to its error checking mechanism

UDP protocols are connection less packets have no information to where they are going. These type of ports are generally used for broadcasting.

For example : DNS, DHCP UDP are faster

Q3:-.What are the benefits of NIC Teaming?
(i)  Load balancing
(ii) Fault Tolerance
(iii) Failover

Q4:-Mention all the network configuration files you would check to configure your ethernet card?

(i)   /etc/sysconfig/network-scripts/ifcfg-eth*
(ii) /etc/sysconfig/network
(iii) /etc/resolve.conf
(iv) /etc/nsswitch.conf


4.What is the use of /etc/resolve.conf?

It contains the details of nameserver, i.e., details of your DNS server which helps us connect to Internet.

5. What is the use of /etc/hosts file?

To map any hostname to its relevant IP address.

6.What is the command to check all the open ports of your machine?

#nmap localhost

7. What is the command to check all the open ports of remote machine?

# nmap <IP address or hostname of the remote system>

8.What is the command to check all the listening ports and services of your machine?

# netstat -ntulp

9.How can you make a service run automatically after boot?

# chkconfig <service name> on

10.What are the 6 run levels of linux? And how can you configure your script to run only when the system boots into GUI and not to any other runlevel?
0 Power off
1 Single user
2 Multi user without network
3 Multiuser with network
4 Development purpose
5 GUI
6 Restart
# chkconfig --level 5 service_name on
# chkconfig --level 1234 service_name off


No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts