#!/bin/sh
time_stamp=$(date +%d_%m_%Y-%H_%M_%S)
clear
echo "-----------------------------------------------"
echo " Redhat Linux Server Network Configuration "
echo "-----------------------------------------------"
read -p "Server Name (with fqdn!!!): " fqdn_name
read -p "Server IP address: " ip_address
read -p "Netmask: " net_mask
read -p "Gateway address: " gate_way
host_name=${fqdn_name%%.*}
mv /etc/sysconfig/network /etc/sysconfig/network.$time_stamp
echo "NETWORKING=yes" >> /etc/sysconfig/network
echo "HOSTNAME="$fqdn_name >> /etc/sysconfig/network
echo "GATEWAY="$gate_way >> /etc/sysconfig/network
>| /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DEVICE=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "BOOTPROTO=static" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "MTU=1500" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NM_CONTROLLED=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "TYPE=Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR="$ip_address >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK="$net_mask >> /etc/sysconfig/network-scripts/ifcfg-eth0
mv /etc/hosts /etc/hosts.$time_stamp
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" >> /etc/hosts
echo $ip_address" "$host_name" "$fqdn_name >> /etc/hosts
read -p "In order to take effect wtih these changes, the server should be restarted. Do you want to restart now? (y/n): " yes_or_no
if [ "$yes_or_no" == "y" ]; then
reboot
fi
time_stamp=$(date +%d_%m_%Y-%H_%M_%S)
clear
echo "-----------------------------------------------"
echo " Redhat Linux Server Network Configuration "
echo "-----------------------------------------------"
read -p "Server Name (with fqdn!!!): " fqdn_name
read -p "Server IP address: " ip_address
read -p "Netmask: " net_mask
read -p "Gateway address: " gate_way
host_name=${fqdn_name%%.*}
mv /etc/sysconfig/network /etc/sysconfig/network.$time_stamp
echo "NETWORKING=yes" >> /etc/sysconfig/network
echo "HOSTNAME="$fqdn_name >> /etc/sysconfig/network
echo "GATEWAY="$gate_way >> /etc/sysconfig/network
>| /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DEVICE=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "BOOTPROTO=static" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "MTU=1500" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NM_CONTROLLED=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "TYPE=Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR="$ip_address >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK="$net_mask >> /etc/sysconfig/network-scripts/ifcfg-eth0
mv /etc/hosts /etc/hosts.$time_stamp
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" >> /etc/hosts
echo $ip_address" "$host_name" "$fqdn_name >> /etc/hosts
read -p "In order to take effect wtih these changes, the server should be restarted. Do you want to restart now? (y/n): " yes_or_no
if [ "$yes_or_no" == "y" ]; then
reboot
fi
Comments
Post a Comment