#!/bin/bash
read -p "Enter the new IP address i.e: 10.50.4.243/20 : " ip_address
read -p "Enter the new gateway i.e:- 10.50.0.1 : " gateway
read -p "Enter the new hostname i.e: co7-50-4-243 : " hostname
# Get the interface name
interface=$(ip route | awk '/default/ { print $5 }')
# Get the ip address
ipa=$(hostname -I | awk '{ print $1 }')
# Update the IP address and gateway
echo "Updating IP address and gateway..."
nmcli con mod "$interface" ipv4.address "$ip_address"
nmcli con mod "$interface" ipv4.gateway "$gateway"
# Update the hostname
echo "Updating hostname..."
hostnamectl set-hostname "$hostname"
# Update the /etc/hosts file
echo "Updating /etc/hosts file..."
echo "$ipa $hostname" >> /etc/hosts
# Restart the network service
echo "Restarting network service..."
systemctl restart NetworkManager
echo "IP address, gateway, hostname, and /etc/hosts file updated successfully."
System Securities with Linux and Virtualization.!!
Monday, July 24, 2023
How to Update CentOS IP and Hostname via Bash Script
Friday, April 15, 2022
Configure bonding/teaming on Redhat Linux
NIC Details:
[root@mylinz2 network-scripts]# ifconfig -a |grep eth
eth2 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
eth4 Link encap:Ethernet HWaddr 00:0C:29:79:17:04
eth3 Link encap:Ethernet HWaddr 00:0C:29:79:17:F0
[root@mylinz2 network-scripts]#
Goal:
Configure bonding between eth2 and eth4 with name of bond0.
Step 1:
Add the below line in /etc/modprobe.conf to load the bonding module in to kernel.
# alias bond0 bonding
In redhat 6.3 , you need to create new file called “bonding.conf” under /etc/modprobe.d/ with below mentioned line.
# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
Step 2:
Now time to create a bonding interface configuration file in /etc/sysconfig/network-scripts/ directory like the below one.
[root@mylinz2 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@mylinz2 network-scripts]# cat ifcfg-bond0
#This is congiguration file for bond0.Used NIC's eth2 & eth4
DEVICE=bond0
IPADDR=192.168.10.25
NETMASK=255.255.255.0
USRCTL=no
ONBOOT=yes
BOOTPRO=none
BONDING_OPTS="mode=0 miimon=100"
[root@mylinz2 network-scripts]#
Step:3
Create a configuration files under “/etc/sysconfig/network-scripts/” for network interfaces if not exists.If exists,have a contents like the below one.
[root@mylinz2 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
HWADDR=00:0C:29:79:17:FA
BOOTPRO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@mylinz2 network-scripts]# cat ifcfg-eth4
DEVICE=eth4
HWADDR=00:0C:29:79:17:04
BOOTPRO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
Note:Do not copy paste the content from above output.MAC and DEVICE name will differ for each system.
Step:4
Now i have connected LAN cable back to eth4 and pulling out from eth2.
To see complete bonding info,use below command.
POLICY DETAILS
|
---|
How to configure SSL in vCenter 6.7
First take vCenter VM snapshot for backup purpose.
Take note of host where the vCenter VM resides while starting the activity.
Take Access of vCenter Shell to create a certificate CSR request.
root@prod-vcsa71 [ ~ ]# /usr/lib/vmware-vmca/bin/certificate-manager
Now copy the CSR file content in notepad file and save as .txt or .csr
Once have the CSR, generate a certificate by using this CSR.
Now copy the certificate file to the vcenter along with the RootCA certificate.
Start process for Import the certificate.
root@prod-vcsa71 [ ~ ]# /usr/lib/vmware-vmca/bin/certificate-manager
Provide certificate file location as per below the snip, Once all details provided it will take around 20-30 mins depending on the vCenter performance.
Once all required services started properly it will give the status as mentioned below.
Now try to access the vCenter from WebGUI, It is now secure.
Also try to access the vCenter Appliance Management Interface, It will still show the certificate error, to resolve this, restart the vami https service as mentioned below.
root@prod-vcsa71 [ /opt ]# /sbin/service vami-lighttpd restart
Now again try to access the vCenter Appliance Management Interface, It will also start with SSL certificate.
To check service status:
root@prodvcenter [ ~ ]# service-control --status --all
To check logs if anything fails.
root@prodvcenter [ ~ ]# tail -f /var/log/vmware/vmcad/certificate-manager.log
If Certificate import files due to content-library service fails to start, increase Start time in below mentioned file from 300 to 600sec.
root@prodvcenter [ ~ ]# vi /etc/vmware/vmware-vmon/svcCfgfiles/vdcs.json
Tuesday, March 3, 2020
Tuesday, December 3, 2019
How to Install or upgrade the VMWare Tools
# mount /dev/cdrom /mnt/
5. Temporary copy the VMWareTools upgrade tar to local machine.
# mkdir /tmp/vmware
# cp VMwareTools-10.3.5-10430147.tar.gz /tmp/vmware/
# cd /tmp/vmware/
# tar xzvf VMwareTools-10.3.5-10430147.tar.gz
# cd vmware-tools-distrib/
# ./vmware-install.pl
Once installed the tools successfully it will prompt the status of installed tool and its service status.
6. Check the service status by below command.
# /etc/vmware-tools/services.sh “status/start/stop”