IP Setting on CentOS6 using Shell Script Rumi, December 6, 2015 #!/bin/bash if [ $# -eq 5 ] then echo "" echo "Taking the backup and Changing the hostname from $(hostname) to $1 ..." sed -i.bk "s/$(hostname)/$1/g" /etc/sysconfig/network echo "" echo "Backing up & Assigning the Static IP ..." echo "" cp /etc/sysconfig/network-scripts/ifcfg-$2 /etc/sysconfig/network-scripts/$2.bk cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$2 DEVICE=$2 BOOTPROTO=static IPADDR=$3.$4 NETMASK=255.255.255.0 GATEWAY=$3.$5 ONBOOT=yes EOF echo "Changing the dns ..." echo "" sed -i.bk "s/nameserver.*/nameserver $3.$5/" /etc/resolv.conf echo "Adding $1 as hostname to the /etc/hosts file .." echo "" sed -i.bk "/$(hostname)$/d" /etc/hosts echo "$3.$4 $1" >> /etc/hosts echo "Restarting the Network Service, Please connect it using the new IP Address if you are using ssh ..." service network restart else echo "Usage: ip.sh <hostname> <interface> <baseip> <ipaddress> <gateway/dns>" echo "Example: ip.sh testname eth0 10.10.10 41 1" fi Related Administrations Configurations (Linux) Scripts BashCentOS
How to MERGE or JOIN multiple videos without re-encoding | With FREE tool June 15, 2023 I must vouch this tool- it’s pretty cool and free/open source. It saved my work a lot! Related Read More
Set up your site-to-site VPN with Access Server using OpenVPN July 9, 2023 Allow access to private subnets Sign in to the Admin Web UI for your Access Server. Click Configuration > VPN Settings. Under Routing, and Should VPN clients have access to private subnets (non-public networks on the server side)?, click Yes, using Routing. Click Specify the private subnets to which all… Read More
Proxmox VM auto start VM after found in shutdown state July 30, 2021July 30, 2021 I was having this strange issue, where a running busy VM stopeed all of a sudden due to high CPU or Memory overload issue. So manually had to start everythime. In order to avoid this, created a small script to start the VM in case if it’s down. #!/bin/bash #… Read More