Aws Networking Fundamentals
Aws Networking Fundamentals
Aws Networking Fundamentals
Cisco SD-WAN:
A Practical Guide to Understand the Basics of Cisco Viptela Based SD-WAN
Solution (May 2021)
Network Virtualization:
LISP, OMP, and BGP EVPN Operation and Interaction
(August 2021)
AWS Networking Fundamentals v
Chapter 1 - Virtual Private Cloud – VPC: The first chapter explains how you can
start your virtual Datacenter, Virtual Private Cloud (VPC). You will learn what
Regions and Availability Zones (AZ) are and how you create subnets within AZ.
Subnets in VPC are not broadcast domains. They are networks for workloads
having equal connectivity requirements. This chapter explains how you create
subnet-specific route tables and Network Access Control Lists (NACL).
Chapter 4 - VPC Nat Gateway: This chapter introduces a NAT Gateway (NAT
GW), which offers egress-only Internet access for EC2 Instances in the Private
subnet. EC2 instances in Private subnets have the Internet connection via NAT
GW. However, hosts on the Internet can not initiate connections to EC2 instances
behind a NAT GW.
Chapter 6 - Transit Gateway: The following three chapter introduces AWS Transit
Gateway. This chapter explains how we can provide an Inter-VPC connection
within AWS Region by using Transit Gateway. It also explains how we can set up
a VPN connection between VPC and on-prem Datacenter using TGW.
Chapter 7 - VPC Segmentation with Transit Gateway: This chapter explains how
you can implement Inter-regional VPC segmentation policy by using VPC-specific
TGW route tables.
Chapter 9 – VPC Peering: This chapter introduces VPC peering model that is a
simple Inter-VPC connection between two VPCs. It requires subnet route table
modification to allow traffic flows between VPCs.
Chapter 11 – Dedicated Direct Connect: This is the first of the four AWS Direct
Connect connection chapters. It explains how to order a cross-connect between
AWS devices and the customer device located in AWS Direct Connect Location.
This chapter also introduces how to create AWS Direct Connect Gateway (DXGW)
and what is needed to create BGP peering between DXGW and customer devices.
You will also learn how to attach Transit Gateway to DXGW.
Chapter 12 – Hosted Direct Connect: This chapter introduces AWS Hosted Direct
Connect. It explains how AWS Direct Connect Partners offers a cross-connection
from the AWS Direct Connect Partner using their infrastructure. Because some
AWS DCPs used BGP EVPN/VXLAN Fabric for their Hosted Direct Connect
service, this chapter also introduces the BGP EVPN based MAC address learning
process and explains how the VXLAN Data-Plane traffic forwarding works.
AWS Networking Fundamentals vii
Chapter 13 – Direct Connect BGP Policy: This chapter explains how we can affect
to egress path selection process on AWS Direct Connect Gateway (DXGW). DXGW
are AWS-managed services, so we can’t change their configuration. However, we
can use BGP built-in tools (BGP route aggregation, BGP AS-Path Prepending, and
BGP Communities) for affecting to egress path selection process.
Chapter 14 – AWS Direct Connect SiteLink: This chapter introduces the AWS
Direct Connect SiteLink, which enables site-to-site traffic over Direct Connect
connections terminated into the same DXGW. It also explains how to migrate an
existing Corporate inter-site WAN connection to AWS BackBone.
Chapter 15 – AWS Direct Connect – Public VIF: This chapter introduces how to
use an AWS Direct Connect connection (DX) and a Public Virtual Interface (P-VIF)
for accessing AWS Public Service.
Disclaimers
The content of this book is based only on the author's own experience and testing
results. Its content is neither validated nor accepted by Amazon or any other
organization or person. This book is meant to be neither design nor an
implementation guide. After reading this book, readers should do their technology
validation before using it in a production environment.
viii About This Book
Table of Contents
VPC
VPC Introduction
AWS Virtual Private Cloud (VPC) is a virtual a virtual Datacenter for Amazon
Elastic Cloud Compute instances (EC2) within AWS Region. AWS Regions, in turn,
belongs to the global AWS Cloud environment. Each AWS Region consists of
Availability Zones (AZ), which are isolated locations. AZ, in turn, has two more
physical Datacenters. At the time of writing, Seoul and Tokyo have four, and
Northern Virginia has six AZs. All other AWS regions have three AZs. VPC spans
over regional AZs but not between AWS Regions. In other words, VPCs are region-
specific virtual networks.
A VPC has to have a CIDR (Classless Interdomain Routing) IP block attached to it.
The VPC CIDR defines the IP range, which we can use when creating subnets to
VPC. CIDR range is VPC specific and can overlap with other VPC’s CIRD range.
If you create a VPC-to-VPC connection, you need a unique CIDR range per VPC.
We can allocate subnets for EC2 instances from the VPC’s CIDR range. Subnets are
AZ-specific, and they can’t be span from one AZ to another. Subnets are classified
either as Public Subnets or Private Subnets. Public Subnet has a route to Internet
GW (Internet Gateway) in its Routing Table (RT). EC2 instances launched in a
Public Subnet have to have a public IPv4 address in order to have an Internet
connection. Note that IPv6 addresses are always assigned from the public address
space. EC2 launched in a Private Subnet doesn’t have a public IPv4 address. Their
Internet connection goes via NAT GW. To allow Internet connection to EC2
instances in Private Subnet, we need to add a route to NAT GW into the Private
Subnet Routing Table. We can use a stateful, egress-Only Internet GW for EC2
using an IPv6 address. This way, IPv6 EC2 instances have an Internet connection,
but hosts on the internet can’t initiate a connection to EC2. IP connectivity between
EC2 instances within VPC is established between private IP address even if one of
the EC2s is attached to Public Subnet and has a Public IP address. VPC has a main
Routing Table (RT) and subnet-specific RTs.
Each VPC also has a default Network Access Control List (NACL). The default
NACL is bind to all subnets in VPC by default. NACL is stateless by nature, traffic
to and from the subnet has to be allowed in both inbound and outbound directions.
The default NACL allows all ingress/egress traffic.
2 Chapter 1: Virtual Private Cloud - VPC
Figure 1-1 illustrates our example VPC and its relationship to AWS Availability
Zones, AWS Regions, and AWS Account. When we create VPC, we first have to
log on to our AWS account. Next, we select an AWS Region, in our case Europe
(London) eu-west-2. Then we choose Availability Zones for subnets. In our case,
network 10.10.0.0/24 is a Public Subnet in the AZ eu-west-2c, and network
10.10.1.0/24 is a Private Subnet in the AZ eu-west-2a. As the last step, we create
subnet-specific Routing Tables where we can later add subnet-specific routes.
There is a software router within each host. The virtual router’s vNIC uses the
physical NIC of a host as an uplink to switching fabric. Virtual routers are
responsible for the encapsulation/decapsulation process (add/remove VPC
header) of data traffic. The underlying network infrastructure is unaware of VPCs,
and switches make a forwarding decision for encapsulated data packets based on
the destination IP address in the outer tunnel IP header. The Control-Plane
solution for EC2 instance reachability information relies on Mapping services.
Each host registers its locally running EC2 instances to Mapping Service. The
mapping message includes information about EC2’s IP/MAC addresses and its
VPC in addition (identifier) to the IP address of a physical host (location). The
Mapping Service publishes the information when requested by hosts. Hosts, in
turn, caches the mapping information to minimize the latency.
The first thing to do when we create a VPC is to log in to the AWS console. Then
we select the AWS Region where we want to launch our VPC. We are going to use
VPC Region Europe (London) eu-west-2. As the last step, we give the name to VPC
and associate a CIDR block 10.10.0.0/16 to it.
Select Region
Figure 1-4 shows the AWS Management Console main window. We are going to
create our VPC to the AWS Region Europe (London) eu-west-2. As a first step, we
need to pick up the selected region from the drop-down menu. Then we click the
VPC hyperlink from the AWS services window. VPC hyperlink leads us to the VPC
Dashboard.
AWS Networking Fundamentals 5
The section on the left in the VPC Dashboard window lists all resources based on
their categories (VPC, Security, Reachability, etc.). The right column lists the same
resources (with some expectation) and the count of launched resources and related
AWS region. The right column shows that there is one VPC, three subnets, a route
table, an Internet Gateway, DHCP Options Sets, Network ACL, and Security
Group already in place. All of these are related to pre-defined Default VPC. Using
the Default VPC is the simplest way to start using EC2 instances. The Default VPC
has three subnets with /20 mask from the CIDR 172.31.0.0/16. Subnet 172.31.0.0/20
is attached to AZ eu-west-2c. Subnet 172.31.16.0/20 is bind to AZ eu-west-2a, and
the third subnet 172.16.32.0/20 is attached in AZ eu-west-2b. Default VPC also has
an Internet Gateway and a default route (0.0.0.0/0) towards it in the main routing
table. If we launch an EC2 instance in default VPC, we only need to assign a public
IP address to EC2 to allow an Internet connection. Instead of using the default VPC,
we are going to create a new VPC. Even if you don’t use the default VPC, do NOT
delete it. If you accidentally delete it, you can re-recreate it, but it is better not to
do it. The default VPC, like any other default resource, doesn’t have a name by
default. I have named all default resources using the DFLT prefix and the suffix
based on the resource. As an example, I have named the default routing table
DFLT-RTBL and the default VPC DFLT-VPC. If we don’t name resources, they are
shown only with their resource id in drop-down menus.
6 Chapter 1: Virtual Private Cloud - VPC
For example, when attaching a subnet to the VPC, the available VPCs are listed
with their relative VPC-Ids, like vpc-cfbac1a7. When adding a name to VPC, it is
shown like vpc-cfbac1a7 | DFLT-VPC. To proceed, click either Your VPC or VPCs
hyperlinks (3).
Create VPC
Figure 1-6 shows the pre-defined Default VPC and its details. We can create a new
VPC by clicking the Create VPC button (4).
We give the name NVKT-VPC-01 for our VPC (5). The Name Tag is a Key/Value
pair where the Key=Name, and the Value=NVKT-VPC-01 (8). We are going to use
the CIDR block 10.10.0.0/16 (6). We don't use IPv6 addressing in this VPC. We do
not need dedicated hardware for our EC2 instances, and we leave the Tenancy
value to Default (7).
8 Chapter 1: Virtual Private Cloud - VPC
If you need dedicated hardware to run EC2 instances on, select the Dedicated option
from the drop-down menu. Next, click the Create VPC button (9).
Figure 1-8 shows our new VPC vpc-04ef72cc79a73f82e / NVKT-VPC-01. Under the
DHCP options set, Main route table and Main network ACL are hyperlinks for each
service.
DHCP Options Sets defines the Domain name and DNS server. You can also define
the NTP server. Note that we don’t have to specify DHCP pools for EC2 instances.
The IP address for EC2 using DHCP will get the IP address and default GW from
the subnet range where we launched it.
10 Chapter 1: Virtual Private Cloud - VPC
The Details tab in figure 1-10 shows us that this is the main route table for VPC
NVKT-VPC-01. It also shows that we haven’t associate any subnets with it. When
creating a new subnet, we will assign a dedicated, subnet-specific routing table.
The reason for the dedicated route table is that we are going to use Internet GW
for bi-directional Internet Connection in Public Subnet and NAT GW for uni-
directional (egress-only) Internet access for Private Subnets. If we associate both
subnets with the VPC main route table, we can only add one default route that we
can use in all associated subnets. The Routes sheet show the actual routes. There is
only one route, the local route 10.10.0.0/16 (VPC CIDR block). This route is for
Inter-VPC connection, and it makes sure that all EC2 instances within VPC have
IP reachability between each other.
AWS Networking Fundamentals 11
We can verify our VPC configuration by using AWS CLI. Example 1-1 shows the
output for command aws ec2 describe-vpc in JSON format. This command lists all
our VPC resources with their properties. The first one is the newest VPC NVKT-
VPC-01, and the second one is the default VPC which I have named DFLT-VPC.
The first VPC gets ordinal zero [0], and the second VPC gets number one [1]. Note
that ordinal numbers are not shown in the output. VPC properties describe the
VPC-specific CIDR Block, DHCP Options, VPC Identifier, Owner Id, CIDR Block
Association, and Tags.
}
],
"IsDefault": true,
"Tags": [
{
"Key": "Name",
"Value": "DFLT-VPC"
}
]
}
]
Example 1-1: AWS CLI: Retrieve VPC Information.
We can use filters for retrieving information only from some specific resources.
The command aws ec2 describe-vpcs --filters Name=tag:Name,Values=NVKT-
VPC-01 shows VPCs where we have attached the Key/Value pair Name/NVKT-
VPC-01.
We can also query resource-specific information using the command aws ec2
describe-vpcs --query "Vpcs[0]". The zero within square brackets after the
resource Vpcs identifies the ordinal number of a resource. In our example, VPC
NVKT-VPC-01 is the first one, and it has an ordinal number zero.
If we want to see only some specific resource properties, we can add the properties
after the resource, separated by a dot. Example 1-4 shows how we can see the CIDR
Block Association for VPC NVKT-VPC-01 (ordinal zero).
We can change the output representation from the JSON to table by using the
option --output table. The table output is a good choice when we create
documentation about VPCs. Note that you can use this option with all other
commands too.
------------------------------------------------------
| DescribeVpcs |
+-----------------------------------+----------------+
| AssociationId | CidrBlock |
+-----------------------------------+----------------+
| vpc-cidr-assoc-0379c0e3e854f43ff | 10.10.0.0/16 |
+-----------------------------------+----------------+
|| CidrBlockState ||
|+------------------+-------------------------------+|
|| State | associated ||
|+------------------+-------------------------------+|
Example 1-5: AWS CLI: Retrieve CIDR Association to VPC – Table Output.
16 Chapter 1: Virtual Private Cloud - VPC
The focus of this section is to show how we can create a VPC using AWS
CloudFormation service. Figure 1-12 shows our example AWS CloudFormation
Templates. Its first section, AWSTemplateFormatVersion, specifies the template
language format. At the time of writing, 2010-09-09 is the latest and only valid
version. We can use the Description section to describe our template. Note that it
must follow the AWSTemplateFormatVersion Section. AWSTemplateFormation-
Version and Description are optional sections. The Resources section specifies the
actual AWS resources and their properties. Each AWS resource is identified with
a logical name. I have given the logical name NwktVPC for our example VPC. We
can use resource-specific logical names for defining dependencies between
resources. For example, when adding the AWS::EC2::Subnet resource to our
template, we assign the VpcId value by calling it from the AWS::EC2::VPC
resource using !REF intrinsinc function. I will explain the process in the Subnet
section later. The resources and their properties are defined under logical names.
The Resources section is the only required section in AWS CloudFormation-
Template. AWS CloudFormation Templates are identified by using Stack Names
in AWS Cloud Formation. Our example Stack Name is MyNetworkStack.
Create Template
I have created a text file using the YAML format. The file defines the set of
properties for our new VPC named NWKT-VPC-02. After writing the file, I saved
it to my computer using the name MyVpc.yml. You can use your favorite
repository for storing the template.
AWSTemplateFormatVersion: "2010-09-09"
Description: NWKT Second VPC In London
Resources:
NwktVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 192.168.0.0/16
InstanceTenancy: default
EnableDnsSupport: 'true'
EnableDnsHostnames: 'true'
Tags:
- Key: Name
Value: NWKT-VPC-02
Example 1-6: AWS Cloud Foration Template for VPC.
Uppload Template
After saving the file, I downloaded it to AWS using the Stack Name
MyNetworkStack. We will receive a notification when the stack is downloaded.
{
"StackId": "arn:aws:cloudformation:eu-west-
2:123456654321:stack/MyNetworkStack/8d42ac70-1939-11ec-81f9-06cf091d9f40"
}
Example 1-7: AWS CLI: Upload Template to AWS.
18 Chapter 1: Virtual Private Cloud - VPC
We can verify that our Stack MyNetworkStack is created into AWS from the AWS
Management Console. First, we select CloudFormation from the Service section.
Next, we select the Stacks option from the CloudFormation section (figure 1-14).
We can see that we have one stack, MyNetworkStack, and its status is Create
Complete. We can observe the stack by clicking the Stacks details option from the
CloudFormation section.
The Stack info tab in figure 1-15 shows the AWS assigned Amazon Resource
Name for the stack and the Description we used in our template.
The Resources tab lists type of resources along with their Logical and Physical
Identifier.
The Template tab in figure 1-17 shows the actual template which we previously
upload to AWS.
AWS Networking Fundamentals 21
We can retrieve the stack-specific information from AWS by using the command
aws cloudformation describe-stacks (example 1-8).
22 Chapter 1: Virtual Private Cloud - VPC
We can verify that the VPC defined in our AWS CloudFormation template is
created using the AWS CLI command aws ec2 describe-vpcs --filters
Name=tag:Name,Values=NWKT-VPC-02. Note that our VPC has three AWS
assigned tags in addition to the Name tag. They describe a) the Stack-Id, b) the
logical name of the VPC resource, and c) the Stack Name.
},
{
"Key": "aws:cloudformation:stack-id",
"Value": "arn:aws:cloudformation:eu-west-
2:123456654321:stack/MyNetworkStack/8d42ac70-1939-11ec-81f9-06cf091d9f40"
},
{
"Key": "aws:cloudformation:logical-id",
"Value": "NwktVPC"
},
{
"Key": "aws:cloudformation:stack-name",
"Value": "MyNetworkStack"
}
]
}
]
}
Example 1-9: AWS CLI: Retrieve VPC Information.
When we have created a new VPC, we can start adding subnets to it. We are going
to create two subnets. Subnet 10.10.0.0/24 is a Public Subnet in Availability Zone
eu-west2c, where we later add an Internet GW. Subnet 10.10.0.0/24 is a Private
Subnet in Availability Zone eu-west2a that will use a NAT GW for uni-directional
Internet access. Note that subnets in AWS Cloud are not broadcast domains.
Rather, they are places for instance with common routing requirements, like route
to Internet.
Create Subnets
Navigate back to VPC Dashboard and click the Subnets hyperlink either from the
left or right columns.
Figure 1-20 shows current subnets. All three subnets belong to default VPC. Note
that I have added a name to each subnet. For example, subnet 172.31.0.0/20 is in
Availability Zone eu.west-2c (euw-az1), and that is why I have used the 2c suffix
after the DFLT-SUBN prefix. The Default Subnet = Yes in the first column in Details
windows verifies that the subnet 172.31.0.0/20 (subnet-039ed36a) is the default
subnet. We can also see that the Route Table rtb-8edeeae6 | DFLT-RTBL and
Network ACL acl-57cc963f | DFLT-NACL are associated with the subnet. We are
going to create new subnets, which we then add to our VPC NVKT-VPC-01. Click
the Create subnet button to proceed.
We start the subnet creation process by selecting the VPC, where we are adding
our new subnet. Open the VPC Id drop-down menu. There’s two VPCs, the default
one (vpc-cfbac1a7 | DFLT-VPC) and the one we have created (vpc-
04ef72cc79a73f82 | NVKT-VPC). At this phase, we can see why naming is such an
important thing to do for each AWS resource and its properties. If we have several
VPCs without the name tag, it would be hard to select the right one based on just
autogenerated identifier (number/letter). When we have selected the right VPC,
more properties appear.
26 Chapter 1: Virtual Private Cloud - VPC
After selecting the correct VPC, we need to specify the subnet. We are creating a
subnet 10.10.0.0/24. We are going to add it to Availability Zone eu-west-2c. If there
is no need for a specific AZ, select the No Preference option from the drop-down
menu, and Amazon will randomly choose the AZ. Manual AZ selection gives you
the control to decide subnet location policy based on application/business needs.
In the worst-case scenario, all your critical EC2 instances might end up in the same
Availability Zone (=Physical Datacenter). The subnet name I have given describes
that this is a Public subnet in AZ eu-west-2c. Note that the name tag is a Key/Value
pair, where the Key is the "Name”, and the value is the actual name NWKT-Pub-
euw2c. I will show later how we can use these tags when retrieving information
from AWS using an AWS CLI.
AWS Networking Fundamentals 27
Figure 1-23 shows that we have successfully created a new subnet. Note that there
is a filter that shows only the subnet we just created. Subnet uses the main routing
table (rtb-069ac98ac692271fe) of VPC NVKT-VPC-01 by default. Also, VPC’s
default Network ACL (acl-0dfc4c4ef28ae6491) is used with the subnet.
I have created Private subnet 10.10.1.0/24 in the same way as Public subnet
10.10.0.0/24 but on the Availability Zone eu-west-2a. Figure 1-24 shows both Public
subnet 10.10.0.0/24 and Private subnet 10.10.1.0/24.
AWS Networking Fundamentals 29
Route Tables
Navigate back to VPC Dashboard and click the Route Tables hyperlink either from
the left or right columns.
Figure 1-27 shows our current route tables. I have given the name NWKT-MAIN-
RT (rtb-069ac98ac692271fe) for the auto generated main RT of VPC-VPC-01. The
figure shows that there are no subnets associated with it. To proceed, click the
Create route table button (18).
First, give the name to the route table. Then, select the correct VPC from the drop-
down menu. After choosing the VPC, click the Create route table button. You can
also create new tags for subnets. For example, the tag can describe the purpose of
the route table. As an example, we can add Key = Purpose, Value = NWKT-WEB-
SRV-RT. Note that each tag can have only one value. The maximum length for
key/value pairs is 128/256 characters which are case-sensitive.
Figure 1-29 shows that we have successfully created a new route table rtb-
0fd4639034844c3ea | NWKT-PUB-RT. Now we can do the subnet association. At
the moment, the route table has only one local route.
The Subnet association tab in the route table window (figure 1-30) shows that we
haven't associate subnets to the route table. The next step is to associate our Public
subnet 10.10.0.0/24 with this route table. Click the Edit subnet association button.
Select the subnet NWKT-Pub-euw2c and click the Save association button.
In this section, we create a Subnet with the set of properties and attach it to VPC.
We also specify a Route Table, which we associate with the Subnet using
association.
In our YAML template (figure 1-34), we have four AWS resources (logical name
within parenthesis):
1) AWS::EC2::VPC (NwktVPC)
2) AWS::EC2::Subnet (NwktSubnet)
3) AWS::EC2::RouteTable (NwktPUB2RouteTable)
4) AWS::EC2::SubnetRouteTableAssociation (NwktRouteTableAssociation)
We are using a Ref function for defining the dependencies between AWS resources
when the actual AWS resource Identifier is unknown. For example, the Ref
function in AWS::EC2::Subnet resource [2] refers to the resource AWS::EC2::VPC’s
logical name NwktVPC (A). We have to use an intrinsic function because we don’t
know which VPC Identifier AWS generates to VPC. After creating the subnet, we
specify the subnet-specific Route Table [3]. First, we need to bind it to VPC using
the Ref function value NwktVPC (B). Next, we “glue” the Route Table to Subnet
using RouteTableAssociation, where we use two Ref functions. The first one refers
to Route Table (C), and the second to Subnet (D).
38 Chapter 1: Virtual Private Cloud - VPC
Example 1-10 shows how we upload a locally stored YAML template MyVPC-
Subnet-RT.yml to AWS using the Stack Name My NetworkStack.
In this section, I am going to introduce the default Network ACL for subnets in
VPC NVKT-VPC-01.
Figure 1-37 shows the complete structure of our VPC NVKT-VPC-01. We have a
Public subnet 10.10.0.0/24 in AZ eu-west-2c a Private subnet 10.10.1.0/24 in AZ eu-
west-2a. Both subnets are protected by the default VPC’s NACL named NWKT-
NACL. NACL allows all traffic to and from the subnet by default.
Navigate back to VPC Dashboard and click the Network ACL hyperlink either
from the left or right columns.
AWS Networking Fundamentals 41
Inbound (figure 1-38) and outbound rules (figure 1-39) permit all traffic to and
from the associated subnet. There is also an implicit deny policy rule at the end of
the policy rule. The NACL is processed from the first row until there is a match.
Figure 1-40 shows the Subnet Association. Both our subnets are associated with
NACL by default.
At this phase, the VPC is a closed tenant without Internet GW, NAT GW, or any
other route out from the VPC. However, both subnets have a local route
10.10.0.0/16 in their RT and the NACL that allows all traffic.
The next chapter introduces the Control-Plane (how EC2 instance reachability is
registered to Mapping Service) and Data-Plane operation (the Data-Plane
encapsulation) within VPC.
AWS Networking Fundamentals 43
Introduction
This chapter explains the VPC Control-Plane operation when two EC2 instances
within the same subnet initiate TCP session between themselves. In our example,
EC2 instances are launched in two different physical servers. Both instances have
an Elastic Network Interface (ENI) card. The left-hand side EC2’s ENI has MAC/IP
addresses cafe:0001:0001/10.10.1.11 and the right-hand side EC2’s ENI has MAC/IP
addresses beef:0001:0001/10.10.1.22. Each physical server hosting EC2 instances
has a Nitro Card for VPC [NC4VPC]. It is responsible for routing, data packets
encapsulation/decapsulation, and Traffic limiting. In addition, Security Groups
(SGs) are implemented in hardware on the Nitro card for VPC. AWS Control-Plane
relies on the Mapping Service system decoupled from the network devices. It means
that switches are unaware of Overlay Networks having no state information
related to VPC’s, Subnets, EC2 Instances, or any other Overlay Network
components. From the Control-Plane perspective, physical network switches
participate in the Underlay Network routing process by advertising the
reachability information of physical hosts, Mapping Service, and so on. From the
Data-Plane point of view, they forward packet based on the outer IP header.
Mapping Register
Starting an EC2 instance triggers the Control-Plane process on a host. Figure 2-1
illustrates that Host-1 and Host-2 store information of their local EC2 instances into
the Mapping cache. Then they register these instances into Mapping Service. You
can consider the registration process as a routing update. We need to inform the
Mapping Service about the EC2 instance’s a) MAC/IP addresses bind to ENI, b)
Virtual Network Identifier (=VPC), c) the physical host IP, d) and the encapsulation
mode (VPC tunnel header). If you are familiar with Locator/Id Separation Protocol
LISP, you may notice that its Control-Plane process follows the same principles.
The main difference is that switches in LISP-enabled networks have state
information related to virtual/bare-metal servers running in a virtual network.
44 Chapter 2: VPC Control-Plane
When the EC2 instance Cafe sends data to EC2 instance Beef for the first time, it
sends an ARP Request to resolve the Mac address of IP 10.10.1.22 (1). This event
starts the Control-Plane process. Host-1 first checks its local Mapping Cache. The
result is miss, so it requests MAC/IP address binding and location information
from the Mapping Service (2). Mapping Service processes the request (3) and
replies (4) to Host-1. After receiving the Mapping Reply, Host-1 sends an ARP
Reply message to the EC2 instance Beef. It also stores the information into the local
Mapping Cache. This way, further data flows related to EC2 instance Beef can be
processed without Mapping Request.
Data-Plane Operation
After receiving the ARP-Reply message, EC2 Cafe starts sending data to EC2 Beef.
It wraps the data within Ethernet and IP headers, then it forwards the packet out
of the ENI through the Security Group (allow all) to Nitro Card. Based on the local
Mapping cache, the Nitro card encapsulates the packet with a VPC header, Outer
IP (dst IP 192.168.10.8), and Outer Ethernet header (dst MAC Leaf-1). Then it
forwards the packet to the physical network. Leaf and Spine switches routes packet
towards Host-2 without looking beyond the outer IP header.
When the Nitro Card for VPC in Host-2 receives the packet, it consults the
Mapping Service for validating it. It checks that the source and the destination EC2
instances are in the same VPC. After a positive reply, it decapsulates the packet
and forwards the original packet through the Security Group (SG) attached to EC2
instance Beef. SG is a stateful filter, and in addition to the permit/deny policy rule,
it validates the TCP Sequence Numbers and Ack Numbers.
46 Chapter 2: VPC Control-Plane
The data forwarding from Beef to Cafe follows the same process.
References
Introduction
Figure 3-1: Setting Up an Internet Connection for Public Subnet of AWS VPC.
The first part of the AWS VPC Internet Access includes four steps. First, we create
an Internet Gateway. Then we associate it with our VPC. Third, we add a route
towards IGW into the Subnet Route Table. As the last step, we update the Subnet
NACL if needed. We are using the Default NACL that permits all traffic. Figure 3-
2 illustrates these four steps.
Navigate to the VPC Dashboard. Then select the Internet Gateways either from the
Virtual Private Cloud drop-down menu or from the Resources by Region section.
Figure 3-4 shows that we have a default Internet Gateway. Instead of using it, we
create a new IGW. Click the Create internet gateway button.
Fill the Name tag in the Internet gateway settings section. The name that you give
will be auto-filled as a Key/Value pair in Tag – optional section. To proceed, click
the Create internet gateway button.
Attach the IGW with your VPC by selecting Attach to a VPC from the Actions drop-
down menu or by clicking the Attach to a VPC button in the notification field.
Select our VPC NVKT-VPC-01 from the drop-down menu of the Available VPCs
section.
After selecting the VPC, the AWS Command Line Interface command section
appears. You can choose either Linux or Windows CLI commands to create an
IGW-VPC association. Save the configuration by clicking the Attach internet
gateway button.
Figure 3-8 shows that you have successfully created an Internet Gateway NWKT-
IGW-01 (igw-0e997955bc6597031) and attached into the VPC NVKT-VPC-01 (vpc-
04ef72cc79a73f82e).
AWS Networking Fundamentals 53
Example 3-1 shows how we can verify the Internet Gateway configuration from
the CLI in JSON format.
54 Chapter 3: VPC Internet Gateway
The next thing to do is to add route towards the Internet Gateway into the Subnet
Route Table. Navigate back to the VPC dashboard and select Route Tables. We are
going to update the Route Table NWKT-PUB-RT that is associated with the subnet
10.10.0.0/24 (NWKT-Pub-euw2c | subnet-04af160d1d0aee071).
Figure 3-12 shows that there is only a VPC CIDR range local route in the Route
Table.
You can see the Subnet-specific information by clicking the Explicit subnet
associations hyperlink in the Details window shown in the figure 3-12 above.
Figure 3-13 shows that the Ipv4 CIRD block 10.10.0.0/24. You can navigate back to
Route Table view by clicking the Route Table hyperlink. Click the Edit routes
button to add a new route (figure 3-12).
56 Chapter 3: VPC Internet Gateway
Figure 3-13: Subnet Route Tables – New Route Towards IGW, Subnet Verification.
Add a default route 0.0.0.0/0 to the Destination field. Then select our Internet
Gateway from the Target drop-down menu and click the Save changes button. You
can also preview your changes by clicking the Preview button
Figure 3-15: Subnet Route Tables – New Route Towards IGW - Preview.
AWS Networking Fundamentals 57
After saving the changes the new route is shown in Route Table.
Figure 3-16: Subnet Route Tables – New Route Towards IGW - Completed.
The Subnet association tab shows that this NACL is attached to both subnets
10.10.0.0/24 and 10.10.1.0/24.
The example below shows how you can check the NACL Inbound and Outbound
rules by using the AWS CLI.
+-----------+---------+-----------+--------------+--------------+
Example 3-2: Network Access Control List – Subnet Association.
AWS Networking Fundamentals 59
In the previous section, we create an Internet Gateway for our VPC. We also add a
static route towards IGW into the Route Table of Subnet 10.10.0.0/24. In this
section, we first create a Security Group (SG). The SG allows SSH connection to
the EC2 instance and ICMP from the EC2. Then we launch an EC2 and attach the
previously configure SG to it. As the last step, we allocate an Elastic IP address
(EIP) from the AWS Ipv4 address pool and associate it with the EC instance. When
we are done with all the previous steps, we will test the connection. First, we take
ssh connection from MyPC to EC2. Then, we ping MyPC from the EC2. We also
use AWS Reachability Analyzer to validate the path from IGE to EC2 instance. The
last section introduces AWS billing related to this chapter.
Navigate to the VPC Dashboard. Then select Security Group either from the
Security drop-down menu or Resource by Region section.
60 Chapter 3: VPC Internet Gateway
In the Security Group window, click the Create Security Group button. Note that
the SG DFLT-SECG is the default SG for the default VPC. The two other SGs, in
turn, are default SG for our VPCs.
Fill in the Security Group Name, Description in the Basics details section in
Create security group window. Then select our VPC from the VPC drop-down
menu.
Create an Inbound rule that permits SSH from the external host. Then Create an
Outbound rule that allows all ICMP traffic towards the external host.
You can give a name by editing the Name field. You can also select the Tags tab
and add a new tag with Key/Value pair Name/NWKT-SSH/ICMP-SGT. Click the
Save changes button when done.
Example 3-3 shows the SG in table format on AWS CLI. Note that we are using
Tags Key/Pair values. As a recap, if we don’t use “--output table” option, the
output format is JSON.
------------------------------------------------------
| DescribeSecurityGroups |
+----------------------------------------------------+
|| SecurityGroups ||
|+----------------+---------------------------------+|
|| Description | Permit SSH & Permit ICMP ||
|| GroupId | sg-0e13fbafd10bb59cc ||
|| GroupName | NWKT-SGT-No-01 ||
|| OwnerId | 123456654321 ||
|| VpcId | vpc-04ef72cc79a73f82e ||
|+----------------+---------------------------------+|
||| IpPermissions |||
||+-------------------------------+----------------+||
||| FromPort | 22 |||
||| IpProtocol | tcp |||
||| ToPort | 22 |||
||+-------------------------------+----------------+||
|||| IpRanges ||||
|||+---------------------+------------------------+|||
|||| CidrIp | Description ||||
|||+---------------------+------------------------+|||
|||| 91.152.204.245/32 | SSH from Home PC ||||
|||| 141.192.166.178/32 | SSH from Home PC-new ||||
|||+---------------------+------------------------+|||
||| IpPermissionsEgress |||
||+------------------------------+-----------------+||
||| FromPort | -1 |||
||| IpProtocol | icmp |||
||| ToPort | -1 |||
||+------------------------------+-----------------+||
|||| IpRanges ||||
|||+------------------+---------------------------+|||
|||| CidrIp | 91.152.204.245/32 ||||
|||| Description | ICMP to Home PC ||||
|||+------------------+---------------------------+|||
||| Tags |||
||+-------------+----------------------------------+||
||| Key | Name |||
||| Value | NWKT-SSH/ICMP-SGT |||
||+-------------+----------------------------------+||
Example 3-3: Security Groups – Table Output from AWS CLI.
AWS Networking Fundamentals 65
Navigate to the EC2 Dashboard. Then select the Launch instance button.
I’m using an Amazon Linux 2 (figure 3-30), which is one of the free tier Amazon
Machine Images (AMI). Note that free tier doesn’t always mean free. For example,
the t2.micro instance type is free for one year only with a new AWS account. My
account is more than 12 years old, so the t2.micro is not free.
66 Chapter 3: VPC Internet Gateway
Select the t2.micro. Click the Next: Configure Instance Details button.
Select the VPC and the Subnet where you want to launch the instance. Leave all
other fields with their default options (figures 3-32, 3-33, and 3-34).
We don’t modify the Storage setting or add Tags. Click Next buttons until you end
up on to Configure Security Group page.
Choose the Select an existing security group radio button. Then select the SG
NWKT-SGT-No-01.
Preview your instance setting before launching it. Define the Key pair name and
download it before launching (figure 3-37). You use this keypair name when
connecting to an instance.
Navigate to the EC2 dashboard and select an Elastic IP option from the Security
drop-down menu. Select the eu-west-2 Network Border Group. Click the Amazon’s
pool of Ipv4 address option. Then click the Allocate button.
Figure 3-41 shows that we have successfully allocated a public Ipv4 address
18.134.62.112. The allocation id is eipalloc-01c7d2a4877a061a7. Next, select the
Associate Elastic IP address from the Action drop-down menu.
72 Chapter 3: VPC Internet Gateway
Select the Instance as a resource type. Select our EC2 instance from the Instance
drop-down menu. The Private IP 10.10.10.218 is automatically allocated to the
instance by AWS when we created it. This IP is auto-filled on the Private IP address
field. You can also allow EIP reassociation in this window. As the last step, click
the Associate button.
After association, you will be notified about the successful association (figure 3-
43).
74 Chapter 3: VPC Internet Gateway
Note that the Public DNS (Ipv4) field is empty. That is because when we created
the VPC, we didn’t enable DNS hostname resolution.
Figure 4-46 verifies that now we also have a DNS name for the Public IP address.
To get instructions on how to connect to the selected instance, click the Connect
button. Note that you have to restrict the access permissions of NWKT-EC2-
KEY.pem.
76 Chapter 3: VPC Internet Gateway
The guide in figure 3-47 shows how to do that on Linux. However, it does not tell
how the process is done in Windows.
When you try to connect to EC2 instance when your pem file user access rights are
left to their default settings your connection won’t work. You may receive an error
notification about Unprotected Private Key File (example 3-4).
Figure 3-48: Changing pem File User Access Policy in Windows – Step-1.
Remove all default users from the permission entry. Then add your account to it
with full file permission.
78 Chapter 3: VPC Internet Gateway
Figure 3-49: Changing pem File User Access Policy in Windows – Step-2.
The example below verifies that we also have a connection from the EC2 Instance
to the external host 91.152.204.245.
|||+-------------------------------+--------------------------------------------+|||
|||| State | disabled ||||
|||+-------------------------------+--------------------------------------------+|||
|||| NetworkInterfaces ||||
|||+------------------------+---------------------------------------------------+|||
|||| Description | Primary network interface ||||
|||| InterfaceType | interface ||||
|||| MacAddress | 02:cb:a0:af:b7:a0 ||||
|||| NetworkInterfaceId | eni-07f8f9b7ff3a91f2c ||||
|||| OwnerId | 017857243309 ||||
|||| PrivateDnsName | ip-10-10-0-218.eu-west-2.compute.internal ||||
|||| PrivateIpAddress | 10.10.0.218 ||||
|||| SourceDestCheck | True ||||
|||| Status | in-use ||||
|||| SubnetId | subnet-04af160d1d0aee071 ||||
|||| VpcId | vpc-04ef72cc79a73f82e ||||
|||+------------------------+---------------------------------------------------+|||
||||| Association |||||
||||+----------------+---------------------------------------------------------+||||
||||| IpOwnerId | 123456654321 |||||
||||| PublicDnsName | ec2-18-134-62-112.eu-west-2.compute.amazonaws.com |||||
||||| PublicIp | 18.134.62.112 |||||
||||+----------------+---------------------------------------------------------+||||
||||| Attachment |||||
||||+------------------------------+-------------------------------------------+||||
||||| AttachTime | 2021-10-08T15:37:19.000Z |||||
||||| AttachmentId | eni-attach-06e4d5fc3698f08f6 |||||
||||| DeleteOnTermination | True |||||
||||| DeviceIndex | 0 |||||
||||| Status | attached |||||
||||+------------------------------+-------------------------------------------+||||
||||| Groups |||||
||||+-------------------------+------------------------------------------------+||||
||||| GroupId | sg-0e13fbafd10bb59cc |||||
||||| GroupName | NWKT-SGT-No-01 |||||
||||+-------------------------+------------------------------------------------+||||
||||| PrivateIpAddresses |||||
||||+---------------------+----------------------------------------------------+||||
||||| Primary | True |||||
||||| PrivateDnsName | ip-10-10-0-218.eu-west-2.compute.internal |||||
||||| PrivateIpAddress | 10.10.0.218 |||||
||||+---------------------+----------------------------------------------------+||||
|||||| Association ||||||
|||||+----------------+-------------------------------------------------------+|||||
|||||| IpOwnerId | 123456654321 ||||||
|||||| PublicDnsName | ec2-18-134-62-112.eu-west-2.compute.amazonaws.com ||||||
|||||| PublicIp | 18.134.62.112 ||||||
|||||+----------------+-------------------------------------------------------+|||||
|||| Placement ||||
|||+--------------------------------------------+-------------------------------+|||
|||| AvailabilityZone | eu-west-2c ||||
|||| GroupName | ||||
|||| Tenancy | default ||||
|||+--------------------------------------------+-------------------------------+|||
|||| SecurityGroups ||||
|||+-------------------------+--------------------------------------------------+|||
|||| GroupId | sg-0e13fbafd10bb59cc ||||
|||| GroupName | NWKT-SGT-No-01 ||||
|||+-------------------------+--------------------------------------------------+|||
|||| State ||||
|||+-------------------------------+--------------------------------------------+|||
|||| Code | 16 ||||
AWS Networking Fundamentals 81
Reachability Analyzer
Fill in the name Tag field. Then select the Internet Gateways as Source type. Select
our IGW from the Source drop-down menu. The Destination type is Instance.
Choose our EC2 instance from the Destination drop-down menu. The inbound
security group associated with the EC2 instance allows only SSH connection. SSH
use the destination port is 22, and the transport protocol is TCP. Click Create and
analyze path button after filling all fields.
82 Chapter 3: VPC Internet Gateway
Figure 3-52 shows the progress of Reachability status. The Reachability status field
turns to Reachable, and the State field shows Succeeded.
AWS Networking Fundamentals 83
Billing
The last but not least subject is billing. Figure 3-54 summarizes the cost
components for our example environment. Note that AWS charges $0.1 per Path
Analysis. Running t2.micro is not expensive. It has been running for 61 hours
which costs only 0.81$. It means approximately 10 €/month.
Introduction
Back-End EC2 instances like Application and Database servers are most often
launched on a Private subnet. As a recap, a Private subnet is a subnet that doesn’t
have a route to the Internet Gateway in its Route table. Besides, EC2 instances in
the Private subnet don’t have Elastic-IP address association. These two facts mean
that EC2 instances on the Private subnet don’t have Internet access. However,
these EC2 instances might still need occasional Internet access to get firmware
upgrades from the external source. We can use a NAT Gateway (NGW) for
allowing IPv4 Internet traffic from Private subnets to the Internet. When we launch
an NGW, we also need to allocate an Elastic-IP address (EIP) and associate it with
the NGW. This association works the same way as the EIP-to-EC2 association. It
creates a static NAT entry to IGW that translates NGW’s local subnet address to
its associated EIP. The NGW, in turn, is responsible for translating the source IP
address from the ingress traffic originated from the Private subnet to its local
subnet IP address. As an example, EC2 instance NWKT-EC2-Back-End sends
packets towards the Internet to NGW. When the NGW receives these packets, it
rewrites the source IP address 10.10.1.172 with its Public subnet IP address
10.10.0.195 and forwards packets to the Internet gateway. IGW translates the
source IP address 10.10.0.195 to EIP 18.132.96.95 (EIP associated with NGW). That
means that the source IP of data is rewritten twice, first by NGW and then by IGW.
Figure 4-1 illustrates our example NAT GW design and its configuration steps. As
a pre-task, we launch an EC2 instance on the Private subnet 10.10.1.0/24 (1). We
also modify the existing Security Group (SG) to allow an Inbound/Outbound
ICMP traffic within VPC CIDR 10.10.0.0/16 (2). We also allow an SSH session
initiation from the 10.10.0.218/24. I’m using the same SG for both EC2 instances to
keep things simple. Besides, both EC2 uses the same Key Pair. Chapter 3 shows
how to launch an EC2 instance and how we modify the SGs, and that is why we
go ahead straight to the NGW configuration.
When we have done pre-tasks, we launch an NGW on the Public subnet (3). Then
we allocate an EIP and associate it with NGW (4). Next, we add a default route
towards NGW on the Private subnet Route Table (5).
The last three steps are related to connectivity testing. First, verify Intra-VPC IP
connectivity using ICMP (6). Then we test the Internet connectivity (7). As the last
88 Chapter 4: VPC NAT Gateway
step, we can confirm that no route exists back to NWKT-EC-Back-End from the
IGW. We are using an AWS Path Analyzer for that (8).
Note! Our example doesn’t follow good design principles. AWS Availability Zones
(AZ) are restricted failure domains, which means that failure in one AZ doesn’t
affect the operation of another AZ. Now, if our NGW on AZ eu-west-2c fails,
Internet traffic from the Private subnet on eu-west2a fails. The proper design is to
launch NGW on the AZ where unidirectional egress Internet access is needed.
We don’t have any NGW at this phase. Click the Create NAT gateway button.
Fill in the optional Name field. It creates a Key/Value Pair where the key is Name
and the Value NWKT-NAT-GW. Select the Private subnet NWKT-Pub-euw2c
(subnet-04af160d1d10aee071). We have two options for the Connectivity option.
Using the default option Public, we allow EC2 instances from Private subnets gets
uni-directional, stateful connection to the Internet. That means that they are not
accessible from the Internet. The public option requires an Elastic IP address. The
Private option allows connection from the Private subnet to on-prem resources,
either via Transit Gateway or Virtual Private Gateway. You can’t associate EIP
with Private NGW. Select the Public option. Then click the Allocate Elastic IP
address button. Figure 4-5 shows that AWS has allocated the EIP allocation Id
eipalloc-0cda321ba6a5c5e06. Click the Create NAT gateway button to launch the
NGW.
Figure 4-6 shows that the State of the process is Pending. Our NGW Id is nat-
0cb51f58d75940a28. At this phase, the EIP, Private IP address, and Network Id are
not visible.
After the state is changed to Available, we can see the allocated EIP (18.132.96.65),
the Private IP address (10.10.0.195), and the Elastic Network Interface Id (eni-
0efe78e391410c31f).
|| NetworkInterfaceId | eni-07f8f9b7ff3a91f2c ||
|| NetworkInterfaceOwnerId | 123456654321 ||
|| PrivateIpAddress | 10.10.0.218 ||
|| PublicIp | 18.134.62.112 ||
|| PublicIpv4Pool | amazon ||
|+--------------------------+------------------------------+|
||| Tags |||
||+-----------------+-------------------------------------+||
||| Key | Name |||
||| Value | NWKT-PUBLIC-IP |||
||+-----------------+-------------------------------------+||
Example 4-2: Elastic IP Address Allocation.
Next, we add the default route to the Route Table. Click the Edit routes button.
Fill in the Destination field with 0.0.0.0/0. Then select NAT Gateway from the
Target drop-down menu.
Select our NAT Gateway from the list and click the Save changes button.
Test Connections
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-10-10-0-218 ~]$
[ec2-user@ip-10-10-0-218 ~]$ ping 10.10.1.176
PING 10.10.1.176 (10.10.1.176) 56(84) bytes of data.
64 bytes from 10.10.1.176: icmp_seq=1 ttl=255 time=3.27 ms
64 bytes from 10.10.1.176: icmp_seq=2 ttl=255 time=0.983 ms
^C
--- 10.10.1.176 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.983/2.129/3.275/1.146 ms
As the last step, we use the Reachability Analyzer tool to confirm that the instance
NWKT-EC2-Back-End is not reachable from the Internet. We are using IGW as a
source and the instance NWKT-EC2-Back-End as the destination. The destination
port is 22 and protocol TCP.
Billing
Figure 4-14 shows a detailed report of our costs so far. It is self-explanatory, and I
won’t go through it in detail.
Introduction
Figure 5-1 illustrates our example environment where we have a Corporate on-
prem Datacenter and virtual Datacenter NVKT-VPC-01 in the AWS region eu-
west-2 (London). Our intent is to build a VPN connection between these two sites
to establish a secure IP connection between EC2 instances within VPC and subnet
172.16.10.0/24 in on-prem DC. First, we need to create Customer Gateway (CGW)
and Virtual Private Gateway (VGW). Then we attach VGW into the VPC and
enable route propagation from subnet NWKT-PUB-RT Route Table to BGP
process. After these steps, we can set up a VPN connection between VGW and
CGW. As the last step, we download an AWS-generated CGW configuration file.
After filling in the local Interface/IP address information, we can upload the
configuration into the CGW.
104 Chapter 5: Virtual Private Gateway - VGW
Create CGW
Fill in the name field and select the routing model. We are using dynamic routing
with BGP. Define the AS number attached to our on-prem Datacenter, and then fill
in the IP address. Click the Create Customer Gateway button to proceed.
You will get a notification about the successful CGW creation process and the
auto-generated CGW Id. Click the Close button.
You will be forwarded to CGW view After clicking the Close button. Details tab
shows the CGW Id cgw-001e84c95e7e98a57, Type IPSec, BGP ASN 65123, State
Available and the IP address 91.153.26.147.
Create CGW
Navigate to the VPC dashboard and select the Virtual Private Gateways option
(figure 5-3 in previous section).
Fill in the name field and select the Amazon default ASN radio button. You can
also define your preferred BGP ASN. After clicking the Create Virtual Private
Gateway button, the AWS console notifies you about the successful process. Click
the Close button.
The Details tab in Figure 5-11 shows the CGW that VGW the State is detached
and the VPC field is empty. Select the Attach to VPC option from the Actions
drop-down menu.
AWS Networking Fundamentals 111
Select our VPC vpc-04ef72cc79a73f82e from the VPC drop-down menu. When
you open the drop-down menu, each VPC is listed with its name, so you don’t
have to remember the VPC Id. Next, click the Yes, Attach button.
Figures 5-13 and 5-14 show the process. The state is first attaching, and then after
a while, it turns to attached. Also, the VPC field shows the attached VPC with its
name tag.
112 Chapter 5: Virtual Private Gateway - VGW
We are using a BGP for route advertisement over a VPN connection. Route Table
Propagation defines the Route Table which routes we want VGW to advertise to
on-prem CGW.
Navigate to the Route Table window (shown in Chapter 1, figure 1-26) and select
Route table. Choose the Edit route propagation option from the Actions drop-
down menu.
Figure 5-18 shows that we have successfully updated route table route
propagation.
VPN Connection
Navigate to the VPC dashboard (figure 5-3) and select Site-to-Site VPN
Connections. Next, click the Create VPN Connection button.
Fill in the Name tag field. Select VGW vgw-05db8bcc160d0d77f from the Virtual
Private Gateway drop-down menu, and cgw-001e884c95e7e98a57 from the Customer
Gateway ID drop-down menu. Note that Name tags for both VGW and CGW are
shown in drop-down menus, so you don’t have to remember their Ids. Select the
Dynamic (requires BGP) option as Routing Options and the IPv4 as Tunnel Inside
Ip version. You can define subnets for both Local and Remote IPv4 Network CIDR
fields. We use default CIDR 0.0.0.0/0. By doing this, the VGW will advertise all
routes that we propagate from the Subnet Route Table (10.10.0.0/24). From the
CGW point of view, this generates a BGP configuration where advertises a default
route 0.0.0.0/0. We will change this later when we edit the configuration file.
Inside IPv4 CIDR for both tunnels is generated by Amazon. The same applies to
Pre-Shared keys. To proceed, click the Create VPN Connection.
The AWS Console shows the notification about the successful VPN creation
process. Click the Close button.
The Detail tab in figure 5-24 shows the Id of VPN connection and its configuration
parameters. It might take several minutes before the state is changed from pending
to available (figure 5-25).
118 Chapter 5: Virtual Private Gateway - VGW
CGW Configuration
We can download the CGW configuration after configuring the VPN connection
parameter by clicking the Download Configuration button in the VPN Connection
window (Figure 5-25 on the previous page). The file includes all configurations
with detailed explanations related to the VPN connection. We only to specify our
CGW’s local Interface (or IP address) information related to Crypto Key Ring,
ISAKMP Profile, and tunnel source address. Among these changes, we will
configure BGP to advertise the subnet 172.16.10.0/24. After modifying the CGW
configuration file, we can copy the configuration to CGW.
Select the Download Configuration button on a top bar on the VPN window
(figure 5-25). Our Customer Gateway (CGW) is a Cisco CSR1000v (IOS-XE 16.6).
Select Vendor, Platform, Software, and IKE from the respective drop-down menus.
Then, click the Download button.
120 Chapter 5: Virtual Private Gateway - VGW
Example 5-1 shows the Amazon auto-generated CGW configuration for CSR1000v
based on what we specified during the VGW, CGW, and VPN connection. I have
changed the font type of instructions and highlighted the configuration part.
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
! #1: Internet Key Exchange (IKE) Configuration
!
! A policy is established for the supported ISAKMP encryption,
! authentication, Diffie-Hellman, lifetime, and key parameters.
! Please note, these sample configurations are for the minimum requirement of AES128, SHA1, and DH Group 2.
! Category "VPN" connections in the GovCloud region have a minimum requirement of AES128, SHA2, and DH Group
14.
AWS Networking Fundamentals 121
! You will need to modify these sample configuration files to take advantage of AES256, SHA256, or other DH groups
like 2, 14-18, 22, 23, and 24.
! NOTE: If you customized tunnel options when creating or modifying your VPN connection, you may need to modify
these sample configurations to match the custom settings for your tunnels.
!
! Higher parameters are only available for VPNs of category "VPN," and not for "VPN-Classic".
! The address of the external interface for your customer gateway must be a static address.
! Your customer gateway may reside behind a device performing network address translation (NAT).
! To ensure that NAT traversal (NAT-T) can function, you must adjust your firewall !rules to unblock UDP port 4500.
| If not behind NAT, and you are not using an Accelerated VPN, we recommend disabling NAT-T. If you are using an
Accelerated VPN, make sure that NAT-T is enabled.
!
! Note that there are a global list of ISAKMP policies, each identified by
! sequence number. This policy is defined as #200, which may conflict with
! an existing policy using the same number. If so, we recommend changing
! the sequence number to avoid conflicts.
!
crypto isakmp policy 200
encryption aes 128
authentication pre-share
group 2
lifetime 28800
hash sha
exit
! The ISAKMP keyring stores the Pre Shared Key used to authenticate the
! tunnel endpoints.
!
crypto keyring keyring-vpn-090d5536c0b79203c-0
local-address <interface_name/private_IP_on_outside_interface>
pre-shared-key address 3.9.101.25 key I.hav3_Chang3d_This.Key4Security
exit
! The IPSec profile references the IPSec transform set and further defines
! the Diffie-Hellman group and security association lifetime.
!
crypto ipsec profile ipsec-vpn-090d5536c0b79203c-0
122 Chapter 5: Virtual Private Gateway - VGW
! Additional parameters of the IPSec configuration are set here. Note that
! these parameters are global and therefore impact other IPSec
! associations.
! This option instructs the router to clear the "Don't Fragment"
! bit from packets that carry this bit and yet must be fragmented, enabling
! them to be fragmented.
!
crypto ipsec df-bit clear
! This option enables IPSec Dead Peer Detection, which causes periodic
! messages to be sent to ensure a Security Association remains operational.
! If you are using Accelerated AWS VPN, please configure periodic Dead Peer Detection.
! isakmp keepalive threshold 10 retry 10 periodic
!
crypto isakmp keepalive 10 10
! --------------------------------------------------------------------------------
! #3: Tunnel Interface Configuration
!
! A tunnel interface is configured to be the logical interface associated
! with the tunnel. All traffic routed to the tunnel interface will be
! encrypted and transmitted to the VPC. Similarly, traffic from the VPC
! will be logically received on this interface.
!
! Association with the IPSec security association is done through the
! "tunnel protection" command.
!
! The address of the interface is configured with the setup for your
! Customer Gateway. If the address changes, the Customer Gateway and VPN
! Connection must be recreated with Amazon VPC.
!
interface Tunnel1
ip address 169.254.88.242 255.255.255.252
ip virtual-reassembly
tunnel source <interface_name/private_IP_on_outside_interface>
tunnel destination 3.9.101.25
tunnel mode ipsec ipv4
tunnel protection ipsec profile ipsec-vpn-090d5536c0b79203c-0
! This option causes the router to reduce the Maximum Segment Size of
! TCP packets to prevent packet fragmentation.
ip tcp adjust-mss 1379
no shutdown
exit
AWS Networking Fundamentals 123
! --------------------------------------------------------------------------------
!
crypto isakmp policy 201
encryption aes 128
authentication pre-share
group 2
lifetime 28800
hash sha
exit
! The ISAKMP keyring stores the Pre Shared Key used to authenticate the
! tunnel endpoints.
!
crypto keyring keyring-vpn-090d5536c0b79203c-1
local-address <interface_name/private_IP_on_outside_interface>
pre-shared-key address 35.177.110.203 key 1.have_Changed_This.K3y45ecurity
exit
! The IPSec profile references the IPSec transform set and further defines
! the Diffie-Hellman group and security association lifetime.
!
crypto ipsec profile ipsec-vpn-090d5536c0b79203c-1
set pfs group2
set security-association lifetime seconds 3600
set transform-set ipsec-prop-vpn-090d5536c0b79203c-1
exit
! Additional parameters of the IPSec configuration are set here. Note that
! these parameters are global and therefore impact other IPSec
! associations.
! This option instructs the router to clear the "Don't Fragment"
! bit from packets that carry this bit and yet must be fragmented, enabling
! them to be fragmented.
!
crypto ipsec df-bit clear
! This option enables IPSec Dead Peer Detection, which causes periodic
! messages to be sent to ensure a Security Association remains operational.
! If you are using Accelerated AWS VPN, please configure periodic Dead Peer Detection.
AWS Networking Fundamentals 125
! --------------------------------------------------------------------------------
! #3: Tunnel Interface Configuration
!
! A tunnel interface is configured to be the logical interface associated
! with the tunnel. All traffic routed to the tunnel interface will be
! encrypted and transmitted to the VPC. Similarly, traffic from the VPC
! will be logically received on this interface.
!
! Association with the IPSec security association is done through the
! "tunnel protection" command.
!
! The address of the interface is configured with the setup for your
! Customer Gateway. If the address changes, the Customer Gateway and VPN
! Connection must be recreated with Amazon VPC.
!
interface Tunnel2
ip address 169.254.159.58 255.255.255.252
ip virtual-reassembly
tunnel source <interface_name/private_IP_on_outside_interface>
tunnel destination 35.177.110.203
tunnel mode ipsec ipv4
tunnel protection ipsec profile ipsec-vpn-090d5536c0b79203c-1
! This option causes the router to reduce the Maximum Segment Size of
! TCP packets to prevent packet fragmentation.
ip tcp adjust-mss 1379
no shutdown
exit
! --------------------------------------------------------------------------------
!
router bgp 65123
neighbor 169.254.159.57 remote-as 64512
neighbor 169.254.159.57 activate
neighbor 169.254.159.57 timers 10 30 30
address-family ipv4 unicast
neighbor 169.254.159.57 remote-as 64512
neighbor 169.254.159.57 timers 10 30 30
neighbor 169.254.159.57 default-originate
neighbor 169.254.159.57 activate
neighbor 169.254.159.57 soft-reconfiguration inbound
! To advertise additional prefixes to Amazon VPC, copy the 'network' statement
! and identify the prefix you wish to advertise. Make sure the prefix is present
! in the routing table of the device with a valid next-hop.
network 0.0.0.0
exit
exit
!
! Additional Notes and Questions
! - Amazon Virtual Private Cloud Getting Started Guide:
! http://docs.amazonwebservices.com/AmazonVPC/latest/GettingStartedGuide
! - Amazon Virtual Private Cloud Network Administrator Guide:
! http://docs.amazonwebservices.com/AmazonVPC/latest/NetworkAdminGuide
NWKT-WAN-Edge01#sh run
Building configuration...
<snipped>
!
hostname NWKT-WAN-Edge01
!
<snipped>
!
crypto pki trustpoint TP-self-signed-1949931239
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-1949931239
revocation-check none
rsakeypair TP-self-signed-1949931239
!
!
crypto pki certificate chain TP-self-signed-1949931239
!
<snipped>
!
crypto keyring keyring-vpn-090d5536c0b79203c-1
local-address GigabitEthernet1
pre-shared-key address 35.177.110.203 key I.hav3_Chang3d_This.Key4Security
crypto keyring keyring-vpn-090d5536c0b79203c-0
local-address GigabitEthernet1
pre-shared-key address 3.9.101.25 key I.hav3_Chang3d_This.Key4Security
!
crypto isakmp policy 200
AWS Networking Fundamentals 127
encr aes
authentication pre-share
group 2
lifetime 28800
!
crypto isakmp policy 201
encr aes
authentication pre-share
group 2
lifetime 28800
crypto isakmp keepalive 10 10
crypto isakmp profile isakmp-vpn-090d5536c0b79203c-0
keyring keyring-vpn-090d5536c0b79203c-0
match identity address 3.9.101.25 255.255.255.255
local-address GigabitEthernet1
crypto isakmp profile isakmp-vpn-090d5536c0b79203c-1
keyring keyring-vpn-090d5536c0b79203c-1
match identity address 35.177.110.203 255.255.255.255
local-address GigabitEthernet1
!
crypto ipsec security-association replay window-size 128
!
crypto ipsec transform-set ipsec-prop-vpn-090d5536c0b79203c-0 esp-aes esp-sha-hmac
mode tunnel
crypto ipsec transform-set ipsec-prop-vpn-090d5536c0b79203c-1 esp-aes esp-sha-hmac
mode tunnel
crypto ipsec df-bit clear
!
!
crypto ipsec profile ipsec-vpn-090d5536c0b79203c-0
set transform-set ipsec-prop-vpn-090d5536c0b79203c-0
set pfs group2
!
crypto ipsec profile ipsec-vpn-090d5536c0b79203c-1
set transform-set ipsec-prop-vpn-090d5536c0b79203c-1
set pfs group2
!
interface Loopback172
ip address 172.16.10.1 255.255.255.0
!
interface Tunnel1
ip address 169.254.88.242 255.255.255.252
ip tcp adjust-mss 1379
tunnel source GigabitEthernet1
tunnel mode ipsec ipv4
tunnel destination 3.9.101.25
tunnel protection ipsec profile ipsec-vpn-090d5536c0b79203c-0
ip virtual-reassembly
!
interface Tunnel2
ip address 169.254.159.58 255.255.255.252
ip tcp adjust-mss 1379
tunnel source GigabitEthernet1
tunnel mode ipsec ipv4
tunnel destination 35.177.110.203
tunnel protection ipsec profile ipsec-vpn-090d5536c0b79203c-1
ip virtual-reassembly
!
!
router bgp 65123
bgp log-neighbor-changes
neighbor 169.254.88.241 remote-as 64512
128 Chapter 5: Virtual Private Gateway - VGW
Tunnel Verification
Example 5-4 shows detailed information about Tunnel 1. We can see that the
destination IP address is 3.9.101.25, and we have bound the IPSec profile ipsec-
vpn-090d5536c0b79203c-0, which defines the encryption and authentication
algorithms used with this tunnel interface.
Example 5-5 shows detailed information about Tunnel 2. We can see that the
destination IP address is 35.177.110.203, and we have bound the IPSec profile
ipsec-vpn-090d5536c0b79203c-1, which defines the encryption and authentication
algorithms used with this tunnel interface.
Example 5-6 shows that we have attached IPSec transform set ipsec-prop-vpn-
090d5536c0b79203c-0 to IPSec profile ipsec-vpn-090d5536c0b79203c-0 (attached to
Tunnel 1). It also shows that we have attached IPSec transform set ipsec-prop-vpn-
090d5536c0b79203c-1 to IPSec profile ipsec-vpn-090d5536c0b79203c-2 (attached to
Tunnel 2).
Example 5-8 shows our ISAKMP Profiles. The first profile is bound to local
interface GigabitEthernet 1 and remote peer 3.9.101.25/32 (Tunnel 1). Key Ring
keyring-vpn-090d5536c0b79203c-0 defines the pre-share key we are using with this
remote peer. The second profile is also bound to the local interface GigabitEthernet
1 but to remote IP address 35.177.110.203/32 (Tunnel 2). Key Ring keyring-vpn-
090d5536c0b79203c-1 defines the pre-share key we are using with this remote peer.
Figure 5-28 shows that both tunnels used for VPN NWKT-HQ-VPC01 are up on
the VGW.
Control-Plane Verification
Example 5-9 shows that NWKT-WAN-Edge01 has two BGP peers. It has received
one prefix from both peers.
Example 5-10 shows the BGP table of NWKT-WAN-Edge01. It verifies that it has
chosen a route via 169.254.88.241 as the best path due to the lower metric value
(100). That illustrates that VGW uses metric 100 (carried within MED path
attribute) to BGP updates sent over Tunnel 1 and metric 200 to BGP updates sent
over Tunnel 2. To avoid asymmetric routing, we can use the same BGP egress
policy signaling by setting the lower MED for BGP Updates sent over Tunnel 1 and
higher metric for BGP Updates sent over Tunnel 2. We can also use BGP AS-Path
prepending for BGP Updates sent over Tunnel 2. Note that MED and AS-Path
prepending is the only option for BGP traffic engineering that VGW accepts.
NWKT-WAN-Edge01#show ip bgp
BGP table version is 6, local router ID is 192.168.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Example 5-11 shows that NWKT-WAN-Edge01 has installed only the best BGP
route from the BGP table to the routing table. BGP also supports flow-based ECMP
(Equal Cost Multi-Path), and we can implement it on CGW CSR1000v. However,
AWS VGW doesn’t use ECMP. That is why we don’t use BGP ECMP on CGW
either.
Figure 5-29 shows verifies that the Route Table NWKT-PUB-RT has received route
to 172.16.10.0/24 from the VGW.
Data-Plane Verification
Example 5-12 verifies that the Data-Plane is working. We can ping from CGW to
EC2 instance 10.10.0.218 in VPC using the IP address 172.16.10.1 (loopback 172) as
a source IP.
Billing
Figure 5-30 summarizes the costs so far. We started the first billable component
(Linux t2.micro instance with EIP) 285 hours ago (11 days). We also use NAT GW
for Internet access to the t2.micro launched on private subnets (I have deleted those
later). We have also run an AWS Reachability Analyzer four times. There is also a
small fee for a VPN connection. Note that our data transfer is based on a couple of
ssh connection and ICMP request/reply. That is why there are no data transfer fees
on the bill. The total cost so far is only 8.83$, which in my mind is a reasonable
amount.
Introduction
Figure 6-1 illustrates our example Transit Gateway implementation. We have three
VPCs, with each having one subnet. The subnet in the left-most VPC, NWKT-Prod,
is a public subnet allowing instances to use Internet Gateway for Internet access.
Both subnets 10.11.0.0/24 and 10.12.0.0/24 in VPCs NWKT-Test and NWKT-Dev
are private subnets without Internet access. We are going to implement Transit
Gateway into AWS and attach all three VPCs to it. We will also establish a VPN
connection between TGW and CGW to allow on-prem Datacenter connection to
EC2 instances on each VPC.
You can have five TGWs per account (adjustable) and five TGWs per VPC. A TGW
can have 5000 attachments by default (adjustable). The maximum bandwidth per
VPC is 50 Gbps (non-adjustable). One VPN attachment support 5 000 000 packets
per second. The maximum bandwidth per VPN Tunnel is 1,25 Gbps with up to
140 000 packets per second. TGW supports ECMP over VPN, which gives you 2,5
Gbps per VPN and 280 000 packets per second.
AWS Networking Fundamentals 139
First, we launch a Transit Gateway (1). Then we create VPC attachments for all
three VPCs (2). Third, static routes to subnet-specific Route Tables on each VPCs
(3). The Next-Hop (NH) for a default route is TGW on subnets NWKT-Test
10.11.0.0/24 and NWKT-Prod 10.12.0.0/24, while in subnet NWKT-Prod
10.10.0.0/24 Next-hop is IGW. The Next-Hop for the destination network
172.16.10.0/24 (on-prem DC subnet) in subnet NWKT-Prod 10.10.0.0/24 is TGW.
This routing policy allows both Inter-VPC and VPC to on-prem DC
communication.
Launch TGW
Figures 6-5 and 6-6 are in the same view in the AWS Console. Fill in the Name
tag field. You can select the BGP ASN number by yourself. In this example, we
are letting Amazon assign its default ASN (64512). Leave all other settings and
selections to their defaults. Click the Create transit gateway button.
AWS Console notifies you about successful TGW creation. The state is first
Pending (figure 6-7). When the TGW is up and running, the stage changes to
Available (figure 6-8).
AWS Networking Fundamentals 143
Navigate back to the VPC Dashboard and select the Transit Gateway Attachment
hyperlink. Then select the Create transit gateway attachment button.
Figures 6-10, 6-11, and 6-12 are in the same console view. Fill in the optional Name
tag field. Then select our previously created Transit Gateway NWKT-TGW (tgw-
0b6f676661e3e8237) from the Transit gateway ID drop-down menu (figure 6-9) and
select VPC as an attachment type. Select VPC NWKT-Prod (vpc-
04ef72cc79a73f82e) from the VPC ID drop-down menu. Connect TGW to the
Availability Zone (AZ) eu-west-2c and select the only available subnet NWKT-
Prod (subnet-04af160d1d0aee071). Then click the Create transit gateway attachment
button. Do the same association process also for VPC NWKT-Test and NWKT-
Dev.
AWS Networking Fundamentals 145
Figure 6-13 verifies that we have successfully attached VPC NWKT-Prod (vpc-
04ef72cc79a73f82e) to NWKT-TGW (tgw-0b6f676661e3e8237) by using the subnet
NWKT-Prod (subnet-04af160d1d0aee071) as an attachment point. We also attach
two other VPC to TGW by using the same method.
After attaching all three VPC to TGW, we can verify that routes TGW have
propagated VPC CIDRs into the Route Table. To do that, navigate to the TGW
Route table window. I have named the default TGW Route Table to TGW-MAIN-
RT.
The association tab shows Attachment Id, Attachment VPC, attached Resource
Id, and the state (figure 6-15). The first Attachment Id, ending digits 88c1, is the
VPC NWKT-Test attachment. The second one is the VPC NWKT-Dev attachment.
The last one is the VPC NWKT-Prod attachment.
The Propagations tab shows that the propagation is enabled in each of three
attachments. This means that TGW will add CIDR ranges of VPCs into the
associated Route Table. TGW installs CIDRs into the default Route Table of TGW.
However, you can create additional Route Tables based on your segmentation
policy and associate CIDRs with those.
The information in the Routes tab verifies that the route propagation works. TGW
has installed all three VPC-specific CIDRs ranges into the default Route Table.
Figure 6-17 shows that the Next-Hop for the CIDR 10.10.0.0/16 is attachment
ending digits 800d7, and the CIDR is owned by VPC NWKT-Test (last digits
73f82e).
150 Chapter 6: Transit Gateway
As the next step, we update subnet-specific Route Tables in within each VPC.
Figure 6-18 shows the NWKT-Prod-RT where we have associated the subnet
NWKT-Prod (10.10.0.0/24) before adding a route to TGW. Figure 6-19 illustrates
the same Route Table after the update. The TGW is the Next-Hop for both subnets
10.11.0.0/24 and 10.12.0.0/24, while the IGW is the Next-Hop for all other
destinations. Note that we haven’t set up a VPN connection to the on-prem
Datacenter yet. That is why we haven’t added a route to network 172.16.10.0/24 at
this phase.
Example 6-1 shows how we can verify VPC to TGW attachments by using AWS
CLI command.
------------------------------------------------------------------
| DescribeTransitGatewayVpcAttachments |
+----------------------------------------------------------------+
|| TransitGatewayVpcAttachments ||
|+-----------------------------+--------------------------------+|
|| CreationTime | 2021-10-24T07:53:42.000Z ||
|| State | available ||
|| TransitGatewayAttachmentId | tgw-attach-029987148a6e800d7 ||
|| TransitGatewayId | tgw-0b6f676661e3e8237 ||
|| VpcId | vpc-04ef72cc79a73f82e ||
|| VpcOwnerId | 123456654321 ||
|+-----------------------------+--------------------------------+|
||| Options |||
||+----------------------------------+-------------------------+||
||| DnsSupport | enable |||
||| Ipv6Support | disable |||
||+----------------------------------+-------------------------+||
||| SubnetIds |||
||+------------------------------------------------------------+||
||| subnet-04af160d1d0aee071 |||
||+------------------------------------------------------------+||
||| Tags |||
||+--------------------+---------------------------------------+||
||| Key | Name |||
||| Value | tgw-vpc-Prod |||
||+--------------------+---------------------------------------+||
|| TransitGatewayVpcAttachments ||
|+-----------------------------+--------------------------------+|
|| CreationTime | 2021-10-24T07:55:56.000Z ||
|| State | available ||
|| TransitGatewayAttachmentId | tgw-attach-09c66a4def88488c1 ||
|| VpcId | vpc-0a2c6c297c4562f11 ||
|| VpcOwnerId | 123456654321 ||
|+-----------------------------+--------------------------------+|
||| Options |||
||+----------------------------------+-------------------------+||
||| DnsSupport | enable |||
||| Ipv6Support | disable |||
152 Chapter 6: Transit Gateway
||+----------------------------------+-------------------------+||
||| SubnetIds |||
||+------------------------------------------------------------+||
||| subnet-0af695139fdb5dcdd |||
||+------------------------------------------------------------+||
||| Tags |||
||+---------------------+--------------------------------------+||
||| Key | Name |||
||| Value | tgw-vpc-Dev |||
||+---------------------+--------------------------------------+||
|| TransitGatewayVpcAttachments ||
|+-----------------------------+--------------------------------+|
|| CreationTime | 2021-10-24T07:55:18.000Z ||
|| State | available ||
|| TransitGatewayAttachmentId | tgw-attach-0c134eb4773d8485b ||
|| TransitGatewayId | tgw-0b6f676661e3e8237 ||
|| VpcId | vpc-0867c98f35d11fcdd ||
|| VpcOwnerId | 123456654321 ||
|+-----------------------------+--------------------------------+|
||| Options |||
||+----------------------------------+-------------------------+||
||| DnsSupport | enable |||
||| Ipv6Support | disable |||
||+----------------------------------+-------------------------+||
||| SubnetIds |||
||+------------------------------------------------------------+||
||| subnet-0f9fb0b5459ab07b4 |||
||+------------------------------------------------------------+||
||| Tags |||
||+--------------------+---------------------------------------+||
||| Key | Name |||
||| Value | tgw-vpc-Test |||
||+--------------------+---------------------------------------+||
Example 6-1: VPC to TGA Attachment Verification from the AWS CLI.
Data-Plane Testing
Next, we build a VPN connection between Transit Gateway (TGW) and pre-
defined Customer Gateway (CGW). The first step is to create a VPN attachment
and define the CGW in TGW. After that, we configure the on-prem Datacenter
WAN-Edge-01 (our CGW) routers’ IPSec and BGP settings based on the
configuration file generated during the TGW VPN configuration. The previous
chapter explained the file download process.
Figure 6-20: VPN Connection Between the Transit Gateway and the Customer Gateway.
154 Chapter 6: Transit Gateway
VPN connection configuration follows the same principles that we used when we
attach VPCs to TGW. First, select the TGW from the Transit gateway ID drop-
down menu. Then we choose the Attachment type from the Attachment type VPN
drop-down menu. Next, we choose our pre-created CGW from the Customer
gateway ID drop-down menu. In order to send BGP Update messages about
CIDRs installed into TGWs Route Table (the one we are using with the VPN =
default), we need to select the Dynamic Routing options.
Figure 6-21: Configuring VPN Between TGW and CGW – Endpoints and Routing.
AWS Networking Fundamentals 155
Figure 6-22: Configuring VPN Between TGW and CGW – Tunnel settings.
You will get a notification about successful VPN attachment. Figure 6-23 shows
that VPN resource vpn-0fbe1650a4800b827 is attached to TGW tgw-
0b6f676661e3e8237 using an attachment tgw-attach-0e4c3f46c77a508c1. VPN is
associated with TGWs main Route Table tgw-trb-0a53e2ba10b858708 (TGW routes
ingress packets from VPN attachment based main Route Table).
156 Chapter 6: Transit Gateway
Figure 6-24 shows that we have configured a VPN connection between TGW and
CGW and its state available. It also shows the CGW's public IP address, and that
we are using a pre-shared key for authentication. Local and remote IPv4 CIDRs are
set to 0.0.0.0/0. We can change CIDRs, if needed, by choosing the Modify VPN
Connection Options from the Action drop-down menu. Figure 6-26 and 6-27 shows
the process. If you change the CIDRs, download the CGW configuration after you
have done modifications.
Figure 6-24: Configuring VPN Between TGW and CGW – VPN Status on TGW.
We haven’t configured the CGW device in on prem-DC at this phase, and that is
why both tunnels are down.
Figure 6-25: Configuring VPN Between TGW and CGW – Tunnel Status: Down.
158 Chapter 6: Transit Gateway
Figure 6-26: Configuring VPN Between TGW and CGW – Modifying CIDRs.
Figure 6-27: Configuring VPN Between TGW and CGW – Modifying CIDRs.
AWS Networking Fundamentals 159
Example 6-3 shows the CGW configuration. Chapter 5 explained how you can
download the configuration.
NWKT-WAN-Edge-01
!
crypto keyring keyring-vpn-0fbe1650a4800b827-1
local-address GigabitEthernet1
pre-shared-key address 35.178.156.2 key _7NsYsj7vd0MeKuCZZGDThtsyajxwisT
crypto keyring keyring-vpn-0fbe1650a4800b827-0
local-address GigabitEthernet1
pre-shared-key address 35.177.77.134 key GdOrYGG3jvzCAYlXhhYDcFuuO1VD4RFu
!
crypto isakmp policy 200
encr aes
authentication pre-share
group 2
lifetime 28800
!
crypto isakmp policy 201
encr aes
authentication pre-share
group 2
lifetime 28800
crypto isakmp keepalive 10 10
crypto isakmp profile isakmp-vpn-0fbe1650a4800b827-0
keyring keyring-vpn-0fbe1650a4800b827-0
match identity address 35.177.77.134 255.255.255.255
local-address GigabitEthernet1
crypto isakmp profile isakmp-vpn-0fbe1650a4800b827-1
keyring keyring-vpn-0fbe1650a4800b827-1
match identity address 35.178.156.2 255.255.255.255
local-address GigabitEthernet1
!
crypto ipsec security-association replay window-size 128
!
crypto ipsec transform-set ipsec-prop-vpn-0fbe1650a4800b827-0 esp-aes esp-sha-hmac
mode tunnel
crypto ipsec transform-set ipsec-prop-vpn-0fbe1650a4800b827-1 esp-aes esp-sha-hmac
mode tunnel
crypto ipsec df-bit clear
!
!
crypto ipsec profile ipsec-vpn-0fbe1650a4800b827-0
set transform-set ipsec-prop-vpn-0fbe1650a4800b827-0
set pfs group2
!
crypto ipsec profile ipsec-vpn-0fbe1650a4800b827-1
set transform-set ipsec-prop-vpn-0fbe1650a4800b827-1
set pfs group2
!
!
!
interface Tunnel1
ip address 169.254.251.62 255.255.255.252
ip tcp adjust-mss 1379
tunnel source GigabitEthernet1
160 Chapter 6: Transit Gateway
Example 6-4 and figure 6-28 show that after CGW configuration, tunnels are up
on both CGW and TGW.
Example 6-5 verifies that BGP peering between CGW and TGW is established
over IPSec tunnel 1 (169.254.251.61 and tunnel 2 (169.254.84.221).
Example 6-6 verifies that CGW has received BGP Updates about VPC CIDRs from
the TGW over both tunnels. CGW has selected routes received from the
169.254.251.61 as a best path because it is the oldest one (example 6-5 shows the
time-stamps for peering).
NWKT-WAN-Edge-01#sh ip bgp
BGP table version is 6, local router ID is 192.168.100.18
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Example 6-7 verifies that CGW has installed routes learned from the TGW into the
routing table.
NWKT-WAN-Edge-01#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Figures 6-29 and 6-30 shows that TGW has learned route to on-prem Datacenter
network 172.16.10.0/24 via attachments tgw-attach-0e4c3f46c77a508c1 over VPN
connections vpn-0fbe1650a4800b827 (Tunnel 1: 35.177.77.134 and Tunnel 2:
35.178.156.2). Note that I didn’t change the remote CIDR and that is why we have
0.0.0.0/0 entry learned via VPN. Remember to add the route to 172.16.10.0/24 to the
Route Table associated with the subnet NWKT-Prod (figure 6-31).
Examples 6-8 and 6-9 verifies that we have IP connectivity between on-prem
Datacenter and VPCs.
Figure 6-31 shows the cost components related to Transit Gateway. In addition to
VPN connection hours, the Transit Gateway cost structure includes attachment-
based hourly costs, which is 0.06$ per hour. Other than that, AWS charges 0.05$
per VPN connection hour (same as VGW solution), and attachment-based data
processing charges 0.02$ per GB. The design based on the VGW and VPC peering
solutions is cheaper if you only have a couple of VPCs. That is because there are
no attachment-based costs.
Introduction
Figure7-1 illustrates the situation after we have done all necessary propagation.
After propagation, each route table includes routes and their associated next hop.
For example, TGW-London-VPC-RT has two routing entries, a) destination
172.16.10.0/24 with the next-hop pointing to the VPN attachment, and b)
10.12.0.0/16 pointing to the VPC attachment NWK-Shared. The propagated route
from the VPC Route Table is the CIDR range associated with the attached VPC,
not the mask of any particular subnet within the VPC. The TGW Route Table
propagation process is like an import process, based on BGP Route-Targets, in
traditional router virtualization (within a router).
168 Chapter 7: VPC Segmentation with Transit Gateway
The difference is that we don’t have to export routes from TGWs Route Table to
install them into the other Route Table within the same TGW. In the traditional
router virtualization, the BGP process adds an extended BGP community Route-
Target to NLRIs (Network Layer Reachability Information) during the export
process. Then, we use exported route-target when we import NLRI into another
VRF. You can add 20 Route Tables per TGW. TGW can have up to 10 000 static
routes distributed among its RTs. TGW can advertise 5000 routes and receive 1000
routes from its peers. You can add one static route for a prefix towards single
attachment.
Figure 7-3 verifies that TGW-London has three VPC attachments and one VPN
attachment. We haven’t added any resource-specific Route Tables yet, and all
attachments are associated with the default Route Table. Figure below shows the
details of the attachment VPC-Prod-Attach (tgw-attach-06acc2b5d65998c07),
which associates the VPC NWKT-Prod (vpc-04ef72cc79a73f82e) to this TGW’s
default Route Table (tgw-rtb-0648db5cfa12dc1a2). It also shows the subnet Id
(subnet-04af160d1d0aee071) of the subnet NWKT-Prod (10.10.0.0/24).
170 Chapter 7: VPC Segmentation with Transit Gateway
Next, we’ll take a look at the TGW’s default Route Table. Among the TGW Route
Table Id and TGW Ids, the Details tab in figure 7-4 shows that all attachments are
associated with this RT by default. It also shows that this is the default propagation
RT.
The Association tab shows the associated resource attachments with their resource
type and resource Id. You can find the resource id and resource name mapping
from figure 7-1.
The Propagations sheet shows that the propagation is enabled by default in the RT.
For example, on-prem Customer Gateway (CGW) advertises Network Layer
Reachability Information (NLRI) about subnet 172.16.10.0/24 to TGW using BGP
Update messages over a secure VPN connection. After validating the BGP Update
message, TGW propagates this (=installs) route to default RT.
The Routes sheet in figure 7-7 verifies that TGW has installed all VPC CIDR ranges
into RT and subnet that it has learned from the CGW. Note that TGW hasn’t
installed individual subnets (10.10.0.0/24, 10.11.0.0/24, 10.12.0.0/24). Remember
that TGW accepts 1000 routes from its peer.
Example 7-1 shows the CGW’s RT. It verifies that TGW has advertised VPC CIDR
ranges to CGW over both VPN tunnels. CGW has first installed information into
the BGP table and from there to its routing table.
NWKT-WAN-Edge-01#show ip bgp
<snipped >
Network Next Hop Metric LocPrf Weight Path
0.0.0.0 0.0.0.0 0 i
* 10.10.0.0/16 169.254.241.209 100 0 64512 i
*> 169.254.175.105 100 0 64512 i
* 10.11.0.0/16 169.254.241.209 100 0 64512 i
*> 169.254.175.105 100 0 64512 i
* 10.12.0.0/16 169.254.241.209 100 0 64512 i
*> 169.254.175.105 100 0 64512 i
*> 172.16.10.0/24 0.0.0.0 0 32768 i
Example 7-1: CGW’s BGP Table.
In this section, we create three TGW route tables: 1) a shared RT for VPCs NWKT-
Prod and NWKT-test attachments, 2) dedicated RTs for VPC NWKT-Shared
attachment, and 3) dedicated RT for VPN Connection attachment. Then we detach
all four attachments from the default RT and associate them into correct route
tables. Figure 7-8 illustrates the attachment-to-RT mapping, not the actual routes
we later propagate into each RT.
Navigate to the VPC dashboard and click Transit Gateway Route Tables under the
Transit Gateway menu. Give the name to RT and select TGW from the Transit
Gateway Id drop-down menu. Next, click the Create transit gateway route table
button.
Figure 7-10 shows the situation after we have created all three additional route
tables. All route tables now have their unique TGW RT Ids. The Details tab shows
the route table TGW-London-VPC specific information.
AWS Networking Fundamentals 175
Figure 7-11 verifies that there is no association with the RT at this phase.
Confirm that you want to delete the RT-to-attachments association by clicking the
Delete association button.
If we now check the CGW’s BGP table, there is no AWS VPC route in its BGP table.
NWKT-WAN-Edge-01#show ip bgp
BGP table version is 23, local router ID is 192.168.100.18
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-
Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
0.0.0.0 0.0.0.0 0 i
*> 172.16.10.0/24 0.0.0.0 0 32768 I
NWKT-WAN-Edge-01#sh ip route | beg Gateway
Gateway of last resort is 192.168.100.1 to network 0.0.0.0
S* 0.0.0.0/0 [254/0] via 192.168.100.1
169.254.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 169.254.175.104/30 is directly connected, Tunnel1
L 169.254.175.106/32 is directly connected, Tunnel1
C 169.254.241.208/30 is directly connected, Tunnel2
L 169.254.241.210/32 is directly connected, Tunnel2
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.10.0/24 is directly connected, Loopback172
L 172.16.10.1/32 is directly connected, Loopback172
192.168.100.0/24 is variably subnetted, 3 subnets, 2 masks
C 192.168.100.0/24 is directly connected, GigabitEthernet1
S 192.168.100.1/32 [254/0] via 192.168.100.1, GigabitEthernet1
L 192.168.100.18/32 is directly connected, GigabitEthernet1
Example 7-3: CGW BGP Table.
178 Chapter 7: VPC Segmentation with Transit Gateway
Examples 7-15, 7-16, and 7-17 show the associations process of how we associate
VPC attachments used with VPC NWKT-Test and NWKT-Prod with TGW-
London-VPC-RT. Start the process by clicking the Create association button.
Figure 7-17 shows how the processes proceed from the Associating to Associated.
In this section, we create IP connectivity between on-prem and AWS VPCs NWKT-
Test and NWKT-Prod by updating TGW route tables. Figure 7-20 doesn’t show
VPC NWKT-Prod for simplicity though it is associated with the same RT as VPC
NWKT-Test. We start by propagating routes, which TGW has learned from the
CGW, into the route table TGW-London-VPC-RT. Then we repeat the process the
other way around. After propagation, TGW start routing ingress packets with the
destination IP 172.16.10.xxx from VPC NWKT-Test (and NWKT-Prod) to VPN
attachment tgw-attach-0c06d93f7b9933ffe. The next-hop for the ingress packets
from the subnet 172.16.10.0/24 towards CIDR range 10.11.0.0/16 is the attachment
associated with VPC NWKT-test.
Create Propagation
Figure 7-24 shows what propagation did. The Routes sheet shows that the next-
hop for CIDR 172.16.10.0/24 points to the VPN connection attachment. Note that
figure 7-24 shows routing entries about twice. That way, I was able to display both
attachment ids and resource ids. Example 7-4 verifies that we still need to
propagate routes into TGW-London-VPN-RT’s route table to get a bi-directional
connection.
Select the VPC-Test-Attach from the Choose attachment to propagate from the
drop-down menu. Next, click the Create propagation button.
We can also see that there is routing information about CIDR 10.11.0.0/16 in the
Routes tab.
Example 7-5 verifies that TGW starts advertising CIDR 10.11.0.0/16 NLRI to CGW
after installing route to TGW-London-VPN-RT.
Figures 7-29, and 7-30 show the route propagations and routes in the RT TGW-
London-VPN-RT after route propagation related to VPC NWKT-Prod attachment.
Example 7-6 shows that CGW has installed route to 10.10.0.0/16 to its routing table.
However, we still can’t ping from the on-prem Datacenter CGW to our example
EC2 instance running on VPC NWKT-Prod (subnet 10.10.0.0/24).
The reason for this is that there is no route back to 172.16.10.0/24 in the subnet
NWKT-Prod (subnet-04af160d1d0aee071) routing table (NWKT-Prod-Public/rtb-
05dc9cd679937ceee).
Navigate to the route table NWKT-Prod-Public, and select the Routes sheet. Next,
click the Edit routes button.
At this phase, we have done half of the jobs. We still need to establish a connection
from VPCs NWKT-Prod and NWKT-Test to VPC NWKT-Shared. The process is
the same we did in previous examples. Figures 7-34 verifies that we have
propagated routes that TGW has learned via attachment tgw-attach-
034c1731553b77b41 (=NWKT-Shared/vpc-0a2c6c297c4562f11) into the route table
TGW-London-VPC-RT.
Figure 7-35, in turn, shows that TGW has also installed route toward 10.12.0.0/16
into the TGW-London-VPC-RT. The next-hop is the attachment tgw-attach-
034c1731553b77b41 (attachment related to VPC NWKT-Shared).
Figures 7-36, and 7-37 show the propagation process and routes from the TGW-
London-Shared-Service-RT perspective.
CGW on the on-prem Datacenter doesn’t have a route to 10.12.0.0/16 due to the
build-in route-propagation loop prevention mechanism.
As the last step, we need to add static routes to subnet-specific route tables. Figure
7-39 shows routing entries in the subnet NWKT-Prod RT. Figure 7-40 shows
routing entries in the NWKT-Test RT. Figure 7-40 shows routing entries in the
NWKT-Test RT. Figure 7-41 shows routing entries in the NWKT-Shared RT.
Summary
Figure 7-42 illustrates pieces of puzzles that we used to implement the our VPC
segmentation with Transit Gateway. Our segmentation policy stated that services
running within the VPC NWKT-Shared has to be accessed from VPCs NWKT-
Prod, and NWKT-Test. Traffic flows between VPCs NWKT-Test, and NWKT-Prod,
however, is restricted. Service we are running in on-prem Datacenter are accessible
from VPCs NWKT-Prod, and NWKT-Test but not from the VPC NWKT-Shared.
Introduction
When setting up the peering connection between TGWs, we send a peering request
from Stockholm TGW to London TGW (1a). Then, we accept the peering request
on London TGW (1b). TGW Peering, at the time of writing, supports only static
routes. As the next step, we add static routes towards subnets 10.10.0.0/16 and
172.16.10.0/24 into the Stockholm-TGW-Default-RT (2a) with peering attachment
as a next-hop. We also add static routes for these two subnets in the London TGW
route table Stockholm-London-RT but with their respective attachments. We also
need to add static routes to 10.10.0.0/16 and 172.16.10.0/24 into subnet Stockholm-
Subnet-1’s route table (3a). Besides, we have to add a static route toward
10.100.0.0/16 into subnet NWKT-Prod ‘s route table (3b). The next-hop is the local
TGW attachment (not the TGW peering attachment) in both examples. Even
though I previously mentioned that TGW peering doesn’t support propagation,
there is one exception. All routes in the route table related to VPN connection are
advertised to CGW automatically (3c).
194 Chapter 8: Transit Gateway Peering
Before moving on to the Transit Gateway Peering section, let’s look at the
Stockholm Region resources that I have already put in place. Figure 8-2 shows our
VPC Stockholm-VPC and its CIDR range of 10.100.0.0/16.
The TGW peering configuration has two phases. As a first step, we create a TGW
attachment using the resource type Peering Connection in Stockholm-TGW. During
the process, we define the remote AWS region (London) and TGW, which we want
to peer (London-TGW). In the second phase, the administrator of the London-
TGW has to accept our peering request.
Navigate to the Transit Gateway Attachment under the Transit Gateways header
(figure 6-3 in chapter 6). Figure 8-5 shows that we have already attached the
Stockholm-VPC to Stockholm-TGW. To start the TGW peering configuration, click
the Create transit gateway attachment button.
196 Chapter 8: Transit Gateway Peering
The following three figures are all in the same window, but I have divided those
into three separate figures. First, we fill the Details section. Give the Name tag
(optional) for peering connection. Then select the Stockholm-TGW (requester)
from the Transit gateway ID drop-down menu. Next, select the Peering Connection
from the Attachment type drop-down menu.
The name we gave in the Details section is shown in the Tags section. You can add
more tags if needed. When you have given all the information, click the Create
transit gateway attachment button.
Figure 8-9 shows that before we accept the connection request on London TGW,
the State on Stockholm is Pending Acceptance. The Details section shows Requester
TGW ID (tgw-0584fc5b3bc0ee6a7/Stockholm-TGW) and the region (Stockholm
(eu-north-1). Besides, you can see the same information related to Acceptor TGW.
.
To finalize the TGW peering, select London from the AWS Region selection drop-
down menu from the main bar (black background). Then navigate to the Transit
gateway attachments window. You can see that the Stockholm-London-Attach state
is Pending Acceptance. After selecting it, choose the Accept transit gateway attachment
from the Actions drop-down menu.
Figure 8-10: Accepting TGW Peering on London TGW – Accept TGW attachment (1).
After accepting the request, you will get a confirmation notification that you have
to accept.
Figure 8-11: Accepting TGW Peering on London TGW – Accept TGW attachment (2).
Figure 8-12 shows how the state is changed from Pending Acceptance to Pending.
Then, from Pending to Available (figure 8-13). Figure 8-13 also shows that the TGW
200 Chapter 8: Transit Gateway Peering
Figure 8-14 verifies that the TGW peering sate is Available in Stockholm-TGW. The
tgw-attachment is associated with the default route table. That is ok in Stockholm
because we are not implementing any TGW route table-based segmentation.
RT of Stockholm-TGW
The next step we need to do after creating TGW Peering attachment is adding static
routes to route tables. First, we add static routes towards subnets 10.10.0.0/16 and
172.16.10.0/24 to Stockholm-TGW-Default-RT. The next-hop for these destination
subnets is TGW peering attachment (tgw-attach-08eaf28805581d397). Figure 8-15
shows the Stockholm-TGW-Default-RT and its associated resources, which is the
local VPC and the TGW peering attachments.
202 Chapter 8: Transit Gateway Peering
Figure 8-16 shows that the only route is the automatically propagated VPC CIDR
10.100.0.0/16. Figure 8-17 shows the route table routing entries after we have added
two static routes. As a recap, at the time of writing, TGW peering doesn’t support
route propagation.
RT of London-TGW
Now the Stockholm-TGW knows how to route packets to subnets 10.10.0.0/16 and
172.16.0.0/24. Next, we modify London-TGW route tables. In London-TGW, the
TGW peering attachment is associated with TGW-London-Default-RT by default.
We first delete this association (figure 8-18) and then associate it with the correct
RT Stockholm-London-RT (figure 8-19).
London-TGW routes traffic flows received via TGW peering connection based on
route table Stockholm-London-RT, we need to add static routes towards
10.10.0.0/16 and 172.16.10.0/24 to this RT too. The next-hop for destination
10.10.0.0/16 is the VPC attachment, while for the subnet 172.16.10.0/24, it is the
VPN attachment. Note that I have also added a route to 10.100.0.0/16 into the
Stockholm-London-RT, though it is not required. TGW uses this route table for
routing the ingress traffic from the peering connection. Traffic to region local VPC
CIDR 10.100.0.0/16 from Stockholm is never sent to London over TGW peering.
RT of TGW-London-VPC-RT
The VPC NWKT-Prod in London (eu-west-2) has its dedicated TGW route table
TGW-London-VPC-RT (tgw-rtb-0a5f7104856a261f7). Figure 8-22 shows the route
table after adding a static route to Stockholm CIDR 10.100.0.0/17 into it. The next-
hop points to TGW Peering attachment tgw-attach-08eaf28805581d397.
RT of TGW-London-VPN-RT
Figure 8-23 shows the TGW-London-VPN-RT after adding the static route.
NWKT-WAN-Edge-01#sh ip bgp
BGP table version is 26, local router ID is 192.168.100.18
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
0.0.0.0 0.0.0.0 0 i
* 10.10.0.0/16 169.254.175.105 100 0 64512 i
*> 169.254.241.209 100 0 64512 i
* 10.11.0.0/16 169.254.175.105 100 0 64512 i
*> 169.254.241.209 100 0 64512 i
* 10.100.0.0/16 169.254.175.105 100 0 64512 i
*> 169.254.241.209 100 0 64512 i
*> 172.16.10.0/24 0.0.0.0 0 32768 i
NWKT-WAN-Edge-01#
Example 8-1: The BGP Table of the CGW Device NWKT-WAN-Edge-01.
RT of Stockholm-EC2-RT
RT of NWKT-Prod-Public
As the last configuration change, we add a static route to the subnet 10.10.0.0/24
(NWKT-Prod) route table. The figure shows that the next-hop for the destination
10.100.0.0/16 is London-TGW. Figure 8-25 shows the Route table sheet in the
subnet NWKT-prod management view, while the previous figure 8-24 shows the
Routes tab in the Stockholm-EC2-RT route table. You can verify information from
more than one source.
Verify IP Connection
After routing table updates, we have an IP connectivity from on-prem Datacenter
subnet 172.16.10.0/24 to EC2 10.100.0.218 running on Stockholm.
NWKT-WAN-Edge-01#
NWKT-WAN-Edge-01#ping 10.100.0.218 source 172.16.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.100.0.218, timeout is 2 seconds:
Packet sent with a source address of 172.16.10.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 67/71/84 ms
NWKT-WAN-Edge-01#
Example 8-2: Ping from on-prem Datacenter to Stockholm EC2 (10.100.0.218).
Example 8-3 shows that we can also ping from EC2 instance 10.10.0.218 running
on subnet NWKT-Prod on VPC in AWS London region to EC2 10.100.0.218 we
have launched on Stockholm subnet.
208 Chapter 8: Transit Gateway Peering
Summary
Figure 8-26 shows the building block we have in this chapter. We started by
creating VPC Peering Connection between TGWs running in the Stockholm region
and London region. Then we update all necessary TGW route tables. Next, we
updated subnet-specific route tables. Remember that we also have to update
Security Groups associated with our EC2 instance needs to allow traffic flows. In
addition, make sure that the Network ACL (NACL) protecting the subnet has to
permit our application traffic.
Introduction
The VPC Peering is a simple solution that creates an IP connection between the
two VPC’s CIDR ranges. VPC Peering requires unique VPC CIDR ranges and
doesn’t support overlapping CIDR ranges. In addition, VPC peering is always a
request/accept contract between the two VPCs. You can’t use peering VPC as a
transit gateway to another VPC. AWS VPC routing policy verifies that either the
source IP address or destination IP address is attached to one of the interfaces
within VPC, other vice packets are dropped. For example, EC2 instance 10.10.0.218
on VPC NWKT-Prod can’t reach EC2 instance 10.11.0.116 on VPC NWKT-Test over
VPC Peering connection with NWKT-Dev. That is because neither source nor
destination IP address are attached to any local interface in VPC-Dev. When your
application traffic connection matrix requires more than three inter-VPC
connections, you may consider using Transit Gateway (TGW). The benefit of using
VPC peering, however, is that data flows over VPC peering connection within
Availability Zone is free. With the TGW, you will be charged 0,05 $ per VPC
connection per hour. For example, if you connect two VPCs via TGW, you will pay
0,1 $ per hour. You will also pay 0,02 $ per 1 GB when TGW receives data flow
from one of your EC2 instances.
212 Chapter 9: VPC Peering
We are going to create three VPC peering in this example. The first one is from
VPC NWKT-Prod to VPC NWK-Dev. The second one is between NWKT-Prod and
VPC NWK-Test. The last VPC Peering is from VPC NWKT-Dev to VPC NWKT-
Test. By doing this, we allow all traffic flows between all three VPCs. However,
our security policy defines that in addition intra-VPC communication, data flows
from the private subnet 10.10.1.0/24 on VPC NWKT-Prod is allowed to destination
instances in subnet 10.12.0.0/24 on VPC NWKT-Test. We implement this policy by
adding only allowed destinations into subnet-specific route tables.
Figure 9-2 illustrates our VPC Peering Connection. VPC Peering Prod-to-Dev (pcx-
0c5d17ba6e1937f56) connects VPCs NWKT-Prod and NWKT-Dev. VPC Peering
Prod-to-Test (pcx-07182dc0df3165566), in turn, connects VPCs NWKT-Prod to
NWKT-test. VPC Peering Test-to-Dev (pcx-0ad5f376fa89dd944). This section
shows how to create the first VPC Peering Prod-to-Dev. The other two VPCs are
created using the same configuration processes, and that’s why I excluded their
configuration steps.
Navigate to the VPC Dashboard. Select either the Peering Connection hyperlink
under the Virtual Private Cloud section or the VPC Peering Connection hyperlink
from the Resources by Region window.
214 Chapter 9: VPC Peering
Click the Create peering connection button in the Peering connection window.
Because the Accepter VPC NWKT-Dev is under our account, we check the My
Account radio button. All our VPC are in AWS London Region (eu-west-2), so the
Region option is This Region (eu-west-2). Select the VPC NWKT-Dev from the VPC
ID (Accepter) drop-down menu. You will also see the associated CIDR 10.11.0.0/16
after selecting the VPC.
Figure 9-7 shows the notification window. It describes both the Requester’s and
the Accepter’s Account Ids, VPC names, and AWS Regions. Note that only the
Requester CIDR range is shown in the window at this phase. Accept the request
by selecting Accept Request from the Action menu.
Figure 9-9 shows the notification about the successful VPC Peering Connection
process. VPC Peering itself only connects two VPCs. You still need to route update
subnet-specific route tables before packets are forwarded over peering connection.
Figure 9-10 shows all three VPC Peering Connections. You can see that the VPC
NWKT-Prod is Requester VPC for peering with NWKT-Dev as well with NWKT-
Test. VPC NWKT-Test is the Requester for peering with the VPC NWKT-Dev.
Figure 9-11 illustrates route tables of each subnet. The route table of the subnet
10.10.0.0/24 (NWKT-Prod-Public) has two routing entries related to VPC Peering.
The next-hop for the subnet 10.11.0.0/24 is the VPC Peering Prod-to-Test (pcx-
07182dc0df3165566), and the next-hop for the subnet 10.12.0.0/24 is the VPC
Peering connection Prod-to-Dev (pcx-0c5d17ba6e1937f56). We naturally need a
route from the subnets 10.11.0.0/24 (NWKT-Test) and 10.12.0.0/24 (NWKT-Dev)
back to subnet NWKT-Prod-Public. The routing logic is the same as we used in the
route table of subnet 10.10.0.0/24. The next-hop is the VPC Peering Connection.
The route table of the subnet NWKT-Prod-Private has a route to the subnet
10.11.0.0/24 (NWKT-Test) with the next of pointing to VPC Peering Prod-to-Test
(pcx-07182dc0df3165566). We also add a return route to RT of the subnet NWKT-
test. As the last step, we make necessary routing changes to allow traffic flows
between NWKT-Test and NWKT-Dev over VPC Peering Test-to-Dev (pcx-
0ad5f376fa89dd944).
AWS Networking Fundamentals 219
Figure 9-12 shows our route tables. We edit the route table of NWKT-Prod-Private
first. Click the rtb-0e7261b40b0d5237b hyperlink in Route table id column.
Add subnet 10.11.0.0/24 to the destination field. Then select Peering Connection
from the target drop-down menu and choose the VPC Peering Connection pcx-
07182dc0df3165566 | Prod-to-Test. Figure 9-15 shows the partial Details view
where our selected VPC Peering is the target (= next-hop). Click the Save changes
button (not visible in the screen capture).
AWS Networking Fundamentals 221
Figure 9-16 shows routing entries on route table NWKT-Prod-Private (the rtb-
0e7261b40b0d5237b) after we have added the route.
222 Chapter 9: VPC Peering
The same routing logic is used with route tables of NWKT-Test-RT and NWKT-
Dev-RT. The target/next-hop for all inter-VPC destinations is VPC Peering we are
using between VPCs. Last but not least, remember to update Security Groups and
Network ACLs.
AWS Networking Fundamentals 223
Test Connectivity
Examples from 9-1 to 9-6 verifies that our VPC Peering and route policy works as
expected.
Introduction
So far, this book has explained how we can implement an Inter-VPC connection
by using Transit Gateway or VPC Peering solutions. This chapter introduces the
third option, AWS PrivateLink. The first section discusses how we launch a
Network Load Balancer (NLB) in a VPC NWKT-Test. NWKT-Test is our Service
Provider VPC that provides services to Service Consumers in its EC2 instance
NWKT-EC-01. The Service Consumer can be any VPC under any account
(PrivateLink allows cross AWS account VPC connections). During the NLB
creation process, we define a Listener process, which states the protocol and port,
which NLB waits for connection attempts from the consumer side. We are using
TCP port 80. Then we create a Target Group and associate a set of instances to it.
We also specify a protocol and port (TCP: 80) which NLB uses when it opens the
connection to one if its TG instances. As a last NLB step, we set up service
availability Health Check options. We use the same port/protocol (TCP: 80)
combination for Health Check than what we are using for actual consumer traffic
flows. After creating the NLB, we launch a VPC Endpoint Service, which we
associate with our NLB. Next, we create an Interface Endpoint which, in turn, uses
the VPC Endpoint Service for connecting to services behind NLB. Interface
Endpoint is seen as Elastic Network Interface (ENI) in your Service Consumer
network. In our example, the ENI gets an IP address from the IP pool of the subnet
NWKT-Prod-Public (10.10.0.0/24). When we want to connect to service from our
Service Consumer VPC, we call the IP address of ENI of Interface VPC Endpoint.
It then forwards traffic to NLB, which performs a source NAT before forwarding
traffic to the target. In our example, provider registers the service using the name
vpce-svc-05ad80b00dd1783f65. You may want to use an Alias record for giving a
friendly name for the service, such as vpce.nwktweb.com. When we use DNS
names to access the service, our DNS service resolves the name to the IP address
assigned to our ENI. As said, it is an IP address that is in the Service Consumer
subnet. From our consumer EC2 instance point of view, the service is in the same
subnet. It means that we don’t have to modify the subnet-specific route table. The
same applies to subnet where we are running our services, NLB does the source
NAT for ingress traffic using the IP from the service instance subnet. From the
service instance NWKT-EC2-1point of view the connection request comes from
subnet 10.11.0.0/24.
226 Chapter 10: AWS PrivateLink
AWS PrivateLink based Inter-VPC solution differs from VPC Peering (VPC-P) and
Transit Gateway (TGW) implementations. Both VPC-P and TGW open
bidirectional IP connections between VPCs for the whole VPC IP ranges, which
means that these services don’t support overlapping IP addresses. AWS
PrivateLink, in turn, is an application-specific, host-based connection from the
Service Consumer to Service Provider. That said, EC2 instances in Service Provider
VPC can’t initiate connection to hosts running on a Service Consumer VPC over
PrivateLink connection. AWS PrivateLink is a powerful micro-segmentation tool.
AWS PrivateLink solution crates Network Load Balancer -based (NLB) VPC
Endpoint Service, where NLB uses source NAT for ingress traffic. That makes it
possible to use an overlapping IP address in Service Consumer VPC and Service
Provider VPC. We can also publish VPC Endpoint Service for several VPC and
allow Service Providers to offer shared services. Due to NLB source NAT, also
Service Consumers IP ranges can overlap.
AWS PrivateLink supports only Network Load Balancer (NLB). NLB operates at
OSI Layer 4 (Transport Layer). It listens to connection requests for port/protocol
we have defined in its Front-End listener process. In our example, we use TCP/80.
When NLB receives a connection request, it opens a TCP connection to port 80 with
one of its healthy targets included in the Target Group. In our example, we are
using the traffic port for monitoring targets health checks.
AWS Networking Fundamentals 227
Start the NLB configuration process by navigating to VPC Dashboard and selecting
the Load Balancer under the Load balancing header. Then, click the Create Load
Balancer button.
First, we define the Listener. Select TCP port 80 for Load Balancer Protocol and
port for Listener service. By doing that, our NLB listens to connection initiations
from the Service Consumer side to TCP port 80. Then we select the NLB location.
We will launch it on Availability Zone eu-west-2c on the Service Provider VPC
NWKT-Test. Our target EC2 instance is in subnet 10.11.0.0/24 (NWKT-Test), so
select it from the drop-down menu. We are not configuring any LB Security for
simplicity so we can bypass the second phase.
AWS Networking Fundamentals 229
Figure 10-5: Create Network Load Balancer: Step-3, Listeners and Availability Zones.
230 Chapter 10: AWS PrivateLink
In step 3, we configure NLB routing policy for the ingress traffic received from the
front-end side. First, Create a Target Group. Then name it and define the service
port and protocol. Select the Instance options as Target Type. We will observe the
service availability using NLB Health Check. In our example, we are using http
requests in a 30-second interval. By doing this, we confirm that the actual service
running on an EC2 instance is available. We can leave the rest of the fields with
their default values. Next, move to the target registration phase.
AWS Networking Fundamentals 231
Figure 10-7: Create Network Load Balancer: Step-5, Target Group and Health Checks.
The NLB setup is ready after we have registered our target instance. Now we can
review the configuration before we launch the Network Load Balancer. Figure 10-
9 shows the review.
AWS Networking Fundamentals 233
The name of our internal NLB is NWKT-LB. There is one front-end listener process
that listens to TCP connection initiations to port 80. NLB back-end is associated
with the subnet NWKT-Test (10.11.0.0/24) in VPC NWKT-Test. The name of our
Target Group is NWKT-TG1, and NLB routes ingress HTTP requests traffic
towards target instances that are registered to Target Group. The Health Check
protocol and port are the same that we use for traffic flows. Next, click the Create
button to launch the NLB.
Figures 10-11 shows that our NLB is now listed in the Load Balancers view. The
Description tab includes the basic NLB information.
The Listeners tab in figure 10-12 shows the front-end listener settings. It also shows
that the NLB forwards traffic initiated to this listener to one of the targets attached
to target group NWKT-TG1.
236 Chapter 10: AWS PrivateLink
You can start creating the Endpoint Service by clicking the Create Endpoint Service
in the Integrated Service tab.
Navigate to VPC Dashboard and select the Endpoint Service under the Virtual
Private Cloud header. Click the Create endpoint service button.
Fill in the name field and set the Load balancer type to Network. Select our NLB
from the NLB list (we only have one NLB).
Check the Acceptance required option. By doing this, we need to accept consumer
requests before they can use the Endpoint Service. The Tag field shows the name
tag you gave to Endpoint Service. To launch the Endpoint Service
AWS Networking Fundamentals 239
Figure 10-18 shows the notification and summary window after the Endpoint
Service is ready. When you later configure the Endpoint that will use this service,
you need the service name. You can copy it from the Endpoint Service view. The
name of our Endpoint Service is com.amazonaws.vpce.eu-west-2.vpce-svc-
05ad80b0dd1783f65.
240 Chapter 10: AWS PrivateLink
Create Endpoint
Start by navigating to the VPC dashboard and select Endpoints. Click the Create
Endpoint button.
Select Find service by name from the Service category. Then paste the service name
that you have previously copied (in figure 10-18). Select the VPC where you launch
the Endpoint (NWKT-Prod | vpc-04ef72cc79a73f82e). Then, select the subnet
within the VPC (NWKT-Prod-Public | subnet-04af160d1d0aee071) where the ENI
attached to Endpoint will be associated. The NWKT-Prod-Public subnet is
available at Availability Zone eu-west-2c (euw2-az1).
Figure 10-21: Create Endpoint – Step1: Define Service, VPC, and the Subnet.
Note that I have divided the Create Endpoint window into two figures (figure 10-21
and 10-22). We have pre-configure Security Group NWKT-EP-SG, which we use
with Endpoint. After filling in all the information, click the Create endpoint.
AWS Networking Fundamentals 243
Figure 10-23 verifies that our Endpoint is created. The Endpoint Id is vpce-
0c957dacf578666f8.
Figure 10-24 show the details of our new Endpoint NWKT-EP (vpce-
0c957dacf578666f8). We haven’t accepted the connection request, and that is why
the state is Pending Acceptance for the Endpoint Service com.amazonaws.vpce.eu-
west-2.vpce-svc-05ad80b0dd1783f65. Details tab also shows the type of the
endpoint, which in our example is Interface (there is also Gateway Endpoints in
AWS). We can also see that the endpoint is running on a VPC NWKT-Prod (vpc-
04ef72cc79a73f82e). In addition, the Details tab shows the Service name and DNS
names.
244 Chapter 10: AWS PrivateLink
To accept the endpoint connection request, go to the Endpoint service view and
select the NWKT-EP-Service. Open the Endpoint connection tab. Then, choose the
Accept endpoint connection request option from the Action drop-down menu.
AWS Networking Fundamentals 245
You have to confirm the acceptance before clicking the Accept button.
The Endpoint connection tab in figure 10-27 verifies that the state of the Endpoint
connection from the Endpoint vpce-0c957dacf578666f8 to Endpoint Service is
Available.
Figure 10-28 shows that the Status of the Endpoint connection is also available
from the Endpoint perspective.
The subnet tab shows that we have attached our endpoint to subnet 10.10.0.0/24
(NWKT-Prod-Public | subnet-04af160d1d0aee071), which is in AZ eu-west-2c. The
IP address of the endpoint is 10.10.0.120, and the Elastic Network Interface ID for
an endpoint is eni-0bbba22ce242a2ef8.
You can click the Network Interface ID eni-0bbba22ce242a2ef8 to see the details of
the ENI. Figures 10-30 and 10-31 on the next page show the information related to
ENI. Note that once again, I have divided the view into two figures.
248 Chapter 10: AWS PrivateLink
Figure 10-31: Information Related to Endpoint Elastic Network Interface (ENI) continues.
Connection Verification
Our example service instance NWKT-EC2-01 is a free tier Linux machine, and we
are not running any HTTP server on it. That is why it doesn’t listen to TCP session
initiation to port 80. However, it listens to TCP port 22, so we can test the
connection by using SSH.
We used the TCP port 80 in our example configuration in Network Load Balancer
Target Group (NWKT-TG1), Health Check, and Listener process. Figure 10-32
shows the new Target Group (NWKT-TG-2), which I have created for ssh testing.
It uses TCP port 22.
Figure 10-33 verifies that Health Check automatically starts using TCP port 22 for
service availability monitoring.
AWS Networking Fundamentals 251
Monitoring Tab verifies that after changing the Target Group TCP port from 80
(http) to 22 (ssh), our EC2 is available and healthy.
252 Chapter 10: AWS PrivateLink
We have one thing to do before we can test the ssh from the Consumer VPC
NWKT-Prod to Service Provider VPC NWKT-Test. We need to change the Listener
process to listen to TCP session initiation to port 22. Figure 10-36 shows our
modified Listener values where NLB forwards ssh session initiation to one of the
instances (we only have one) belonging to Target Group NWKT-TG-2.
Now we are ready to test our PrivateLink. Example 10-2 shows what happens
when we open ssh session from the EC2 instance 10.10.0.218 (Service Consumer
VPC NWKT-Prod/subnet NWKT-Prod-Public) to Endpoint Elastic ENI IP
10.10.0.120 (also in the same VPC/Subnet).
AWS Networking Fundamentals 253
Endpoint forwards our ssh session initiation to Load Balancer, which does the
source NAT and forwards session initiation to instance NWKT-EC2-01 10.11.0.126.
That verifies that our VPC PrivateLink is working.
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-10-11-0-126 ~]$
Example 10-2: SSH from 10.10.0.218 to 10.11.0.126.
Billing
Introduction
AWS Direct Connect (DX) is such a broad topic that I decided to break it into five
chapters. This chapter introduces the Dedicated Direct Connect (DDX) with Transit
Gateway association using Transit Virtual Interface (TVIF). Chapter 12 introduces a
Hosted Direct Connect (HDX). The focus of chapter 13 is on BGP routing over Direct
Connect. Chapter 14 explains how we can use Direct Connect Gateway (DXGW) as
a site-to-site hub using a Direct Connect SiteLink. Chapter 15 explains Public Virtual
Interface (PVIF), which we use to create a connection to Amazon public service
bypassing the Internet.
Figure 11-1 illustrates our example solution, where we have a customer’s edge
router CE-1 in Equinix LD5, Slough, UK Datacenter. Equinix LD5 Datacenter is one
of the four AWS Direct Connection Locations (AWS-DCL) in the AWS eu-west-2
(London) region in which Amazon has prepended its backbone network with its
edge router (EqLD5-xyz in figure 11-1). Equinix, in turn, is one of the AWS Direct
Connect Partners (AWS-DCP), which all are members of the AWS Partner Network
(APN). On the AWS side, we have our VPC NWKT (CIDR Range 10.10.0.0/24)
attached to Transit Gateway (TGW). We associate our TGW to Direct Connect
Gateway (DXGW), a global AWS service, to which we can attach TGWs from any
AWS Region. Our customer router CE-1 is connected to AWS physical device
EqLD5-xyz using fiber optic cable (1310 nm SM/1000Base-LX). The glue between
the router CE-1 and DXGW is a Virtual Interface (VIF). VIF defines the VLAN
Identifier, which we use to extend the broadcast domain from the AWS Logical
Device (ALD) TCSH-1a2b3c4d, running on AWS physical device EqLD5-xyz, to
customer router CE-1. We need the broadcast domain (=subnet) for eBGP peering
between CE-1 and TCSH-1a2b3c4d. VIF also defines the BGP Autonomous System
Number (ASN) of customer router CE-1 and the IP addressing scheme for eBGP
peering. Note that the Amazon side ASN is defined in DXGW configuration. On
the Amazon side, we attach VIF to DXGW, and that’s basically is it. We have a
dedicated connection, bypassing the Internet, from our CE-1 router to VPC.
256 Chapter 11: Dedicated Direct Connect & Transit VIF
Figure 11-1 illustrates the configuration process. The following sections introduces
each of these steps in detail.
Figure 11-1: AWS Dedicated Direct Connect Connection & Transit Virtual Interface.
Figure 11-2 illustrates the example Dedicated Direct Connect connection. Our edge
device CE-1 is in the Direct Connect Location DC and we don’t have to use AWS
Direct Connect Partner infrastructure for AWS device cross-connect. The 1 Gbps
dedicated connection, which we are ordering, requires a 1000Base-LX SFP optical
transceiver and 1310nm Single-Mode optical fiber. The 10 Gbps dedicated
connection, in turn, requires a 10Gbase-LR SFP+ optical transceiver and 1310nm
Single-Mode optical fiber. First, we order a Dedicated DX connection from
Amazon. In this phase, we define the AWS-DCL (Equinix LD5 Datacenter) and
cross-connection port speed (1Gbps). Note that available cross-connect port speed
options are 1Gbps, 10Gbps, and 100Gbps in this DCL. When Amazon has
validated our order (it may take up to three days), we can download the Letter of
Authorization – Connection Facility Assignment (LOA-CFA) document. After
downloading the LOA-CFA document, we send it to the Direct Connect Partner.
The LOA-CFA document authorizes DCP to do the cross-connection. Besides, it
gives instructions to where the cross-connect cable should be connected (Rack,
Patch-Panel, Port) by their staff.
AWS Networking Fundamentals 257
As the first step, we need to order the Dedicated Direct Connect connection from
Amazon. Start the process by selecting the Networking & Content Delivery option
from the Services menu. Then, select the Direct Connect hyperlink from the right
window.
First, name the connection, then select the Direct Connect Location. Write the AWS
Region name into the Location drop-down menu to see all available AWS DCLs in
the selected region. As figure 11-5 shows, there are four AWS-DCL in the AWS
region eu-west-2 (London). The only one where you can establish 100Gbps cross-
connection to AWS Router is the Equinix LD5 Datacenter. We are using that one
even though we are setting up the 1Gbps cross-connect.
After selecting the AWS-DCL, select the port speed. In this example, we are
ordering a straight cross-connection between the customer device and AWS router
without AWS-DCP in between them. Uncheck the Connect through an AWS Direct
Connect Partner under the on-Premises option. You can configure an LACP
(Ethernet Channel) and MACsec (link-level encryption) under the Additional
Settings section. We are using neither of them. Now everything is in place, and we
may continue the order process by clicking the Create connection button. Note that
I only explain how to create Direct Connect without actually doing it.
Example 11-1 shows an example response to the AWS CLI command aws direct
connect describe-connection. You can see the name of the AWS device, connection
speed, AWS-DCL location, and the AWS region among the other information from
the output. Note that the state of the connection is down at this moment because
there is no cross-connection in place.
{
"connections": [
{
"awsDevice": "EqLD5-xyz",
"ownerAccount": "123456654321",
"connectionId": "dxcon-azg8gbl",
"lagId": "dxlag-xyz",
"connectionState": "down",
"bandwidth": "1Gbps",
"location": "EqDC5",
"connectionName": "NWKT-LONDON-DXC",
"loaIssueTime": 1491528158.0,
"region": "eu-west-2"
}
]
}
Example 11-1: Direct Connect Verification using the AWS CLI.
You can download the LOA-CFA document after AWS has provisioned the
interface for your connection in their AWS. To download the LOA-CFA document,
navigate to Direct Connect > Connections window. Then select the Direct Connect
connection which LOA-CFA you want to download. Note that we don’t have
existing connections in this example. Next, click the View Details button (it activates
after you have selected the connection from the list) and then Select the Download
LOA-CFA option. Note that the LOA-CFA document is valid for 90 days.
AWS Networking Fundamentals 261
You can download the LOA-CFA document also by using the AWS CLI. The LOA-
CFA content is base64-encoded. Example 11-2 shows the Windows command
which extracts the loa.Content into the file NWKT-LD5_LOA-CFA.base64.
After downloading and extracting the file, you can create a pdf file from the
loaContent using the Windows Certutil tool.
When you have got the LOA-CFA document, you need to send it to AWS-DCP.
AWS maintains contact information concerning its Direct Connect Partners. You
can find the Equinix London DCL contact information by navigating the AWS
Direct connect service page and clicking the Cross connects-hyperlink (figure 11-
9).
AWS Networking Fundamentals 263
You will be forwarded to Request cross-connects at the AWS Direct Connect locations
window. Select Europe (London) from the Contents section, and you find the
contact email address of Equinix LD5, London Datacenter.
As the next step, after we have ordered the Dedicated Direct Connect connection
from Amazon and sent the LOA-CFA to AWS Direct Connect Partner, we create
AWS Direct Connect Gateway (DXGW).
Go to Direct Connect service view and select Direct Connect gateways. Then click the
Create Direct Connect gateway button.
Figure 11-12: AWS Direct Connect – Create Direct Connect Gateway: Step1.
AWS Networking Fundamentals 265
Name the connection and select the Amazon side BGP ASN. We are using the AWS
default ASN 64512. Then, click the Create Direct connect gateway button.
Figure 11-13: AWS Direct Connect – Create Direct Connect Gateway: Step2.
You will be forwarded to the Direct Connect gateway window, where our DXGW
is now listed.
Figure 11-14: AWS Direct Connect – Create Direct Connect Gateway: Verification.
266 Chapter 11: Dedicated Direct Connect & Transit VIF
Example 11-4 shows the AWS CLI response to command aws directconnect describe-
direct-connect-gateways. You can get the same information also from the Direct
Connect gateway window (figure 11-14) by selecting the DXGW and then clicking
the View details button.
Next, we create a Transit Virtual Interface (VIF). The process launches AWS
Logical Device (ALD) TCSH-1a2b3c4d on AWS router EqLD5-xyz. It is the virtual
router to which we are using eBGP peering with the customer router CE-1. We
extend the subnet 10.0.0.0/30 (Broadcast Domain) from TCSH-1a2b3c4d to CE-1
using the VLAN-Id 1077 over dxcon-azg8gbl. Then bind TSCH-1a2b3c4d to
DXGW using dxvif-xy84cda.
Figure 11-15: AWS Direct Connect – Attach DXC-GW to DXC Using Transit VIF.
AWS Networking Fundamentals 267
Start by selecting the Virtual interface option from the Direct Connect section. Next,
click the Create virtual interface button.
Select the Transit option from the Create virtual interface window. Note, figures from
11-17 to 11-20 are part of the same view.
Scroll down to Transit virtual interface settings section. Fill in the Virtual interface
name field. We haven’t created a Dedicated Direct Connect connection, so the
Connection drop-down menu is empty. We own the VIF, so we choose the My AWS
account option from the Virtual interface owner section.
268 Chapter 11: Dedicated Direct Connect & Transit VIF
Select the Direct Connect Gateway option from the Gateway type section. Open the
Direct Connect gateway drop-down menu and select our DXGW NWKT-
DirectConnectGW. Then, choose the VLAN Id and customer side BGP ASN. I have
used VLAN Id 1077 and BGP ASN 65077 in this example.
You can set the BGP peering addresses in the Additional settings section. We are
using the default subnet 10.0.0.0/30. We are attaching the IP address 10.0.0.1 to the
customer router and the IP address 10.0.0.2 to the AWS router. We are using these
addresses for eBGP peering. You can use authentication for BGP messages if your
security policy requires that. Besides, you can enable Jumbo MTU (Maximum
Transfer Units in Bytes). To proceed, click the Create virtual interface button.
Example 11-5 how we can verify the Transit Virtual Interface attachment from the
AWS CLI. It shows the owner account id, DXGW Id, AWS region, attachment state
(still attaching), and the VIF Id. The prefix of VIF is dxvif-.
{
"directConnectGatewayAttachments": [
{
"virtualInterfaceOwnerAccount": "123456654321",
"directConnectGatewayId": "93089d56-4213-469f-bf9f-153f9f1532df",
"virtualInterfaceRegion": "eu-west-2",
"attachmentState": "attaching",
"virtualInterfaceId": "dxvif-xy84cda"
}
],
"nextToken": "token snippet for brevity"
}
Example 11-5: AWS CLI: DXC-GW VIF Attachment Verification.
AWS Networking Fundamentals 271
When we have downloaded the router configuration file, we can create an eBGP
peering configuration into CE-1.
As the last step, we create a Transit Gateway association with DXGW. Besides, we
define what subnets DXGW propagates to ALD TCSH-1a2b3c4d over dxvif-
xy84cda, which in turn sends BGP Update message to CE-1. In our example, we
advertise the subnet 10.10.0.0/24.
Navigate to Direct Connect gateways view. Then select the DXGW to which you
want to associate the TGW. We only have NWKT-DirectConnectGW on the list, so
we choose it. Next, click the View details button.
Figure 11-25 shows the information related to our DXGW. The Virtual interface
attachment shows that we actually don’t have any Virtual Interface attachment
because we can’t create one without a real Direct Connect connection. However,
we can configure the Transit Gateway association. Choose the Gateway association
tab.
Select the TGW from the Gateway section’s drop-down menu, which you associate
with the DXGW. Our example TGW is NWKT-TGW-LONDON. You can also
define the allowed prefixes which DXGW propagates to VIF. Click the Associate
gateway button to implement the configuration.
AWS Networking Fundamentals 275
Figure 11-28 verifies the successful association. Note that you can associate three
TGWs with DXGW.
Example below shows the synthetic output of command aws directconnect describe-
virtual-interfaces --connection-id dxcon-xyz85cda after we have done all the
configurations.
{
"virtualInterfaces": [
{
"addressFamily": "IPv4",
"amazonAddress": "10.0.0.2",
"amazonSideAsn": 64512,
"asn": 65077,
"authKey": " ",
"awsDeviceV2": " ",
"awsLogicalDeviceId": " ",
"bgpPeers": [
{
"addressFamily": " IPv4",
"amazonAddress": "10.0.0.2/30",
"asn": 64512,
"authKey": " ",
"awsDeviceV2": " ",
"awsLogicalDeviceId": "TCSH-1a2b3c4d",
"bgpPeerId": "10.0.0.1",
"bgpPeerState": " ",
"bgpStatus": " ",
"customerAddress": "10.0.0.0/1"
}
],
"connectionId": "dxcon-xyz85cda",
"customerAddress": "10.0.0.1/30",
"customerRouterConfig": " <?xml version=\"1.0\" encoding=\"UTF-
8\"?>\n<logical_connection id=\"dxvif-xy84cda\">\n <vlan>1077</vlan>\n
<customer_address>10.0.0.1/30</customer_address>\n
<amazon_address>10.0.0.2/30</amazon_address>\n <bgp_asn>65077</bgp_asn>\n
<bgp_auth_key> </bgp_auth_key>\n <amazon_bgp_asn>64512</amazon_bgp_asn>\n
<connection_type>tranist</connection_type>\n</logical_connection>\n",
"directConnectGatewayId": " 93089d56...",
"jumboFrameCapable": boolean,
"location": "",
"mtu":,
"ownerAccount": "123456654321",
"region": "eu-west-2",
"routeFilterPrefixes": [
{
"cidr": "10.10.0.0/24"
}
],
"siteLinkEnabled":,
"tags": [
{
"key": "",
"value": ""
}
AWS Networking Fundamentals 277
],
"virtualGatewayId": "",
"virtualInterfaceId": " dxvif-xy84cda ",
"virtualInterfaceName": "NWKT-Tranist-VIF",
"virtualInterfaceState": "",
"virtualInterfaceType": "Transit",
"vlan": 1077
}
]
}
Example 11-: Example Output of Describe-Virtual-Interface .
Direct Connect Gateway doesn’t route traffic between gateways associated with
the same DXGW. This rule applies to both Transit Gateway (TGW) and Virtual
Private Gateway (VGW). In figure 11-29, we have one TGW in the London region
and the other one in the Stockholm region. If we want to allow traffic between
VPCs on different AWS regions, we either have to use TGW Peering or Inter-
Region VPC peering. IP traffic between VPCs that are attached to the same TGW
is allowed. Besides, traffic between customer CE-1 to all three VPCs is permitted.
Introduction
Customers can order AWS Hosted Direct Connection (H-DXC) from AWS Direct
Connect Partner (AWS-DCP) that has a presence in AWS Direct Connect Location
(AWS-DCL). The AWS-DCPs, which offer H-DXC service, have existing cross-
connections from their Cloud Edge Fabric to AWS router. These connections are
either 1Gbps or 10Gbps. Some AWS-DCPs also have a 100Gbps connection. H-
DXC is useful for customers who do not have network devices in the AWS-DCL.
They can terminate their Layer 2 WAN circuit (e.g. Dark Fiber, Metro Ethernet,
MPLS VPLS, EoMPLS) from on-prem Datacenter to Direct Connect Partner’s
Network/Cloud Edge Fabric. In this model, customers can order an AWS router
connection straight from the AWS-DCP, using their AWS cross-connection. The
benefit of using Hosted Direct Connect is that it supports bandwidths from
50Mbps to 100Gbps. At the time of writing, supported data transfer rates are 50
Mbps, 100 Mbps, 200 Mbps, 300 Mbps, 400 Mbps, 500 Mbps, 1 Gbps, 2 Gbps, 5
Gbps, and 10 Gbps. Customers whose device is in AWS-DCL can also order an H-
DXC connection from the AWS-DCP if they need other transfer speed than
standard AWS Dedicated Direct Connect connections (1Gbps, 10Gbps, or
100Gbps).
The focus of this chapter is to explain how we can extend Layer 2 segment over
AWS-DCP’s Cloud Edge fabric by using BGP EVPN Control Plane with VXLAN
Data Plane. AWS-DCPs do not publish detailed technical documentation about
their Cloud Edge solutions. However, our example AWS-DCP Equinix has
published video series, Packet Flow Part 1 & 2: Network Edge. In these videos,
Equinix’s Senior Product Manager Brad Gregory explains the Control Plane and
Data Plane operation in their Network Edge Fabric. Based on these videos, we
know that they use EVPN/VXLAN technologies for extending Layer 2 segments
over Network Edge Fabric.
If the VXLAN is not relevant for you, you can skip this chapter and move to the
next chapter.
280 Chapter 12: Hosted Direct Connect
Network Edge
Figure 12-1 illustrates our example Hosted Direct Connect solution. We are using
Equinix’s LD5 Datacenter as our Direct Connect Location. Equinix is also our
Hosted Direct Connect Partner. Customer’s edge device CE-1 is in on-prem
Datacenter from where they have Layer 2 circuit to Equinix LD5 Datacenter. The
connection is terminated to Edge-1’s interface e1/1. The cross-connection between
the Edge-2 and AWS router is 10Gbps over single-mode fiber. In real life, the
Equinix Network Edge Fabric is connected to the Equinix ECX device, which is
connected to AWS Router. Network Edge fabric uses BGP EVPN for MAC address
advertisement with ECX devices. To keep things simple, I excluded ECX from
figure 12-1. The purpose of the Network Edge, in our example, is to extend the
Layer 2 broadcast domain between the Customer router and AWS Logical Device
TCSH-1a2b3c4d running on AWS router.
Our purpose is to establish eBGP peering between the customer router CE-1 and
TCSH-1a2b3c4d using shared network segment 10.0.0.0/30. BGP peering session
uses TCP as a transport protocol. CE-1 starts the BGP peering process by initiating
a TCP connection with ALD TCSH-1a2b3c4d. Because they both are in the same
Layer 2 segment, CE-1 first has to resolve the MAC address associated with the IP
10.0.0.2 (ALD TCSH-1a2b3c4d eBGP peering IP). It sends an ARP request (L2
Broadcast), where it asks who owns the IP address 10.0.0.2. Edge-1 receives the
ARP message from the interface e1/1. The ingress ARP message triggers the BGP
EVPN Control Plane process where Edge-1 advertises CE-1 MAC/IP binding
information to Edge-2. Figure 12-1 illustrates the overall process.
Figure 12-1: AWS Hosted Direct Connect Connection – EVPN Control Plane.
The MAC address table of Edge-1 in figure 12-2 shows that MAC address
cafe:1234:0001 belongs to VLAN 1077 and that it has been learned dynamically
(Data Plane learning) from the interface e1/1 24 seconds ago. VLAN 1077 is
associated with Virtual Network (VN) 10000. ARP table includes MAC/IP binding
information and the Layer 3 interface (Routing Interface) of VLAN 1077. MAC
282 Chapter 12: Hosted Direct Connect
address from the MAC table and IP address from the ARP table are programmed
into the L2RIB. In addition to MAC/IP addresses mapping information, L2RIB
describes the VN-Id (10000), how the information is produced into it (locally), and
the Next-Hop information (Local). L2RIB information is then exported to the BGP
process. Edge-1 installs the MAC/IP address NLRI with associated BGP Path
Attributes into the local BGP table (not shown in figure). Then it generates a BGP
Update message. BGP Update message includes the set of Path Attributes. Edge-1
attaches the Route Target 100:10 to all BGP update messages, which carries NLRI
related to MAC/IP mapping of hosts in VLAN 10. The other Extended Community,
Encapsulation Type, is used to inform the receiving side that Ethernet frames
towards the advertised MAC address have to send within VXLAN encapsulation
(Outer Ethernet/IP headers, UDP header, and VXLAN header). The BGP Path
Attribute MP_REACH_NLRI carries the EVPN NLRI (MAC/IP information) and
related Next-Hop address. BGP EVPN has several Route Types. MAC/IP address
information is advertised as EVPN Route Type 2 (MAC Advertisement Route). The
Route Distinguisher (RD) value is used as a prefix for MAC Advertisement
addresses, and it is a part of the address. In our example, RD identifies the
originating device using its IP address. The value 32777 after IP address
10.100.100.1 is derived from the VLAN 10. The base value of this field is 32767.
Subtracting the base value 32767 from 32777, we get 10 = VLAN Id. As said, each
MAC/IP address NLRI about hosts attached locally to VLAN 10 will get the same
RD prefix. This way, we can use overlapping MAC and IP addresses in BGP EVPN
Fabric. In addition to MAC and IP address information, our example EVPN NLRI
has MPLS Label Stack 1: 625 that identifies the VN 10000. To understand how 625
is turned to 10000, we need to convert the decimal number 625 to HEX. The result
is 271 (12 bits). If we capture a BGP Update message from the wire, we can see that
the length of the MPLS Label value carried in EVPN NLRI is actually 24 bits, and
625 is encoded as 00 27 10 (there we have our missing 12 bit). When we convert
this HEX 00 27 10 back to the decimal format, we get 10000. This math is out of the
scope of AWS Network Fundamentals. However, I added it because I tend to
forget the math behind MPLS Label = VNI.
When Edge-2 receives the BGP Update message originated by Edge-1, it first
confirms that it has a route to Next-Hop address 10.100.100.1. The Next-Hop IP
address is Edge-1’s NVE (Network Virtualization Edge) interface address. Edge-2
uses 10.100.100.1 as a destination IP address in the tunnel IP header for data
packets to hosts connected to Edge-1. Next, Edge-2 imports NLRI information to
its local BGP table. The import process is based on the Route Target Extended
Community 100:10, which is associated with the VN 10000. BGP Update message
and the local BGP table hold almost identical information. That’s why the BGP
table is not shown in figure 12-3. When Edge-2 has updated the local BGP table, it
installs the routing information into L2RIB. Then it updates VLAN 10 MAC
address table and the ARP Table.
When the MAC Address table and ARP table are updated, Edge-2 is able forward
Ethernet frames from ALD TCSH-1a2b3c4d to CE-1. It can also reply to the ARP
Request message on behalf of CE-1. It means that ARP messages are not forwarded
across the fabric. The same BGP EVPN process happens in the opposite direction
when Edge-2 receives the first IP packet from the ALD TCSH-1a2b3c4d.
Figure 12-4 illustrates the Data Plane operation. In this example, we assume that
both CE-1 and ALD TCSH-1a2b3c4d have sent Gratuitous ARP (GARP) messages
after booting up. GARP process has triggered the BGP EVPN Control Plane
process where Edge devices have sent EVPN MAC Route advertisements about
their locally connected device. That said, both Edge devices have an up-to-date
MAC address table, ARP table, and L2RIB.
284 Chapter 12: Hosted Direct Connect
Before CE-1 can start the three-way handshake process with ALD TCSH-1a2b3c4d,
it resolves the MAC address associated with the IP address 10.0.0.2. It sends an
ARP Request message to figure out who has 10.0.0.2. When Edge-1 receives the
ARP Request message, it consults its ARP table. It has requested information in its
ARP table, and it sends an ARP Reply with the MAC/IP binding information to
CE-1. The ARP Request/Reply process is not shown in figure 12-4.
Figure 12-4: AWS Hosted Direct Connect Connection – VXLAN Data Plane.
We just scratched the surface of the BGP EVPN/VXLAN fabric. If you want to learn
more about the VXLAN solution, you may want to read my Virtual Extensible
LAN – VXLAN book.
286 Chapter 12: Hosted Direct Connect
AWS Networking Fundamentals 287
Introduction
This section explains how we can affect to egress path selection process on AWS
Direct Connect Gateway (DXGW). DXGW are AWS-managed services, so we can’t
change its configuration. However, we can use BGP built-in tools (BGP route
aggregation, BGP AS-Path Prepending, and BGP Communities) for affecting to
egress path selection process. Figure 13-1 shows our example setup where we have
Customer Edge routers CE1 and CE2 in the on-prem Datacenter. CE-1 has eBGP
peering with ALD-1 and CE2 with ALD-2. I haven’t included AWS physical
routers on either DCL in figure 13-1 for simplicity.
Figure 13-1 illustrates a default BGP behavior and route selection processes. We
have subnets 172.16.0.0/24 and 172.16.1.0/24 on the on-prem Datacenter. We
haven’t done any BGP policy configuration at this phase, just a basic BGP
configuration (peer IP and AS + network advertisements). CE1 and CE2 advertise
these subnets without any BGP Path-Attribute modification. Because subnets
172.16.0.0/24 and 172.16.1.0/24 are local subnets, the BGP AS-Path path attribute
list has only the local ASN 65077 in all four BGP Update messages. CE routers set
the next-hop IP address to their eBGP peering interface’s IP.
When the AWS Logical Devices (ALD) receive BGP Update message from their
eBGP peer, they first verify that they have a route to the next-hop IP address
carried within the message. After Next-Hop verification, they install the subnet
and its path-attribute information into the BGP Adj-RIB-In table. Next, the BGP
process imports the NLRIs through the BGP Inbound Policy Engine into the Local
BGP table (Loc-RIB). After installing NLRIs into the BGP Loc-RIB, ALDs start the
best path selection process.
288 Chapter 13: Direct Connect BGP Policy
When there are two or more entries about the same subnet, the BGP process
decides which one is the best in the following order. (1) Longest subnet mask (2)
Highest Weight value, (3) Highest Local-Preference value, (4) prefer locally
originated prefixes, (5) Shortest AS_Path attribute list, (6) prefer IGP < EGP <
Incomplete, (7) lowest MED. In the case of each Path-Attributes are equal, the
decision process prefers (8) eBGP over iBGP, (9) the lowest IGP metric to Next-
Hop, (10) When both paths are external, select the oldest one, (11), and as the last
step prefer the path through the neighbor that has the lowest BGP Route Id (RID).
DXGW has learned the subnets 172.16.0.0/24 and 172.16.1.0/24 via VIF attachments
dxvif-1234 and dxvif-5678. Let’s say that CE-1 has sent BGP Updates first to ALD-
1. That is why DXGW installs routes learned via VIF attachment dxvif-1234 into
Route Table based (BGP Best Path selection criteria 10).
In this example, we use a BGP Summary Route to ensure that DXGW forwards all
traffic from VPCs over the attachment dxvif-1234 to CE1. This policy does not
require any BGP configuration changes on CE1, but we create an aggregate route
in CE2. Example 13-1 shows how we configure an aggregate on the Cisco IOS
device. Note, CE2 advertises both route aggregate and original subnets if we do
not use the summary-only option.
When there are two or more entries about the same subnet, the BGP Figure 13-2
shows that ALD-1 learns both subnets 172.16.0.0/24 and 172.16.1.0/24 from CE1.
After route aggregation on CE2, ALD-2 receives the BGP Update about summary-
address 172.16.0.0/23 from CE2. DXGW learns routes over VIF attachments. It
installs all three subnets into the route table. The summary-address has a shorter
subnet mask (/23) than C-class subnets (/24). For this reason, DXGW routes traffic
towards subnets 172.16.0.0/24 or 172.16.1.0/24 over VIF attachment dxvif-1234.
The 5th step in the BGP Path-Selection process prefers the NLRI with the shortest
AS-Path. In figure 13-3, we advertise a summary route 17.16.0.0/23 on both CE
devices. Consider route aggregation because the AWS Direct Connect BGP device
accepts no more than 100 routes from the customer BGP peer. We intend to use the
ALD-1 over dxvif-1234 as our primary traffic path from DXGW to on-prem DC. In
this example, we prepend the AS-Path list in BGP Update advertised by CE2.
The example below illustrates how we can prepend the AS-Path list in the Cisco
IOS device. First, we create an IP prefix-list ON_PREM_AGGREGATE that permits
the aggregate route 172.16.0.0/23. Next, we configure a route-map ASW-DCX-
Egress-Policy. This route-map prepends the BGP AS-Path attribute list with one
local BGP ASN for the advertised subnet, which matches to aggregate address
defined in IP prefix-list ON_PREM_AGGREGATE. As the last step, we add the
route-map ASW-DCX-Egress-Policy under CE2 BGP configuration as outbound
policy.
The BGP Update sent by CE1 carries NLRI about subnet 172.16.0.0/23 with the
shorter AS-Path list. For this reason, DXGW forwards data received from TGW to
on-prem DC over VIF attachment dxvif-1234.
AWS allows us to use BGP communities for DXGW egress traffic engineering.
DXGW uses the following formula for setting BGP community-based Local-
Preference (LP). The BGP community 7224:7300 gives the “High" Local Preference,
the BGP community 7224:7200 gives the “Medium” Local Preference, and the BGP
community 7224:7100 gives “Low” Local Preference. Note that the AWS
documentation uses the definition of High/Medium/Low Preference, but in reality,
the value of LP is a number, and the higher number is better.
Figure 13-4 shows how CE1 and CE2 set an additional BGP Community Path-
Attribute to their BGP Update messages. CE1 uses the community value 7224:7300
(AWS High Preference), and CE2 uses the community value 7224:7100 (AWS Low
Preference). ALD-1 and ALD-2 propagate routing information with attached
communities to DXGW.
Example 13-3 shows how we can add a BGP community Path-Attribute into the
outgoing BGP Update messages about NLRI 172.16.0.0/23. We create an IP prefix-
list and route-maps, just like what we did with the AS-Path Prepending example.
The difference is that now the route-map action adds BGP Community Path
Attribute to outgoing BGP Update messages.
Figure 13-4 shows the BGP Inbound Policy of DXGW. It checks the community
values from all received routing updates. It gives the High Preference to routes
that has a Community value of 7224:7300. In our example, NLRI about the subnet
172.16.0.0/23 advertised by CE1 gets “High” Local Preference while the NLRI
originated by CE2 gets Low Preference. DXGW installs the route with the High
Preference to the routing table.
In order to avoid asymmetric traffic flows, we also have to create the BGP egress
policy in our CE routers in the on-prem Datacenter. There are many ways to do
that, but we use BGP Local-Preference Path-Attribute. The example below shows
the CE1 BGP configuration. It has an inbound policy AWS-Ingress-Policy, which
points to route-map ASW-DXC-Ingress-Policy. This route-map sets the BGP Local-
Preference value 300 for all routes that match the VPC CIDRs 192.168.0.0/24 and
192.168.1.0/24 defined in IP Prefix-List AWS-London-CIDRs. CE1 and CE2 are iBGP
peers. It means that CE1 advertises the NLRI to CE2 with the new BGP Local
Preference value of 300.
Example 13-5 shows the CE2 configuration. The only difference among the BGP
peer addresses is that now we change the Local-Preference value to 50.
When CE2 receives the BGP Update message from CE1, it installs the route to the
BGP Adj-RIB-In table and, from where it imports the information into the BGP Loc-
RIB. At this phase, it has two BGP entries about subnet 192.168.0.0/24. Next, the
BGP path selection process selects the best route. The subnet mask for both subnets
is the same /24. Also, the BGP Weight attribute is the same (default value 32768,
not shown in the figure). The Local-Preference is now the tiebreaker. Because NLRI
advertised by CE1 has a higher Local-Preference value, CE2 selects it as the best
route, and CE2 installs it to the routing table. CE2 does not send BGP Update to
CE1 because the best route is the route received from CE1. Note that we have
configured both CE routers to change the original Next-Hop Path-Attribute
(pointing to DXGW) to their iBGP peering addresses. The reason for this is that the
Next-Hop IP address carried with BGP Update has to be reachable, otherwise the
route is invalid.
Introduction
Amazon introduced an AWS Direct Connect SiteLink (DX SiteLink) solution in AWS
re:Invent at the end of 2021. DX SiteLink is a VIF-specific feature, which enables
data paths between customers’ remote sites over AWS Direct Connect terminated
to the same Direct Connect Gateway (DXGW).
Figure 14-1 illustrates the routing scheme when we haven’t enabled DX SiteLink
on dxvif-1234 and dxvif-5678. Customer edge routers CE-1 on DC-1 and CE-2 on
DC-2 have learned the customer VPC-1 CIDR range 192.168.0.0/24 from their eBGP
peering ALDs. DXGW propagates subnet 172.16.1.0/24 (DC-1’s local subnet) over
tgw-1234 association to Transit Gateway (TGW) but not over dxvif-5678
attachment to CE-2. The same routing policy applies to DC-2’s subnet
172.16.2.0/24. DXGW only propagates it over the tgw-1234 association to TGW.
Figure 14-2 shows the example of the routing scheme after we have enabled DX
SiteLink on dxvif-1234 and dxvif-5678. Now DXGW propagates routing
information about subnet 172.16.1.0/24 received over dxvif-1234 to TGW and
dxvif-5678. Besides, it propagates routing information about subnet 172.16.2.0/24
received from dxvif-5678 to TGW and dxvif-1234. DXGW prepends the BGP AS-
Path list as many times as there are Amazon Logical Devices (ALDs). In our
example, we have two ALDs. For example, The CE-2 receives BGP Update about
subnet 172.16.1.0/24 from ALD-2 with BGP AS numbers 64512 64512 65111 listed
in the AS-Path attribute list. After routing updates, the traffic path between sites
will be tunneled over AWS BackBone, bypassing AWS region, using the shortest
path. Note that all traffic over AWS BackBone is encrypted. Note that DXGW
advertises the subnets we are using for eBGP peering between ALDs and CEs.
Enabling SiteLink
You can enable the Virtual Interface SiteLink feature by selecting the Virtual
Interfaces option under the Direct Connect service. Then, select the VIF Settings
and then scroll down to Additional settings. To enable SiteLink, mark the Enable
SiteLink check box.
SiteLink Implementation
In figure 14-4, customer sites DC-1 and DC-2 have IP connectivity over the
corporate BackBone network. Both sites have a Dedicated Direct Connect
connection with the same DXGW. At this phase, we haven’t yet enabled SiteLink
in neither VIFs. Our intent is to start using the AWS BackBone Network as a
primary site-to-site WAN between DC-1 and DC-2 and the Corporate BackBone as
a backup WAN connection. To do that, we will use BGP standard communities to
signal which egress path CE-2 should use when forwarding data packets toward
subnet 172.16.1.0/24. In the first phase, we create a BGP ingress policy on CE-2 that
sets the Local-Preference value to 50 for all received NLRIs with BGP community
65111:50, and the Local-Preference value to 500 for all NLRIs with BGP community
65111:500. Next, we configure BGP Egress policies on CE-1. We attach the BGP
community 65111:50 to NLRIs, which we advertise to CE-2 over the Corporate
BackBone network. Besides, we add the BGP community 65111:500 to NLRIs,
which we advertise to ALD-1. Remember to enable neighbor-specific send-
community option under BGP configuration, otherwise communities are not
attached to outgoing BGP Update messages. Next, we turn on the SiteLink feature
on dxvif-1234 and dxvif-5678. Because we have changed the BGP egress policy on
CE-1, we have to re-send BGP Update messages to BGP peers. Cisco IOS command
clear ip bgp * soft out sends BGP routes from the local routing table through the BGP
Egress Policy Engine and attaches communities to BGP Update messages. After
BGP soft reset, CE-2 receives new BGP Updates about subnet 172.16.1.0/24, now
with BGP community 65111:500 from ALD-2 and the BGP community 65111:50
from BBR-2. Note that AWS Control-Plane protocol retains customer BGP
standards communities during the route propagation process. CE-2 imports the
NLRIs from the neighbor-specific Adj-RIB-In table into the BGP Loc-RIB table.
During the import process, the BGP Ingress policy sets the Local-Preference value
50 to route received via corporate BackBone and the Local-Preference value 500 for
routes received from the AWS side. Then CE-2 runs the BGP Best Path selection
algorithm. CE-2 installs the route received from ALD-2 into the routing table
because of the higher Local-Preference value.
AWS Networking Fundamentals 301
References
.
Introduction
This chapter introduces how we can use an AWS Direct Connect connection (DX)
and a Public Virtual Interface (P-VIF) attached with it to access AWS Public Service
like Amazon Simple Storage Service (S3) and AWS DynamoDB.
The upper part of figure 15-1 illustrates how we can adjust BGP Update messages
propagation using BGP communities. The eBGP peering between AWS and
Customer Devices is established over DX connection using public IP addresses. I
haven’t registered any public IP address, therefore I am using the “subnet“
x.y.z.0/30. Our example company, Company-X, uses Private IP subnets on the on-
prem location. For this reason, we have to hide the real source IP addresses of data
packets towards AWS Public services. We use Port Address Translations (PAT) for
changing the source IP address to IP address x.y.z.1, which is the Public IP address
that the Customer Device uses for eBGP peering. That’s why we advertise the
“subnet” z.x.y.0/30 to AWS.
The geographical scope of the BGP Update message without BGP community
value, or with BGP community 7224:9300, is global. In our example, the DX
Location (DCL) is on AWS Region eu-north-1 (Stockholm). When the AWS device
in our example receives BGP updates with BGP community 7224:9300 (2) or
without BGP community (1), it propagates the route within AWS region eu-north-
1, from where it is advertised globally (EU Intra and Inter-Regional). However,
AWS does not advertise subnet carried within the BGP Update message to other
customers over their DX or to the Internet. That said, routes we are advertising to
AWS stay within the AWS Backbone. The subnets we advertise to AWS are
reachable over our DX connection for all customers' EC2 instances running on the
VPCs on the AWS cloud. Therefore, we have to use the Data-Plane ingress policy
filter at your side. In our example, we are using a FireWall for filtering traffic.
304 Chapter 15: Direct Connect - Public Virtual Interface
We use a BGP community value 7224:9200 on the third BGP Update example. The
scope of this BGP Update message is Intra-Continental AWS regions. In our
example, the AWS device peering with our CE device is in the Stockholm region
(eu-north-1), so the BGP Update message stays with Europe.
In the fourth BGP Update example, we use BGP community value 7224:9100. The
scope of this community value is intra-Region. AWS Backbone devices do not
advertise the subnet to any other region. In our example, the NLRI carried within
the fourth BGP Update message stays within the AWS region eu-north-1.
AWS uses Unicast Reverse Path Forwarding (uRPF) checks against IP address
spoofing. When the AWS DX Device receives traffic from the Customer Device, it
verifies that it has a route to the source IP address. AWS does not describe how
they have implemented the uRPF. However, I assume that the route doesn’t have
to point back to the interface where the packet is received because it excluded the
asymmetric routing and eBGP Equal-Cost Multipath (ECMP) solutions. After
these validations, AWS DX Device forwards routes packet.
AWS adds BGP communities for BGP Updates advertised over Public VIF to
customers. BGP communities 7224:8100 and NO_EXPORT have been added to all
BGP Updates messages, which describe NLRIs originated from the same AWS
region in which we terminate our DX connection. The NO_EXPORT community
states that this NLRI have to stay within our BGP domain. AWS adds BGP
communities 7224:8200 and NO_EXPORT to all BGP Updates messages originated
from the Intra-Continent AWS regions. The NLRIs outside the continent, in which
we have terminated our DX connection, carry only BGP community NO_EXPORT.
Note that BGP Update has at minimum three BGP ASN listed in the AS-Path list.
In figure 15-2, AWS advertises three subnets to us. The subnet 52.46.220.0/22 is
originated from the same AWS region (eu-north-1) in which we have terminated
our DX connection, so the BGP Update message carries communities 7224:8100
and NO_EXPORT. The second advertised subnet is 52.56.0.0/16. From our
perspective, it is originated from the Intra-Continental AWS region (eu-west-2).
That is why the BGP Update carries the BGP community value 7224:8200. The
subnet 54.245.0.0/16 is originated from the AWS region us-west-2, which is the
Inter-Continent region from our point of view. The BGP Update message
describing this subnet has only the NO_EXPORT BGP community.
We can define an egress policy based on BGP communities. For example, only BGP
Updates with the BGP community 7224:8100 are eligible to be installed into BGP-
Loc RIB and further to RIB (if it is the best route). Besides, we can set the BGP Local-
Preference value based on the received BGP community value. If we want to allow
connection initiation from the subnets from the AWS side, we also have to permit
it in our Fire Wall policy rule.
Navigate to the Virtual Interface window and select the Public as a Virtual Interface
type.
Scroll down to the Public virtual interface settings section. Give the name to the
Public VIF and choose the DX connection to which you want to attach the VIF from
the Connection drop-down menu. Besides, define the VLAN-Id for VIF.
Fill in the BGP ASN field and select the IPv4 as BGP Address Family. We use eBGP
peering IP address as a source IP address for egress traffic (remember that we are
using PAT in this example). That is why the subnet has to be public. Subnet
x.y.z.0/30 in the figure below simulates the public IP subnet. We are using only
private IP subnets within the on-prem site. Therefore, we only have to advertise
the eBGP peering subnet to AWS. Note that AWS verifies that we own the subnet
we are advertising.
308 Chapter 15: Direct Connect - Public Virtual Interface
You can set the BGP authentication key and Tags in the Additional settings section.
Click the Create virtual interface button when filling in all required information.
References
AWS Direct Connect User Guide: Routing policies and BGP communities
https://docs.aws.amazon.com/directconnect/latest/UserGuide/routing-and-bgp.html
In case you want to learn more about LISP, OMP, or BGP EVPN…
These books are available at Leanpub.com (pdf) and Amazon (Kindle,
paperback)