Atlantic.Net Blog

How to Add A Private IP to an Ubuntu Server

Alexander Wise
by Atlantic.Net (45 posts) under Dedicated Server Hosting, Tutorials
0 Comments
Verified and Tested 02/27/2021

Introduction

In this How-to, we will learn how to configure a private IP address on an Ubuntu Server.

Private networking is a great way to keep the traffic between your servers internal and not accessible publicly. It allows you to communicate between your servers without using your Cloud bandwidth as well. It is also faster than public traversal as it will not require leaving the network to reach the destination server. At this time private networking within our Cloud will only be able to communicate with same-region servers.

Prerequisites

-A server with Ubuntu. If you do not have a server already, you can spin up any of our affordable cloud hosting solutions in under 30 seconds.

Verifying your Private IP range with our Cloud Control Panel

First, we will need to find out what you are allocated for your private IP range. If you have a Cloud server with us, I will go through how to find the Private IP address range you are allocated. If you do not know your private IP range or address, please consult your network administrator.

Sign in to your Cloud Control Panel:

Signing into Cloud Control Panel

Once logged in, you will see “Private IPs” listed on the left side.

Navigating to your Private IPs

On the Private IP page, you will see the IP range allocated to your account. Under “IP” are the Private IPs available to use.

Private IP page

Once you have the private IP range to use, we will add it to our Ubuntu server.

Adding the Private IP address to your Ubuntu Server

Log in to your server and use your text editor to open /etc/netplan/01-netcfg.yaml .In this tutorial, we will be using nano.

nano /etc/netplan/01-netcfg.yaml

We will need to add the private IP address as an additional IP. You can your private IP address below the existing public IP address as shown below:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 208.117.86.35/24
        - 10.129.15.10/24
      gateway4: 208.117.86.1

      nameservers:
        addresses:
          - 209.208.127.65
          - 209.208.25.18

Save and close the file, then verify the configuration with the following command:

netplan --debug generate

If everything is fine, you should get the following output:

DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1251): DEBUG: 07:18:50.814: Processing input file /etc/netplan/01-netcfg.yaml..
** (generate:1251): DEBUG: 07:18:50.814: starting new processing pass
** (generate:1251): DEBUG: 07:18:50.814: We have some netdefs, pass them through a final round of validation
** (generate:1251): DEBUG: 07:18:50.815: eth0: setting default backend to 1
** (generate:1251): DEBUG: 07:18:50.815: Configuration is valid
** (generate:1251): DEBUG: 07:18:50.815: Generating output files..
** (generate:1251): DEBUG: 07:18:50.815: NetworkManager: definition eth0 is not for us (backend 1)
(generate:1251): GLib-DEBUG: 07:18:50.815: posix_spawn avoided (fd close requested) 

Next, restart the NetPlan to apply the changes:

netplan apply

You can now verify your new IP address using the following command:

ip addr

You should get the following output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:00:d0:75:56:23 brd ff:ff:ff:ff:ff:ff
    inet 208.117.86.35/24 brd 208.117.86.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.129.15.10/24 brd 10.129.15.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::200:d0ff:fe75:5623/64 scope link 
       valid_lft forever preferred_lft forever

You have successfully added a Private IP to your Ubuntu Server! Don’t forget to check out our many other articles and keep checking back for more.  Atlantic.Net has a selection of industry-leading cloud servers for a wide variety of business needs.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Python 3.10 on Rocky Linux 8
How to Install TaskBoard on Rocky Linux 8
How to Set Up Pritunl VPN Server on Rocky Linux 8
How to Install Teampass Password Manager on Rocky Linux 8
How to Install and Configure RabbitMQ Server on Rocky Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources