Wednesday 27 April 2016

Adding an additional network interface onto an EC2 instance

In this example I will be adding a secondary interface onto an EC2 instance running Linux.

AWS allows you to assign up three (as of current) additional IP addresses to each interface - with the potential of allowing a machine to have up to four public IP's per interface.

We should firstly go to the EC2 Portal >> 'Network and Security' >> 'Network Interfaces' >> Right-hand click on the relevant interface and click on 'Manage Private IP Addresses' and hit 'Assign new IP'.

Unfortunately this restricts us when it comes to security groups - as they can only be applied on a per interface basis and can't be applied to individual destination IP's.

Once it has been created proceed by going to 'Network and Security' >> Elastic IP's >> 'Allocate New Address' >> Select the relevant interface and then assign it to our newly created private IP address.

Lastly we should create a sub-interface on our Linux box - so test we can issue something like:
ifconfig eth0:0 10.11.12.123 netmask 255.255.255.0
And to ensure the changes persist after reboot we should append the following into /etc/network/interfaces (presuming you are using Debian or a variant):
auto eth0:0
iface eth0:0 inet static
address 10.11.12.123
netmask 255.255.255.0
And finally restart networking:

sudo service networking restart

0 comments:

Post a Comment