How to setup your Static IP
How to setup your Static IP's in various Linux Distros. You can get all of your IP address information from the IP Adresses tab on the QCP.
If you have a VZ account, simply reboot from the QCP.
OpenVZ will handle all of the IP address configuration.
If you have a XEN account, you will still need to reboot from the QCP.
But you will also need to update all of the IP address configuration files.
You can find out what Distribution you have installed, as well as your IP address, Netmask, Network, Broadcast, and Gateway by logging into the QCP.
Contents
Redhat based (CentOS, Fedora)
Debian based (Debian 3.0,4.0, Ubuntu)
Slackware based
Gentoo based
Redhat based (CentOS, Fedora)
Using a text editor change your '''eth0''' file to reflect your new IP address information.
I have made the lines that need to be changed '''Bold'''.
DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=76.191.252.242 NETMASK=255.255.255.0 NETWORK=76.191.252.0 BROADCAST=76.191.252.255
Now do a service network restart and ping your new IP.
[root@vps network-scripts]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: [ OK ] [root@vps network-scripts]# ping 76.191.252.242 PING 76.191.252.242 (76.191.252.242) 56(84) bytes of data. 64 bytes from 76.191.252.242: icmp_seq=1 ttl=64 time=0.106 ms 64 bytes from 76.191.252.242: icmp_seq=2 ttl=64 time=0.076 ms 64 bytes from 76.191.252.242: icmp_seq=3 ttl=64 time=0.154 ms 64 bytes from 76.191.252.242: icmp_seq=4 ttl=64 time=0.078 ms 64 bytes from 76.191.252.242: icmp_seq=5 ttl=64 time=0.079 ms 64 bytes from 76.191.252.242: icmp_seq=6 ttl=64 time=0.078 ms
Debian based (Ubuntu)
Move to the directory where your '''interfaces''' file is located:
root@vps:/# cd /etc/network
CAT your '''interfaces''' file and you will see something like this:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
auto eth0
iface eth0 inet static
address 69.12.216.41
netmask 255.255.255.0
network 69.12.216.0
broadcast 69.12.216.255
gateway 69.12.216.1
Now using a text editor change your '''interfaces''' file to look like this:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
auto eth0
auto eth0:1
iface eth0 inet static
address 76.191.252.242
netmask 255.255.255.0
network 76.191.252.0
broadcast 76.191.252.255
gateway 76.191.252.1
iface eth0:1 inet static
address 69.12.216.41
netmask 255.255.255.0
network 69.12.216.0
broadcast 69.12.216.255
gateway 69.12.216.1
I have put the lines that need to be changed in '''Bold''' type. Make sure you input the new IP address and Gateway on the address and gateway lines. Now restart your networking by typing in the following.
root@vps:/etc/network# /etc/init.d/networking restart
A quick ping check and you should be up and running.
[root@www network-scripts]# ping 76.191.252.242 PING 76.191.252.242 (76.191.252.242) 56(84) bytes of data. 64 bytes from 76.191.252.242: icmp_seq=0 ttl=64 time=11.7 ms 64 bytes from 76.191.252.242: icmp_seq=1 ttl=64 time=1.54 ms 64 bytes from 76.191.252.242: icmp_seq=2 ttl=64 time=0.716 ms 64 bytes from 76.191.252.242: icmp_seq=3 ttl=64 time=0.640 ms 64 bytes from 76.191.252.242: icmp_seq=4 ttl=64 time=0.560 ms --- 76.191.252.242 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms
Slackware based
First move to the directory that has your '''rc.inet1.conf''' file in it.
root@vps:/# cd /etc/rc.d
If you CAT your '''rc.inet1.conf''' you will see something like this:
root@vps:/etc/rc.d# cat rc.inet1.conf
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").
# Config information for eth0:
IPADDR[0]="69.12.216.41"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
Using a text editor make '''rc.inet1.conf''' look like this:
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").
# Config information for eth0:
IPADDR[0]="76.191.252.242"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
# Config information for eth0:1
IFNAME[1]="eth0:1"
IPADDR[1]="69.12.216.41"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
# Config information for eth1:
#IPADDR[1]=""
#NETMASK[1]=""
#USE_DHCP[1]=""
#DHCP_HOSTNAME[1]=""
I made the lines that need to be changed '''Bold'''. Make sure you comment out the lines on the '''# Config information for eth1:''' line
or you will get an error.
Now restart your networking and do a ping check.
root@vps:/etc/rc.d# /etc/rc.d/rc.inet1 restart
[root@www network-scripts]# ping 76.191.252.242
PING 76.191.252.242 (76.191.252.242) 56(84) bytes of data.
64 bytes from 76.191.252.242: icmp_seq=0 ttl=64 time=11.7 ms
64 bytes from 76.191.252.242: icmp_seq=1 ttl=64 time=0.753 ms
64 bytes from 76.191.252.242: icmp_seq=2 ttl=64 time=1.17 ms
64 bytes from 76.191.252.242: icmp_seq=3 ttl=64 time=0.848 ms
64 bytes from 76.191.252.242: icmp_seq=4 ttl=64 time=0.770 ms
--- 76.191.252.242 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
Gentoo based
Fist move to the directory where your '''net''' file is.
localhost / # cd /etc/conf.d
CAT your '''net''' file and you will see something like this:
# /etc/conf.d/net: # Global config file for net.* rc-scripts iface_eth0="69.12.216.41 broadcast 69.12.216.255 netmask 255.255.255.0" gateway="eth0/69.12.216.1"
Now you will need to add the following lines that are in '''Bold'''. You can get your IP address, broadcast, and netmask from the IP addressess tab on the QCP.
# /etc/conf.d/net:
# Global config file for net.* rc-scripts
iface_eth0="76.191.252.242 broadcast 76.191.252.255 netmask 255.255.255.0"
gateway="eth0/76.191.252.1"
alias_eth0=("69.12.216.41")
broadcast_eth0=("69.12.216.255")
netmask_eth0=("255.255.255.0")
Restart your eth0 and do a ping check.
/etc/init.d/net.eth0 restart
localhost conf.d # ping 76.191.252.242
PING 76.191.252.242 (76.191.252.242) 56(84) bytes of data.
64 bytes from 76.191.252.242: icmp_seq=1 ttl=64 time=0.077 ms
64 bytes from 76.191.252.242: icmp_seq=2 ttl=64 time=0.154 ms
64 bytes from 76.191.252.242: icmp_seq=3 ttl=64 time=0.088 ms
64 bytes from 76.191.252.242: icmp_seq=4 ttl=64 time=0.078 ms
--- 76.191.252.242 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms

