Changing Hostname Temporarly
Example: hostname newhostname.comChanging Hostname Permanently
Edit the file /etc/hostname and just put the hostname in it, Remove old hostname from it, Save and exitTo 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/network/interfaces, The main ip configuration will be in the below entry.auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
Just change the address, netmask and gateway
Dont forget to restart network after the change.
service network restart
Connect again using new ip if all is well.
Adding more IPs
Edit the file /etc/network/interfaces, And add more ips just take the below example
auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:1
iface eth0:1 inet static
address 192.168.1.201
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:2
iface eth0:2 inet static
address 192.168.1.202
netmask 255.255.255.0
gateway 192.168.1.1
After saving the file make sure to bring the ips live with below command.
ifup eth0:1
ifup eth0:2
Creating rc.local file
Debian by default do not have a rc.local file, If you need one then create it as below.
cd /etc/init.d
>rc.local
echo "#! /bin/sh" > /etc/init.d/rc.local
echo "/sbin/modprobe 3c59x" >> /etc/init.d/rc.local
echo "/sbin/modprobe tulip" >> /etc/init.d/rc.local
echo "/sbin/modprobe 8139too" >> /etc/init.d/rc.local
echo "/sbin/modprobe b44" >> /etc/init.d/rc.local
chmod 755 rc.local
update-rc.d rc.local defaults 80