Route table
A route table in networking is a data table stored in a router or a networked computer that lists the routes to particular network destinations. It contains information about the topology of the network immediately around it. Here are some key points:
Destination Network: Specifies the IP address of the destination network.
Subnet Mask: Used to determine the network portion of an IP address.
Gateway: The next hop IP address to which the packet should be forwarded.
Interface: The outgoing network interface the packet should be sent through.
Metric: A value that indicates the cost of using a particular route, with lower values generally preferred.
In the context of cloud services like AWS, Azure, or GCP, a route table is used to control the routing of traffic within a virtual network.
Here's an example of a simple route table:
Destination | Subnet Mask | Gateway | Interface | Metric |
---|---|---|---|---|
192.168.1.0 | 255.255.255.0 | 192.168.1.1 | eth0 | 1 |
10.0.0.0 | 255.0.0.0 | 10.0.0.1 | eth1 | 10 |
0.0.0.0 | 0.0.0.0 | 192.168.1.254 | eth0 | 100 |
In this table:
- Traffic destined for the
192.168.1.0
network will be routed through the gateway192.168.1.1
via interface eth0. - Traffic for the
10.0.0.0
network will go through the gateway10.0.0.1
via interface eth1. - The default route (
0.0.0.0
) will send traffic to192.168.1.254
if no other specific route matches. - Understanding route tables is crucial for network configuration and troubleshooting.
Routing Table in AWS
- Is the central routing function.
- It connects the different availability zones together and connect the VPC to the Internet
- You can have up to 200 route table for VPC.
- You can have up to 50 route table entries per round table.
- Each subnet must be associated with only route table at any event time.
- If you do not specify a subnet to route table association, the subnet will be associated with the default VPC route table.
- The default route table can be modified but cannot be deleted if no other main route table exist.
- You can make a custom route table manually and decalre as main route table and then you can delete the default main route table as if no longer a main route table.
- By default every round table contain a local route for communication with the VPC.
- Each route specifies a destination and target.
Route Table for Private Subnet -
Destination | Target |
---|---|
10.0.0.0/16 | local |
0.0.0.0/0 | nat-XXXXX |
Route Table for Public Subnet -
Destination | Target |
---|---|
10.0.0.0/16 | local |
0.0.0.0/0 | igw-XXXXX |