Skip to main content
static IP address

How to Set Static IP Address on Linux

As Linux system administrator, you will need to configure IP address on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to setup a static IP address.

Configure Static IP Address in RHEL/CentOS/Fedora

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

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

ifcfg-eth0 is for first LAN interface eth0. If you wish to set up eth1 interface, you need to edit ifcfg-eth1 file.

Let’s start from first file.

Open the file and change IP address

Edit next file

Note: Edit a file that is attached to your LAN interface. Names of network interfaces, you can find using the command ifconfig -a

Make following changes in the file:

Other settings should have already been configured.

Next, edit resolve.conf file to set DNS servers.

After editin, zou need to restart network service:

Set Static IP Address on Debian / Ubuntu

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

You may see a content similar to this one

Change it so it looks like this:

Save changes and then edit the file /etc/resolv.conf

Restart the networking on your system:

Static IP address is now configured.

SkyHosting

Best Hosting Services: .rs domain registration, Web Hosting, VPS Servers, SSL Certificates. Visit us SkyHosting.

Leave a Reply

Your email address will not be published. Required fields are marked *