SUSE

by admin on August 13, 2009 · 0 comments

Changing Hostname Temporarly

Example: hostname newhostname.com

Changing Hostname Permanently

Edit the file /etc/HOSTNAME and change the value 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/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
/sbin/rcnetwork 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/ifcfg-eth0 /etc/sysconfig/network/ifcfg-eth0:1

#Now edit the new file /etc/sysconfig/network/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.
/sbin/rcnetwork restart

Previous post:

Next post: