How do I change IP addresses using the Linode CLI/API?

Linode Staff

Is it possible to change a Linode's public IP by an CLI command or API call from within the Linode itself?

1 Reply

IP address changes require reaching out to Support. In most cases, we aren't able to provide them, if you need to change IP addresses for some reason, you can open a Support Ticket providing us with your technical justification as to why the address needs to be changed. Once we have that, we can consider the request.

That said, while there is no direct way to request an IP and swap it from the CLI/API without opening a ticket, you may still be able to achieve the same effect. The closest thing I can think of to what you're asking about would be to swap IP addresses with an existing Linode in the same datacenter as your current Linode. If you have the Linode CLI installed on the Linode, then you can create a second Linode with a command like the following:

linode-cli linodes create --label $LABEL \
                          --region $REGION\
                          --root_pass $PASSWORD \
                          --image $IMAGE \
                          --type $PLAN \
                          --authorized_keys $SSH_PUBLIC_KEY

You can then swap IP addresses between them:

linode-cli networking ip-assign
    --region us-east \
    --assignments \
        '{"address": "", "linode_id": 123}' \
    --assignments \
        '{"", "linode_id": 234}'

I've included our documentation on the Linode API v4, which also includes examples of how to use the CLI, for your reference. As an alternative to the CLI, you can also write raw API calls to accomplish this task. The section of the API docs you want to look at is called "Assign IPs to Linodes".


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct