Skip to main content

ip_addresses

Creates, updates, deletes, gets or lists an ip_addresses resource.

Overview

Nameip_addresses
TypeResource
Idlinode.networking.ip_addresses

Fields

The following fields are returned by SELECT queries:

The requested IP Address.

NameDatatypeDescription
interface_idintegerBeta, Read-only The Linode interface ID that this IP address is assigned to. This value is null if a Linode interface is not assigned, or if the IP is assigned to a legacy configuration profile interface.
linode_idintegerRead-only The ID of the Linode this address currently belongs to. For IPv4 addresses, this is by default the Linode that this address was assigned to on creation, and these addresses may be moved using the Assign IPv4s to Linodes operation. For SLAAC and link-local addresses, this value can't be changed.
addressstring (ip)Read-only The IP address. (example: 97.107.143.141)
gatewaystring (ip)Read-only The default gateway for this address. (example: 97.107.143.1)
prefixintegerRead-only The number of bits set in the subnet mask.
publicbooleanRead-only Whether this is a public or private IP address.
rdnsstringThe reverse DNS assigned to this address. For public IPv4 addresses, this will be set to a default value provided by Linode if not explicitly set. (example: test.example.org)
regionstringRead-only The Region this IP address resides in. (example: us-east)
subnet_maskstring (ip)Read-only The mask that separates host bits from network bits for this address. (example: 255.255.255.0)
typestringRead-only The type of address this is. (example: ipv4)
vpc_nat_1_1objectIPv4 address configured as a 1:1 NAT for this Interface. If no address is configured as a 1:1 NAT, null is returned. > 📘 > > Only allowed for vpc type interfaces.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_ipselectReturns information about a single IP Address on your Account.

Learn more...

Learn more...
get_ipsselectskip_ipv6_rdnsReturns a paginated list of IP addresses on your account for Linodes or Linode interfaces, excluding private addresses.

> 👍
>
> if your application frequently accesses this operation and doesn't require IPv6 RDNS data, you can use the skip_ipv6_rdns query string to improve performance.

Learn more...

Learn more...
put_ipreplacedata__rdnsSets RDNS on an IP Address. Forward DNS must already be set up for reverse DNS to be applied. If you set the RDNS to null for public IPv4 addresses, it will be reset to the default ip.linodeusercontent.com RDNS value.

Learn more...

Learn more...
post_allocate_ipexectype, public, linode_idAllocates a new IPv4 Address on your Account. The Linode must be configured to support additional addresses - please Open a support ticket requesting additional addresses before attempting allocation.

> 📘
>
> You can run this operation for Linodes with legacy configuration interfaces. You can't use it for Linodes with Linode interfaces. To allocate an IP for a Linode with Linode interfaces, use the Add a Linode interface operation and set the public IPv4 address to auto.

Learn more...

Learn more...
post_assign_ipsexecregion, assignmentsAssign any set of IPv4 addresses and IPv6 ranges to Linodes in one region. This allows swapping, shuffling, or otherwise reorganizing IPs among your Linodes.

The following restrictions apply:

- All Linodes need to have at least one public IPv4 address assigned.
- For Linode interfaces, the Linode needs to have a public interface, and the address it receives can't be a private IPv4 address.
- Linodes may have no more than one assigned private IPv4 address.
- Linodes may have no more than one assigned IPv6 range.
- Shared IP addresses cannot be swapped between Linodes.

Open a support ticket to request additional IPv4 addresses or IPv6 ranges beyond standard account limits.

> 📘
>
> Removing an IP address that has been set as a Managed Linode's ssh.ip causes the Managed Linode's SSH access settings to reset to their default values.

To view and configure Managed Linode SSH settings, use the following operations:

- Get a Linode's managed settings
- Update a Linode's managed settings

> 📘
>
> Addresses with an active 1:1 NAT to a VPC Interface address cannot be assigned to other Linodes.

Learn more...

Learn more...
post_share_ipsexeclinode_id, ipsConfigure shared IPs.

IP sharing allows IP address reassignment (also referred to as IP failover) from one Linode to another if the primary Linode becomes unresponsive. This means that requests to the primary Linode's IP address can be automatically rerouted to secondary Linodes at the configured shared IP addresses.

IP failover requires configuration of a BGP based failover service within the internal system of the primary Linode.

> 📘
>
> A public IPv4 address can't be shared if it's configured for a 1:1 NAT on a legacy configuration profile VPC interface or on a Linode VPC interface.

Learn more...

Learn more...

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
skip_ipv6_rdnsbooleanWhen true, the rdns property for any ipv6 type addresses always returns null regardless of whether RDNS data exists for the address.

SELECT examples

Returns information about a single IP Address on your Account.

Learn more...

Learn more...

SELECT
interface_id,
linode_id,
address,
gateway,
prefix,
public,
rdns,
region,
subnet_mask,
type,
vpc_nat_1_1
FROM linode.networking.ip_addresses;

REPLACE examples

Sets RDNS on an IP Address. Forward DNS must already be set up for reverse DNS to be applied. If you set the RDNS to null for public IPv4 addresses, it will be reset to the default ip.linodeusercontent.com RDNS value.

Learn more...

Learn more...

REPLACE linode.networking.ip_addresses
SET
data__rdns = '{{ rdns }}'
WHERE
data__rdns = '{{ rdns }}' --required
RETURNING
interface_id,
linode_id,
address,
gateway,
prefix,
public,
rdns,
region,
subnet_mask,
type,
vpc_nat_1_1;

Lifecycle Methods

Allocates a new IPv4 Address on your Account. The Linode must be configured to support additional addresses - please Open a support ticket requesting additional addresses before attempting allocation.

> 📘
>
> You can run this operation for Linodes with legacy configuration interfaces. You can't use it for Linodes with Linode interfaces. To allocate an IP for a Linode with Linode interfaces, use the Add a Linode interface operation and set the public IPv4 address to auto.

Learn more...

Learn more...

EXEC linode.networking.ip_addresses.post_allocate_ip 
@@json=
'{
"linode_id": {{ linode_id }},
"public": {{ public }},
"type": "{{ type }}"
}';