Home    Scripts    Utilities     Products     Awards     Contact Me

RedHat

Changing Hostname Temporarly

Example: hostname newhostname.com

Changing Hostname Permanently

Edit the file /etc/sysconfig/network and change the value of HOSTNAME in it, Save and exit
To avoid dns errors edit the file /etc/hosts and create a line as below
192.168.1.50 newhostname alias
Change ip with your server ip and newhostname and alias with anything you have setup

Changing/Setting main ip

Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 and change the value of IPADDR, NETMASK , NETWORK and BROADCAST
Example ifcfg-eth0 file:
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
IPADDR=192.168.1.50
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
USERCTL=no
PEERDNS=no
TYPE=Ethernet
Description: Dont forget to restart network after the change with below command
service network restart
Connect again using new ip if all is well.

Adding more IPs

# Copy the config file to create an alias ip
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
#Now edit the new file /etc/sysconfig/network-scripts/ifcfg-eth0:1 and change "DEVICE=eth0" to "DEVICE=eth0:1" and change ip to the new ip you want to assign. Save and exit. Then use tbe below command to bring it live.
ifup eth0:1


Adding a range of IPs

# Remove ifcfg-eth files from /etc/sysconfig/network-scripts/
#Create a file /etc/sysconfig/network-scripts/ifcfg-eth0-range0 if this doesn’t exist, or just add to it if you already have it, the following lines:
IPADDR_START=192.168.0.100
IPADDR_END=192.168.0.200
CLONENUM_START=0
where: IPADDR_START is the first IP and IPADDR_END is the last IP in the range. CLONENUM_START is the number that will be assigned to the first IP alias interface (eth0:0 in this example).

If you need to add more ranges of IPs then just use a different file for ex. ifcfg-eth0-range1, for each one of the ranges. You need to be careful and use the proper CLONENUM_START to not overwrite other aliases. Once you have configured the range/s of IPs you just need to restart the network service in order to activate it:
service network restart
SourceForge.net Logo






All trade marks are property of respective owners
All rights reserved 2003-2009, Openpages.info, Multan, Pakistan
ExecutiveIM.com and OpenPages.Info are projects of Open Pages Research and Development.
          Contact Me