How do I move an IP Address around between different Linodes?
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:
- Login to the Linode Cloud Manager. https://cloud.linode.com
- Click on "Linodes" in the bar on the left.
- Select the Linode which has the IP address set up with DNS records.
- 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.
- Go back to the Linodes page.
- Select the Linode which you would like to get the IP which is already set up for DNS.
- Click on the "Networking" tab and scroll to the bottom.
- Click on "IP Transfer".
- Select the IP Address (if there is more than one address assigned to this Linode)
- Under Actions, select "Swap With"
- A pulldown will appear that will let you select the Linode that has the IP address you want.
- Select the IP address from those addresses that Linode has.
- Click "Save"
- You can now boot your Linode and work with 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