- Log in to your server as the "root" user via the "VNC console" page in your control panel.
- Open up the "/etc/network/interfaces" file in your favorite editor -- for instance, type "nano /etc/network/interfaces" to use nano.
- 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.
- 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".
- Add a set of lines using "y" to the end of the file in the following format:
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.Code: Select all
auto eth0:y iface eth0:y inet static address your.ip.address netmask your.netmask gateway your.gateway
- Save the file. In the "nano" editor, you can do this by hitting Control-X, then telling it "y" to save before it closes.
- Enter the following command to restart your networking system:
Code: Select all
/etc/init.d/networking restart
Debian and Ubuntu pre-18.04 instructions
- Edge100x
- 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
To add an IP in Ubuntu or Debian,
Re: Ubuntu/Debian instructions
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
Re: Debian and Ubuntu pre-18.04 instructions
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