Créer une NIC
Vous pouvez créer une network interface card (NIC) dans le Subnet d’un Net.
Vous pouvez ensuite attacher la NIC à une machine virtuelle (VM) placée dans ce même Subnet, si la VM se trouve dans la même Sous-région. Pour en savoir plus, voir Attacher une NIC à une VM.
Vous devez également associer des security groups à vos NIC, avec des règles appropriées pour permettre l’accès à et depuis ces NIC. Pour en savoir plus, voir À propos des security groups.
Créer une NIC avec Cockpit
-
Dans le dashboard NICs, cliquez sur
Créer une NIC.
La boîte de dialogue CRÉER UNE NIC apparaît. -
Dans le champ Nom, tapez un nom pour la NIC.
Cette action ajoute un tag Name de 255 caractères maximum. Vous pouvez utiliser tous les caractères, y compris les lettres accentuées.
-
(optionnel) Dans le champ Description, tapez une description pour la NIC.
Cette description peut contenir jusqu’à 255 caractères Unicode.
-
Dans la liste Subnet, sélectionnez le Subnet dans lequel vous voulez créer la NIC.
-
(optionnel) Dans le champ IP privée, entrez l’IP privée principale pour la NIC.
-
Cette IP doit appartenir à la plage d’IP du Subnet que vous avez spécifié à l’étape précédente.
-
Si vous ne spécifiez pas ce champ, une IP privée appartenant au CIDR du Subnet est attribuée aléatoirement par le serveur DHCP du Net.
-
-
Dans la liste Security group, sélectionnez :
-
Créer un nouveau security group pour associer un nouveau security group à la NIC.
-
Dans le champ Nom, tapez un nom pour le security group.
-
Dans le champ Description, tapez sa description.
-
Le nom doit être unique dans votre compte pour le Cloud public ou pour chaque Net.
-
Le nom du security group ne doit pas commencer par
sg-. -
Chaque nom et description peut contenir entre 1 et 255 caractères. Les caractères autorisés sont a-z, A-Z, 0-9, l’espace et _.-:/()#,@[]+=&;\{}!$*.
-
-
-
Sélectionner un ou plusieurs security groups pour sélectionner un ou plusieurs security groups pour la NIC.
-
Poursuivre avec un security group par défaut pour sélectionner le security group par défaut du Net.
-
-
Cliquez sur Créer.
La NIC est créée.
Créer une NIC avec OSC CLI
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateNic command creates a network interface card (NIC) in the specified Subnet.
For more information, see About NICs.
$ osc-cli api CreateNic --profile "default" \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]'
$ osc-cli api CreateNic --profile "default" \
--Description "Terraform nic with private IPs" \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]' \
--PrivateIps '[
{
"IsPrimary": True,
"PrivateIp": "10.0.0.4"
},
{
"IsPrimary": False,
"PrivateIp": "10.0.0.5"
}
]'
This command contains the following attributes that you need to specify:
-
Description: (optional) A description for the NIC. -
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PrivateIps: (optional) The primary private IP for the NIC.
This IP must be within the IP range of the Subnet that you specify with theSubnetIdattribute.
If you do not specify this attribute, a random private IP is selected within the IP range of the Subnet.-
IsPrimary: (optional) If true, the IP is the primary private IP of the NIC. -
PrivateIp: (optional) The private IP of the NIC.
-
-
SecurityGroupIds: (optional) One or more IDs of security groups for the NIC. -
SubnetId: The ID of the Subnet in which you want to create the NIC.
The CreateNic command returns the following elements:
-
Nic: Information about the NIC.-
AccountId: The account ID of the owner of the NIC. -
Description: The description of the NIC. -
IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
LinkNic: Information about the NIC attachment.-
DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated. -
DeviceNumber: The device index for the NIC attachment (between1and7, both included). -
LinkNicId: The ID of the NIC to attach. -
State: The state of the attachment (attaching|attached|detaching|detached). -
VmAccountId: The account ID of the owner of the VM. -
VmId: The ID of the VM.
-
-
LinkPublicIp: Information about the public IP association.-
LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC. -
PublicDnsName: The name of the public DNS. -
PublicIp: The public IP associated with the NIC. -
PublicIpAccountId: The account ID of the owner of the public IP. -
PublicIpId: The allocation ID of the public IP.
-
-
MacAddress: The Media Access Control (MAC) address of the NIC. -
NetId: The ID of the Net for the NIC. -
NicId: The ID of the NIC. -
PrivateDnsName: The name of the private DNS. -
PrivateIps: The private IPs of the NIC.-
IsPrimary: If true, the IP is the primary private IP of the NIC. -
LinkPublicIp: Information about the public IP association.-
LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC. -
PublicDnsName: The name of the public DNS. -
PublicIp: The public IP associated with the NIC. -
PublicIpAccountId: The account ID of the owner of the public IP. -
PublicIpId: The allocation ID of the public IP.
-
-
PrivateDnsName: The name of the private DNS. -
PrivateIp: The private IP of the NIC.
-
-
SecurityGroups: One or more IDs of security groups for the NIC.-
SecurityGroupId: The ID of the security group. -
SecurityGroupName: The name of the security group.
-
-
State: The state of the NIC (available|attaching|in-use|detaching). -
SubnetId: The ID of the Subnet. -
SubregionName: The Subregion in which the NIC is located. -
Tags: One or more tags associated with the NIC.-
Key: The key of the tag, with a minimum of 1 character. -
Value: The value of the tag, between 0 and 255 characters.
-
-
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Nic": {
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"State": "available",
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Tags": [],
"Description": "",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
}
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Nic": {
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"State": "available",
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Tags": [],
"Description": "",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
},
{
"PrivateDnsName": "ip-10-0-0-5.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.5",
"IsPrimary": false
}
]
}
}
Créer une NIC avec oapi-cli
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateNic command creates a network interface card (NIC) in the specified Subnet.
For more information, see About NICs.
$ oapi-cli --profile "default" CreateNic \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]'
$ oapi-cli --profile "default" CreateNic \
--Description "Terraform nic with private IPs" \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]' \
--PrivateIps '[
{
"IsPrimary": true,
"PrivateIp": "10.0.0.4"
},
{
"IsPrimary": false,
"PrivateIp": "10.0.0.5"
}
]'
This command contains the following attributes that you need to specify:
-
Description: (optional) A description for the NIC. -
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PrivateIps: (optional) The primary private IP for the NIC.
This IP must be within the IP range of the Subnet that you specify with theSubnetIdattribute.
If you do not specify this attribute, a random private IP is selected within the IP range of the Subnet.-
IsPrimary: (optional) If true, the IP is the primary private IP of the NIC. -
PrivateIp: (optional) The private IP of the NIC.
-
-
SecurityGroupIds: (optional) One or more IDs of security groups for the NIC. -
SubnetId: The ID of the Subnet in which you want to create the NIC.
The CreateNic command returns the following elements:
-
Nic: Information about the NIC.-
AccountId: The account ID of the owner of the NIC. -
Description: The description of the NIC. -
IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
LinkNic: Information about the NIC attachment.-
DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated. -
DeviceNumber: The device index for the NIC attachment (between1and7, both included). -
LinkNicId: The ID of the NIC to attach. -
State: The state of the attachment (attaching|attached|detaching|detached). -
VmAccountId: The account ID of the owner of the VM. -
VmId: The ID of the VM.
-
-
LinkPublicIp: Information about the public IP association.-
LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC. -
PublicDnsName: The name of the public DNS. -
PublicIp: The public IP associated with the NIC. -
PublicIpAccountId: The account ID of the owner of the public IP. -
PublicIpId: The allocation ID of the public IP.
-
-
MacAddress: The Media Access Control (MAC) address of the NIC. -
NetId: The ID of the Net for the NIC. -
NicId: The ID of the NIC. -
PrivateDnsName: The name of the private DNS. -
PrivateIps: The private IPs of the NIC.-
IsPrimary: If true, the IP is the primary private IP of the NIC. -
LinkPublicIp: Information about the public IP association.-
LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC. -
PublicDnsName: The name of the public DNS. -
PublicIp: The public IP associated with the NIC. -
PublicIpAccountId: The account ID of the owner of the public IP. -
PublicIpId: The allocation ID of the public IP.
-
-
PrivateDnsName: The name of the private DNS. -
PrivateIp: The private IP of the NIC.
-
-
SecurityGroups: One or more IDs of security groups for the NIC.-
SecurityGroupId: The ID of the security group. -
SecurityGroupName: The name of the security group.
-
-
State: The state of the NIC (available|attaching|in-use|detaching). -
SubnetId: The ID of the Subnet. -
SubregionName: The Subregion in which the NIC is located. -
Tags: One or more tags associated with the NIC.-
Key: The key of the tag, with a minimum of 1 character. -
Value: The value of the tag, between 0 and 255 characters.
-
-
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Nic": {
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"State": "available",
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Tags": [],
"Description": "",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
}
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Nic": {
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"State": "available",
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Tags": [],
"Description": "",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
},
{
"PrivateDnsName": "ip-10-0-0-5.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.5",
"IsPrimary": false
}
]
}
}
Créer une FNI avec AWS CLI
Avant de commencer : Installez et configurez AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. |
Pour créer une FNI, utilisez la commande create-network-interface en suivant cette syntaxe :
$ aws ec2 create-network-interface \
--profile YOUR_PROFILE \
--subnet-id subnet-12345678 \
--description my-FNI \
--private-ip-address 10.0.0.4 \
--groups sg-12345678 \
--endpoint https://fcu.eu-west-2.outscale.com
Cette commande contient les options suivantes que vous devez spécifier :
-
(optionnel)
profile: Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. -
subnet-id: L’ID du subnet dans lequel vous voulez créer la FNI. -
(optionnel)
description: Une description de la FNI.Cette description peut contenir n’importe quel caractère Unicode, sans limite de longueur.
-
(optionnel)
private-ip-address: L’IP privée principale de la FNI.-
Cette IP doit appartenir à la plage d’IP du subnet que vous avez spécifié avec l’option
subnet-id. -
Si vous ne spécifiez pas cette option, une IP privée est sélectionnée aléatoirement dans la plage d’IP du subnet.
-
-
(optionnel)
groups: Un ou plusieurs ID de security groups pour la FNI.Si vous ne spécifiez aucun security group, le security group par défaut du VPC est associé.
-
endpoint: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
La commande create-network-interface renvoie les éléments suivants :
-
NetworkInterface: Informations à propos de la FNI créée. Cet élément contient les informations suivantes :-
AvailabilityZone: L’AZ dans laquelle se trouve la FNI. Pour en savoir plus, voir À propos des Régions et Sous-régions. -
Description: La description de la FNI. -
Groups: Informations à propos d’un ou plusieurs security groups associés à la FNI. Cet élément contient les informations suivantes :-
GroupName: Le nom du security group. -
GroupId: L’ID du security group.
-
-
MacAddress: L’adresse MAC (Media Access Control) de la FNI. -
NetworkInterfaceId: L’ID de la FNI. -
OwnerId: L’account ID du propriétaire de la FNI. -
PrivateDnsName: Le nom DNS privé associé à l’IP privée principale. -
PrivateIpAddress: L’IP privée principale de la FNI. -
PrivateIpAddresses: Informations sur les IP privées et secondaires de la FNI. Cet élément contient les informations suivantes :-
Primary: Sitrue, l’IP privée est la principale. Sifalse, il s’agit d’une IP privée secondaire. -
PrivateDnsName: Le nom DNS privé associé à l’IP privée. -
PrivateIpAddress: L’IP privée.
-
-
SourceDestCheck: Sitrue, le trafic vers ou depuis l’instance est validé. Si c’estfalse, il ne l’est pas. -
Status: L’état de la FNI. Pour en savoir plus, voir À propos des NIC > Attachement des NIC aux VM. -
SubnetId: L’ID du subnet dans lequel se trouve la FNI. -
TagSet: Un ou plusieurs tags associés à la FNI. -
VpcId: L’ID du VPC dans lequel se trouve la FNI.
-
{
"NetworkInterface": {
"AvailabilityZone": "eu-west-2a",
"Description": "my-FNI",
"Groups": [
{
"GroupName": "SG1",
"GroupId": "sg-12345678"
}
],
"MacAddress": "02:1A:80:41:52:9C",
"NetworkInterfaceId": "eni-12345678",
"OwnerId": "123456789000",
"PrivateDnsName"; "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIpAddress": "10.0.0.4",
"PrivateIpAddresses": [
{
"Primary": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIpAddress": "10.0.0.4"
}
],
"SourceDestCheck": true,
"Status": "available",
"SubnetId": "subnet-12345678",
"TagSet": [],
"VpcId": "vpc-87654321"
}
}
La FNI est créée.
Pages connexes
Méthodes API correspondantes
AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.