Linux - Setting a Static IP (Debian / Ubuntu Servers)

CyberOne Data - Linux Server(Debian / Ubuntu)
Setting up a Static IP


This howto help's guide you through setting up a static IP address on your Linux server. Keep in mind that
there can be a difference on which version of Linux you are running but in most cases this should do the trick.
In this article we'll be focusing on the below listed OS's.

- Ubunut 14.04 TLS / 16.04 TLS
- Debian
- LinuxMint 17 / 18.3
- CentOS 6 / 7

Step 1:

administrator@test:~$ ifconfig
eth0 Link encap:Ethernet HWaddr ba:c9:2d:e2:f5:d3
inet addr: Bcast: Mask:
inet6 addr: fe80::b8c9:2dff:fee2:f5d3/64 Scope:Link
RX packets:477791 errors:0 dropped:43 overruns:0 frame:0
TX packets:59312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:630047850 (630.0 MB) TX bytes:4024613 (4.0 MB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)

Step 2:

$ sudo nano /etc/network/interfaces

Step 3:
At this point you'll get an output of the below which is the area we will be configuring. 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address <-- Modify
netmask <-- Modify
network <-- Modify
broadcast <-- Modify
gateway <-- Modify
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers <-- Modify
dns-search <-- Modify

Step 4:

- ctl + c
- Y
- Hit Enter

Step 5:

$sudo reboot

* If you have any issues with this please feel free to submit a ticket in the client portal area and we'd be happy to assist.
  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

How to Mount and Unmount a Partition in Linux

Mounting and Unmounting a Linux PartitionOnce you insert new hard disks into your system, you’ll...

Linux - Setting a Static IP (Redhat / CentOS Servers)

1. Configure eth0: [root@centos63 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0...

Linux - Setting Virtual (Multiple) IP's (Redhat / CentOS Servers)

Creating Virtual Interface and Assign Multiple IP Addresses Here I have an interface called...

How to change port number on CentOS 7

$sudo vi /etc/ssh/sshd_config *Edit the port number from 22 to 64322 $semanage port -a -t...

CentOS_7 Password Recovery / Single User mode

Password Recovery / Single User Mode (CentOS_7)Steps:1.) Reboot your server2.) When it gets to...