How do I move an IP Address around between different Linodes?

Linode Staff

I am testing different Linodes and would like to use the same URL with each one while I am working with it. I would like to avoid updating my DNS and having to wait for the changes to propagate.

3 Replies

If you have two Linodes in the same data center, you can use the IP transfer/swap feature to switch their IP addresses. Here are the instructions to do this:

  1. Login to the Linode Cloud Manager. https://cloud.linode.com
  2. Click on "Linodes" in the bar on the left.
  3. Select the Linode which has the IP address set up with DNS records.
  4. In the upper-right corner of the page, you will see a pull down menu that shows the state of your Linode. If it is running, select Power Off and make a note of its name.
  5. Go back to the Linodes page.
  6. Select the Linode which you would like to get the IP which is already set up for DNS.
  7. Click on the "Networking" tab and scroll to the bottom.
  8. Click on "IP Transfer".
  9. Select the IP Address (if there is more than one address assigned to this Linode)
  10. Under Actions, select "Swap With"
  11. A pulldown will appear that will let you select the Linode that has the IP address you want.
  12. Select the IP address from those addresses that Linode has.
  13. Click "Save"
  14. You can now boot your Linode and work with it.

Is it possible to do this via API? Digging through the docs, it doesn't seem like it.

This is part of the "Assign IPs to Linodes" section of https://developers.linode.com/api/v4/ which mentions:

This allows swapping, shuffling, or otherwise reorganizing IPv4 Addresses to your Linodes. When the assignment is finished, all Linodes must end up with at least one public IPv4 and no more than one private IPv4.

For example, if you have two Linodes with the following IP addresses assigned to them:

address: 1.2.3.4
linode_id: 12345

address: 5.6.7.8
linode_id: 67890

You could swap them via the API with this:

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -X POST -d '{
      "region": "us-east",
      "assignments": [
        {
          "address": "1.2.3.4",
          "linode_id": 67890
        },
        {
          "address": "5.6.7.8",
          "linode_id": 12345
        }
      ]
    }' \
    https://api.linode.com/v4/networking/ipv4/assign

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct