How to deal in AWS routing if we need to use a loopback interface in a EC2 instance

363 views Asked by At

I am relatively new in AWS. I am trying some thing basic like this:

One Ubuntu instance is connected with a vSRX instance. Say Ubuntu instance eth1 ip is like 20.0.0.100 and vSRX corresponding interface ip is 20.0.0.101. Now I want to configure a loopback interface (its a virtual interface) inside the vSRX and assign a ip 99.99.99.99. Obviously this 99… network info is not available with AWS. My question is how can I build that knowledge in aws routing and make sure that to reach 99.99.99.99 go via 20.0.0.101 as next-hop? Is this possible?

Thanks in advance

I was thinking of creating a subnet in my VPC first with 99… network. But I unnecessary so not want to burn larger no of ip. And I believe /32 is not an acceptable CIDR in aws. And my journey stopped here. I am thinking of trying to configure CIDR of 99.99.99.96/29 but after that should I add that as local in route ? How could I specify that to reach 99 series go via a specific ip?

1

There are 1 answers

0
danno On

This would be accomplished two ways in AWS.

  1. If the ubuntu interface and the SRX internal interface are in the same subnet (as they appear to be in the example)... then you can accomplish this the same way as in a traditional office/dc/lan network - the ubuntu machine would have a static route in it's table pointing to 20.0.0.101 to get to the SRX lo0.0 interface address of 99.99.99.99/32.
  2. You can use the AWS subnet route table of the ubuntu machine to route 99.99.99.99/32 to the SRX's internal network interface by copying it's network interface ID and pasting that as the next hop in the route entry.