Change IP address on every operating systems

Change IP Address of your Server

Prerequisites

To change the public IP Address of your Linux machine you need to have an additional IP Address.
If you don't have any additional IP Address you need to buy it from us. To do that is too easy, open a ticket in the support area and ask for an IP or Multiple IP, a member of our billing department will add the IP to your service, and will generate an invoice.

After that you'll be able to follow these instructions.

Before changing your IP address, make sure to have a look at your current IP address.

To find your current IP address, you can easily use the "IP" command with the "a" option for the address like that:

ip a

Or you can see it with the "ifconfig" command of the "net-tools" package:

ifconfig

Ubuntu

To change the default static IP address on Ubuntu Server, you need to edit the "netplan" default configuration file.

You have to modify the default config file of "netplan" that is located in /etc/netplan/ with your preferred editor vim/nano and much more, open that file, and you will see something like this.

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
     addresses:
       - 10.100.1.38/24
       - 10.100.1.39/24
     gateway4: 10.100.1.1

You can assign multiple IP addresses or modify the existing one already set. To do that, you need to change the IP under addresses: and put the IP address that you want to use.
After that save the configuration file and run this command: sudo netplan apply
If you are connected through SSH, you will be disconnected after run the command above and you can easily reconnect to the server with your new IP.

Debian

To change the IP on a Debian System, you need to edit the network-manager interface configuration file.

You have to modify the config file, that is located in /etc/network/interfaces with your preferred editor vim/nano and much more.

Open that file, and you will see something like this.

auto ens1
iface ens1 inet static
  address 192.168.0.2
  netmask 255.255.255.0
  gateway 192.168.0.1
  dns-nameservers 8.8.8.8 8.8.4.4
Change the IP address on address , save the file and exit from the text editor.
After that you need only to run this command: sudo systemctl restart networking
 

CentOS / RHEL

To change the IP on a CentOS/RHEL System, you need to edit the sysconfig network interface config.

First of all identify the name of the network interface that are you actually using. To do that follow steps that are written under "Prerequisites".

You have to modify the config file of your network interface, that is located in /etc/sysconfig/network-scripts/ into this directory you will find many files with different names, locate the file named like this: ifcfg-interfacename

Open that file, and you will see something like that:

DEVICE="eth0"
HWADDR="00:21:70:10:7E:CD"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=static
# BOOTPROTO=dhcp
IPADDR=10.16.1.106
NETMASK=255.255.255.0
#
# the GATEWAY is sometimes in: /etc/sysconfig/network
GATEWAY=10.16.1.1

To change the IP address change the IP after IPADDR= after that save and exit from the editor.
To apply the changes you can disable and re-enable the interface with these commands: ifdown intname;ifup intname or you can easily run this command that restarts the network: sudo systemctl restart network

 

  • IP
  • 689 Users Found This Useful
Was this answer helpful?

Related Articles

Update your system

Update your system Before start using your VPS/Dedicated Server, you need to update your system...

Change the default SSH listening port

Change the default SSH listening port One of the first things to do on your server is to...

Change root password

Change root password When a new server is deployed or is reinstalled a generated password will...

Configure Multiple Domain on your website Cpanel

Cpanel Aliases Overview Domain aliases are domains that you own, but which do not contain any...

Setup Cron Jobs on cPanel

Cron Jobs Overview Cron jobs are scheduled tasks that the system runs at predefined times or...