Debian and Ubuntu pre-18.04 instructions

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 13027
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Debian and Ubuntu pre-18.04 instructions

Post by Edge100x »

To add an IP in Ubuntu or Debian,
  1. Log in to your server as the "root" user via the "VNC console" page in your control panel.
  2. Open up the "/etc/network/interfaces" file in your favorite editor -- for instance, type "nano /etc/network/interfaces" to use nano.
  3. Cursor down to the end of the file and look for the last "auto eth0" or "auto eth0:x" line, where "x" is some number. On a dedicated machine, "eth0" may be something else like "p1p1"; if so, you'll need to use that different name.
  4. If you had the ":x", pick a number one higher than the "x". If you didn't, use "0". We'll call that number "y".
  5. Add a set of lines using "y" to the end of the file in the following format:

    Code: Select all

    auto eth0:y
    iface eth0:y inet static
    address your.ip.address
    netmask your.netmask
    gateway your.gateway
    
    Replace "your.ip.address", "your.netmask", and "your.gateway" with the corresponding information for the IP that you are adding, from your control panel "IP list" page.
  6. Save the file. In the "nano" editor, you can do this by hitting Control-X, then telling it "y" to save before it closes.
  7. Enter the following command to restart your networking system:

    Code: Select all

    /etc/init.d/networking restart
User avatar
Edge100x
Founder
Founder
Posts: 13027
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Ubuntu/Debian instructions

Post by Edge100x »

If you are running Ubuntu 12.xx+, you are changing the primary IP, and you don't already have these lines, add this line, as well, below the other lines following "iface eth0 inet static":

Code: Select all

dns-nameservers 8.8.8.8
User avatar
Edge100x
Founder
Founder
Posts: 13027
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Debian and Ubuntu pre-18.04 instructions

Post by Edge100x »

Debian 12 Bookworm changed the interface name to enX0 from eth0. This means that you will need to use enX0 in place of eth0 on that OS. For instance, in step #5,

Code: Select all

auto enX0:y
iface enX0:y inet static
address your.ip.address
netmask your.netmask
gateway your.gateway
Post Reply