IP address: 15.84.25.84          Netmask: 255.255.255.0         Hostname: server.rootadminz.com               Domain name: rootadminz.com               Gateway: 15.84.25.83          DNS Server 1: 8.8.8.8                  DNS Server 2: 4.4.4.4

 

To configure static IP address in RHEL / CentOS / Fedora, you will need to edit:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0

 

Where in the above "ifcfg-eth0" answers to your network interface eth0. If your interface is named “eth1" then the file that you will need to edit is "ifcfg-eth1".

 

Let’s start with the first file:

# vi /etc/sysconfig/network

 

Open that file and set:

NETWORKING=yes
HOSTNAME=server.rootadminz.com
GATEWAY=15.84.25.83
NETWORKING_IPV6=no
IPV6INIT=no

 

Next open:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

 

Note: Make sure to open the file corresponding to your network interface. You can find your network interface name with ifconfig -a command.

 

In that file make the following changes:

DEVICE="eth0"
BOOTPROTO="static"
DNS1="8.8.8.8"
DNS2="4.4.4.4"
GATEWAY="15.84.25.83"
HOSTNAME="server.rootadminz.com"
HWADDR="00:19:99:A4:46:AB"
IPADDR="192.68.0.100"
NETMASK="255.255.255.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="8105c095-799b-4f5a-a445-c6d7c3681f07"

 

You will only need to edit the settings for:

DNS1 and DNS2
GATEWAY
HOSTNAME
NETMASK
IPADDR

 

Other settings should have already been predefined.

 

Next edit resolve.conf file by opening it with a text editor such as nano or vi:

# vi /etc/resolv.conf

  

nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 4.4.4.4 # Replace with your nameserver ip

 

Once you have made your changes restart the networking with:

# /etc/init.d/network restart  [On SysVinit]
# systemctl restart network    [On SystemD]

 

Set Static IP Address in Debian / Ubuntu

 

To setup static IP address in Debian/ Ubuntu, open the following file:

# nano /etc/network/interfaces

 

You may see a line looking like this:

auto eth0
iface eth0 inet dhcp

 

Change it so it looks like this:

auto eth0
iface eth0 inet static 
address 15.84.25.84
netmask 255.255.255.0
gateway 15.84.25.83
dns-nameservers 4.4.4.4
dns-nameservers 8.8.8.8

 

Save the file and then edit /etc/resolv.conf like this:

# nano /etc/resolv.conf

 

nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 4.4.4.4 # Replace with your nameserver ip

 

Restart the networking on your system with:

# /etc/init.d/network restart  [On SysVinit]
# systemctl restart network    [On SystemD]

 

Your static IP address has been configured.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket