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

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

Introduction:

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:192.168.1.75 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::b8c9:2dff:fee2:f5d3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
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 192.168.1.75 <-- Modify
netmask 255.255.255.0 <-- Modify
network 192.168.1.0 <-- Modify
broadcast 192.168.1.255 <-- Modify
gateway 192.168.1.1 <-- Modify
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.1 8.8.8.8 <-- Modify
dns-search example.com <-- 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 Користувачі, які знайшли це корисним
Ця відповідь Вам допомогла?

Схожі статті

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...

Powered by WHMCompleteSolution