Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typo

Anchor
TOC
TOC
Include Page
KBCOMMON:KB-CSSstyle
KBCOMMON:KB-CSSstyle

...

When an instance is created, a default Ethernet interface is attached to the system (eth0). You can create additional network interfaces and attach them to an instance. 

(warning) If  If an instance has only one Ethernet interface, a public IP address can be assigned to the interface automatically. However, this address will be removed by AWS as soon as the network is restarted after if a second interface has been is added to the instance and the instance is stopped and restarted. Be careful not to lose connectivity to your instance when changing the network configuration.

...

The following steps are required to create a new network interface that can later be added to an instance:

StepDetails
Locate the Network Interfaces option on the EC2 dashboard and click on it.

Image Modified

Clicking on Network Interfaces opens the list of existing

networks

network interfaces.

Create a new interface.

Click on Create Network Interface at the top of the interface list.

Image Modified

This opens the interface creation window.

Image Removed

Image Added

On this screen,

  • enter a description,
  • select the subnet the interface should be on (select the subnet to which your instance is to be connected),
  • allow AWS to automatically assign a private IP address or set a custom one from the subnet IP range, and
  • associate the interface with a security group (often the same as for the instance).

Click on Create when you are done. The new interface will appear in the overview list. There you can assign a name to the interface. Check that the interface is in state available.


Div
classpagebreak


Attaching the Interface to your Instance

After creating a network interface, you have to assign it to the instance where it will be used.

Warning
Adding
  • Stopping and restarting the instance after adding a second network interface will release any automatically assigned public IP address. If several interfaces are required where one or more are configured with a public address, use Elastic IP addresses.
  • Additionally, adding a second network interface to a non-Amazon Linux EC2 instance causes traffic flow issues. This occurs
because both interfaces are in the same subnet, and there is only one routing table containing one default gateway. Traffic that comes into the second network interface leaves the instance using the first
  • in cases of asymmetric routing where traffic to the instance arrives at one network interface and leaves the instance through the other network interface. This is blocked by AWS because a mismatch between MAC address and
IP address.

To make the second interface work, perform the following steps:

  • Add the new interface to your running instance.
  • Create a configuration file for the second interface.
  • If one interface has a public IP address, restart your network and test reachability of the public interface.If both interfaces only have private IP addresses,
  • configure a secondary routing table, and then
  • set up rules in the custom routing table policy database so that traffic for the secondary interface uses the new routing table. Refer to the AWS documentation
and to section Example of a More Complex Network Configuration 
  • If your instance supports enhanced networking there may be naming inconsistencies when adding additional interfaces to a running instance. Please refer to the interface names section in AWS Networking and Charon-SSP.
  • The NetworkManager is disabled on Charon-SSP AWS. Therefore, ifcfg-files in /etc/sysconfig/network-scripts are required to define the IP configuration of an interface.


StepDetails
Locate your network interface in the interface list and right-click on it.

The right-click opens the context menu. Select Attach.


This will open the window to enter the necessary instance information.

Image Modified
Select your instance and confirm entry.

Select your instance from the drop-down list and click on Attach.


The state of your interface will change from available to in-use.

Image Modified
Verify that instance has second interface.

Select your instance in the instance list. The description tab in instance details should now display two network interfaces:

Image Removed

Image Added

(info) You can also attach/detach existing interfaces from the instance overview screen. Select your instance and then Actions > Networking > Attach or Detach network interface.

Div
classpagebreak


Assigning an Elastic IP Address to the Network Interface

The public IP address assigned to your instance by default when it starts, is not persistent. You will receive a new address when the instance is stopped and started again.

An Elastic IP address is a persistent, public IPv4 address to be used for one of your network interfaces or instances. You can associate an Elastic IP address with any instance or network interface in your account.

(info) The  The advantage of associating the Elastic IP address with the network interface instead of directly with the instance is that you can move the network interface with its attributes easily from one instance to another.

(warning) The  The initial automatically assigned public IP address will be removed as soon as you restart the network or the instance after adding a network interface with an Elastic IP address to your instance. Do not restart your network or your instance before you are sure you can reach it via the Elastic IP address. The automatically assigned public IP address will also be disabled if you assign an Elastic IP address to the primary Ethernet interface of the instance.

The table below describes the steps required to add an Elastic IP address to a network interface.

StepDetails
Locate the Elastic IPs option on the EC2 dashboard and click on it.

Image Modified

This will list the already created Elastic IP addresses.

Allocate a new address.

In the overview list, click on Allocate new address if you need to allocate a new address. It is also possible to assign an existing address to an interface. However, each address can only be used for one instance.

Image Removed

Image Added

This will open the address allocation window.


In the address allocation window, select the Amazon pool (or your own pool of public addresses), and click on Allocate.

Image Removed

Image Added

The new address will be shown in the list.

Associate the address with the network interface.

Right-click on the address and select Associate. A window to enter the required options opens.

Image Modified

In the window,

  • select to associate the IP address with a network interface,
  • select your network interface from the drop-down menu,
  • connect the public address to the private address of the interface, and 
  • click on Associate to complete the step.

Detaching a Network Interface from an Instance

...