What is Destination and Target in Route table? I can see Destination and target can be configured to Internet gateway, is there any other use case ?
A short answer:
Destination: the packet's final destination
Target: where the packet should go next, to get it one step closer to the intended destination.
e.g.
You are planning a business trip from the US to Paris.
- Destination: Paris
- Target: US airport, fly to Paris.
Each route has a destination and target field.
- Destination field specifies the pattern that a request must match with its destination address (IP or CIDR range).
- Target field specifies where such a request should be routed. It could be
local
(i.e. to targets in this VPC) oryour-internet-gateway-ID
in case those requests should be routed to the gateway for external/somewhere-else access. A list of possible target values is here.
Here's an example assuming a VPC with addresses 10.0.0.0/16
| Destination | Target |
|:------------|------------:|
| 10.0.0.0/16 | local |
| 0.0.0.0/0 | your-igw-id |
This will route any request with into-the-VPC destination to local targets in the VPC. If the pattern 10.0.0.0/16
is not met, the any-ipv4-address aka 0.0.0.0/0
will be considered and the request will be routed to the internet gateway you specified with ID your-igw-id
.
The order of the routes is irrelevant since the most specific route will be chosen.
Destination => IP address/CIDR range .
Target => Where you want to send the traffic for the specified destination (e.g. if the destination is my local subnet, mention target as "local")
The Internet gateway is one of the targets (e.g. routing traffic to the internet). Other options for the target would be
- NAT Gateway
- Virtual Private Gateway
- VPC endpoint
- VPC peering connection etc. depending on your architecture
Route table document explains it well.
This is easy to comprehend, for any entry in a Route Table there are the following 2 parts:
- Destination - This is an IP Address or a CIDR Range. To plan this out, consider outgoing traffic from any instance inside a VPC. This outgoing traffic will have some destination IP Address, and the route will just handle the request to the target, which is the second part of the entry.
- Target - Target is just the destination the request will be redirected to for getting processed.
Example: Destination: 0.0.0.0 and Target: Internet Gateway - Here all traffic will be passed on to the Internet Gateway
This is how I understand?
destination : Final target or Goal
target : Immediate target to achieve final target(via)
Ex:
destination can be Orthopedic Doctor
target can be MBBS, which a College student can take(via) to reach his final target or destination i.e his/her final goal, Orthopedic specialization.
destination is just destination.
target is next hop, but different from on premises, next hop don't use IP address but identifier
© 2022 - 2024 — McMap. All rights reserved.