Manage prefixes for your network interfaces
You can manage the prefixes with your network interfaces as follows.
Tasks
Assign prefixes during network interface creation
You can assign automatic or custom prefixes when you create a network interface.
- Console
-
To assign automatic prefixes during network interface creation
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Network Interfaces.
-
Choose Create network interface.
-
Enter a description for the network interface, select the subnet in which to create the network interface, and configure the private IPv4 and IPv6 addresses.
-
Expand Advanced settings.
-
For IPv4 prefix delegation do one of the following:
-
To automatically assign an IPv4 prefix, choose Auto-assign. For Number of IPv4 prefixes, enter the number of prefixes to assign.
-
To assign a specific IPv4 prefix, choose Custom. Choose Add new prefix and enter the prefix.
-
-
For IPv6 prefix delegation do one of the following:
-
To automatically assign an IPv6 prefix, choose Auto-assign. For Number of IPv6 prefixes, enter the number of prefixes to assign.
-
To assign a specific IPv6 prefix, choose Custom. Choose Add new prefix and enter the prefix.
Note
IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.
-
-
Select the security groups to associate with the network interface and assign resource tags if needed.
-
Choose Create network interface.
-
- AWS CLI
-
To assign automatic IPv4 prefixes during network interface creation
Use the create-network-interface command and set
--ipv4-prefix-count
to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one prefix.aws ec2 create-network-interface \ --subnet-id
subnet-047cfed18eEXAMPLE
\ --description "IPv4 automatic example
" \ --ipv4-prefix-count1
To assign specific IPv4 prefixes during network interface creation
Use the create-network-interface command and set
--ipv4-prefixes
to the prefixes. AWS selects IP addresses from this range. In the following example, the prefix CIDR is10.0.0.208/28
.aws ec2 create-network-interface \ --subnet-id
subnet-047cfed18eEXAMPLE
\ --description "IPv4 manual example
" \ --ipv4-prefixes Ipv4Prefix=10.0.0.208/28
To assign automatic IPv6 prefixes during network interface creation
Use the create-network-interface command and set
--ipv6-prefix-count
to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one prefix.aws ec2 create-network-interface \ --subnet-id
subnet-047cfed18eEXAMPLE
\ --description "IPv6 automatic example
" \ --ipv6-prefix-count1
To assign specific IPv6 prefixes during network interface creation
Use the create-network-interface command and set
--ipv6-prefixes
to the prefixes. AWS selects IP addresses from this range. In the following example, the prefix CIDR is2600:1f13:fc2:a700:1768::/80
.aws ec2 create-network-interface \ --subnet-id
subnet-047cfed18eEXAMPLE
\ --description "IPv6 manual example
" \ --ipv6-prefixes Ipv6Prefix=2600:1f13:fc2:a700:1768::/80
Assign prefixes to an existing network interface
You can assign automatic or custom prefixes to an existing network interface.
- Console
-
To assign automatic prefixes to an existing network interface
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Network Interfaces.
-
Select the network interface to which to assign the prefixes, and choose Actions, Manage prefixes.
-
For IPv4 prefix delegation do one of the following:
-
To automatically assign an IPv4 prefix, choose Auto-assign. For Number of IPv4 prefixes, enter the number of prefixes to assign.
-
To assign a specific IPv4 prefix, choose Custom. Choose Add new prefix and enter the prefix.
-
-
For IPv6 prefix delegation do one of the following:
-
To automatically assign an IPv6 prefix, choose Auto-assign. For Number of IPv6 prefixes, enter the number of prefixes to assign.
-
To assign a specific IPv6 prefix, choose Custom. Choose Add new prefix and enter the prefix.
Note
IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.
-
-
Choose Save.
-
- AWS CLI
-
You can use the assign-ipv6-addresses command to assign IPv6 prefixes and the assign-private-ip-addresses command to assign IPv4 prefixes to existing network interfaces.
To assign automatic IPv4 prefixes to an existing network interface
Use the assign-private-ip-addresses command and set
--ipv4-prefix-count
to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one IPv4 prefix.aws ec2 assign-private-ip-addresses \ --network-interface-id
eni-081fbb4095EXAMPLE
\ --ipv4-prefix-count1
To assign specific IPv4 prefixes to an existing network interface
Use the assign-private-ip-addresses command and set
--ipv4-prefixes
to the prefix. AWS selects IPv4 addresses from this range. In the following example, the prefix CIDR is10.0.0.208/28
.aws ec2 assign-private-ip-addresses \ --network-interface-id
eni-081fbb4095EXAMPLE
\ --ipv4-prefixes10.0.0.208/28
To assign automatic IPv6 prefixes to an existing network interface
Use the assign-ipv6-addresses command and set
--ipv6-prefix-count
to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one IPv6 prefix.aws ec2 assign-ipv6-addresses \ --network-interface-id
eni-00d577338cEXAMPLE
\ --ipv6-prefix-count1
To assign specific IPv6 prefixes to an existing network interface
Use the assign-ipv6-addresses command and set
--ipv6-prefixes
to the prefix. AWS selects IPv6 addresses from this range. In the following example, the prefix CIDR is2600:1f13:fc2:a700:18bb::/80
.aws ec2 assign-ipv6-addresses \ --network-interface-id
eni-00d577338cEXAMPLE
\ --ipv6-prefixes2600:1f13:fc2:a700:18bb::/80
Remove prefixes from your network interfaces
You can remove prefixes from an existing network interface.
- Console
-
To remove the prefixes from a network interface
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Network Interfaces.
-
Select the network interface.
-
Choose Actions, Manage prefixes.
-
For IPv4 prefix delegation, to remove specific prefixes, choose Unassign next to the prefixes to remove. To remove all prefixes, choose Do not assign.
-
For IPv6 prefix delegation, to remove specific prefixes, choose Unassign next to the prefixes to remove. To remove all prefixes, choose Do not assign.
Note
IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.
-
Choose Save.
-
- AWS CLI
-
You can use the unassign-ipv6-addresses command to remove IPv6 prefixes and the unassign-private-ip-addresses commands to remove IPv4 prefixes from your existing network interfaces.
To remove IPv4 prefixes from a network interface
Use the unassign-private-ip-addresses command and set
--ipv4-prefix
to the address that you want to remove.aws ec2 unassign-private-ip-addresses \ --network-interface-id
eni-081fbb4095EXAMPLE
\ --ipv4-prefixes10.0.0.176/28
To remove IPv6 prefixes from a network interface
Use the unassign-ipv6-addresses command and set
--ipv6-prefix
to the address that you want to remove.aws ec2 unassign-ipv6-addresses \ --network-interface-id
eni-00d577338cEXAMPLE
\ --ipv6-prefix2600:1f13:fc2:a700:18bb::/80