Adding an IP address: Difference between revisions
(Created page with "If you've been assigned one or more additional IP addresses, here is how to add them. == Ubuntu 14.04 LTS == First open your interfaces file for editing: <code>sudo nano /etc/...") |
|||
| (9 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
If you've been assigned one or more additional IP addresses, here is how to add them. | If you've been assigned one or more additional IP addresses, here is how to add them. | ||
== Ubuntu | ==Immediate configuration== | ||
You can use the '''ip''' command to make an additional IP address work immediately: | |||
<syntaxhighlight> | |||
# ip address add 85.119.82.35/32 dev eth0 | |||
</syntaxhighlight> | |||
This address should now respond to ping and be completely usable (unless you have firewalling preventing that). | |||
This configuration won't last past the next reboot however, so you now need to configure the change permanently. | |||
==Permanent configuration== | |||
=== Debian / Ubuntu === | |||
First open your interfaces file for editing: | First open your interfaces file for editing: | ||
< | <syntaxhighlight> | ||
# nano /etc/network/interfaces | |||
</syntaxhighlight> | |||
You should see your main IP address described for IPv4 and IPv6. The IPv4 part looks something like: | You should see your main IP address described for IPv4 and IPv6. The IPv4 part looks something like: | ||
< | <syntaxhighlight> | ||
# The primary network interface | # The primary network interface | ||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
address 85.119. | address 85.119.82.34 | ||
netmask 255.255.248.0 | netmask 255.255.248.0 | ||
gateway 85.119.80.1 | gateway 85.119.80.1 | ||
</ | </syntaxhighlight> | ||
Go to the end of the file and add information about your new IP. It doesn't need a gateway and you can use 255.255.255.255 for netmask: | Go to the end of the file and add information about your new IP. It doesn't need a gateway and you can use 255.255.255.255 for netmask: | ||
< | <syntaxhighlight> | ||
# The secondary network interface | |||
# The secondary network interface | auto eth0:0 | ||
auto eth0:0 | iface eth0:0 inet static | ||
iface eth0:0 inet static | address 85.119.82.35 | ||
address 85.119. | |||
netmask 255.255.255.255 | netmask 255.255.255.255 | ||
</ | </syntaxhighlight> | ||
For each additional IP, use eth0:1, eth0:2 etc. | For each additional IP, use eth0:1, eth0:2 etc. | ||
Once you're finished, press Ctrl-X and save your file. | Once you're finished, press Ctrl-X and save your file. | ||
=== Shutdown and boot === | |||
If you want to test your permanent configuration then you'll need to shut down and boot your VPS again to ensure it comes up properly. | |||
Due to a curiosity of the way Xen creates virtual machines, the next time you want to restart your VPS you should do a shut down and then a boot, rather than a reboot. If you reboot then Xen will only route IP addresses to you that you had last time it was booted, i.e. not any that you've had added since. If you forget and reboot anyway then you can restore the additional IP address's route by shutting down and booting again as described. | |||
< | <syntaxhighlight> | ||
# shutdown now | |||
</ | </syntaxhighlight> | ||
You will then need to | You will then need to boot your machine by logging in via the [[Xen Shell]] console. Get your details from the BitFolk [[Panel]]: | ||
< | <syntaxhighlight> | ||
ssh you@you.vps.bitfolk.com | $ ssh you@you.vps.bitfolk.com | ||
</ | </syntaxhighlight> | ||
Once logged in you will see the Xen command line prompt. Try | Once logged in you will see the Xen command line prompt. Try | ||
< | <syntaxhighlight> | ||
boot | Xen shell> boot | ||
</ | </syntaxhighlight> | ||
If it complains that an instance already exists, and you've waited sufficiently long that the machine should have shut down, do | If it complains that an instance already exists, and you've waited sufficiently long that the machine should have shut down, do | ||
< | <syntaxhighlight> | ||
destroy | Xen shell> destroy | ||
</ | </syntaxhighlight> | ||
then | then | ||
< | <syntaxhighlight> | ||
boot | Xen shell> boot | ||
</ | </syntaxhighlight> | ||
You can now log back in to your VPS and your new IPs should work. | You can now log back in to your VPS and your new IPs should work. | ||
Latest revision as of 15:02, 10 December 2015
If you've been assigned one or more additional IP addresses, here is how to add them.
Immediate configuration
You can use the ip command to make an additional IP address work immediately:
# ip address add 85.119.82.35/32 dev eth0This address should now respond to ping and be completely usable (unless you have firewalling preventing that).
This configuration won't last past the next reboot however, so you now need to configure the change permanently.
Permanent configuration
Debian / Ubuntu
First open your interfaces file for editing:
# nano /etc/network/interfacesYou should see your main IP address described for IPv4 and IPv6. The IPv4 part looks something like:
# The primary network interface
auto eth0
iface eth0 inet static
address 85.119.82.34
netmask 255.255.248.0
gateway 85.119.80.1Go to the end of the file and add information about your new IP. It doesn't need a gateway and you can use 255.255.255.255 for netmask:
# The secondary network interface
auto eth0:0
iface eth0:0 inet static
address 85.119.82.35
netmask 255.255.255.255For each additional IP, use eth0:1, eth0:2 etc.
Once you're finished, press Ctrl-X and save your file.
Shutdown and boot
If you want to test your permanent configuration then you'll need to shut down and boot your VPS again to ensure it comes up properly.
Due to a curiosity of the way Xen creates virtual machines, the next time you want to restart your VPS you should do a shut down and then a boot, rather than a reboot. If you reboot then Xen will only route IP addresses to you that you had last time it was booted, i.e. not any that you've had added since. If you forget and reboot anyway then you can restore the additional IP address's route by shutting down and booting again as described.
# shutdown nowYou will then need to boot your machine by logging in via the Xen Shell console. Get your details from the BitFolk Panel:
$ ssh you@you.vps.bitfolk.comOnce logged in you will see the Xen command line prompt. Try
Xen shell> bootIf it complains that an instance already exists, and you've waited sufficiently long that the machine should have shut down, do
Xen shell> destroythen
Xen shell> bootYou can now log back in to your VPS and your new IPs should work.