Skip to main content
IMHCloud Logo
Back to glossary

Router

A router connects separate networks and directs traffic between them using routing rules and tables.

What is a Router in cloud hosting?

A router is a network device that connects two or more separate networks and directs traffic between them. It examines the destination address of each data packet and forwards it to the correct network based on routing rules.

In cloud hosting, routers enable communication between different subnets within your VPC (Virtual Private Cloud), and between your private cloud network and external networks like the public internet. Without a router, instances on different subnets cannot talk to each other, and your cloud resources cannot reach external services or users.

Why Routers Exist

Before routers, networks were either completely isolated from each other or physically connected with simple bridging. This created two major problems in cloud hosting:

  1. Network isolation: Without routers, every subnet would be an island. Instances on separate subnets could not communicate, forcing all resources onto a single flat network.
  2. No internet access: Cloud instances on private networks need a way to reach external APIs, download updates, and serve users. Without a router providing a gateway, instances are completely cut off from the outside world.

Routers solve these problems by acting as intelligent traffic directors. They connect separate networks while maintaining security boundaries and enable controlled access between private cloud resources and the public internet.

What Do Routers Actually Do?

A router performs these specific functions in your cloud network:

  • Connects multiple subnets: Links separate subnets within your VPC so instances on different network segments can communicate with each other
  • Routes traffic between networks: Examines the destination IP address of each packet and forwards it to the correct subnet or external network
  • Provides gateway to internet: Acts as the exit point for instances that need to reach external networks or the public internet
  • Maintains routing table: Stores rules that define which network destinations are reachable and through which network interface
  • Enforces network boundaries: Only forwards traffic according to routing rules, preventing unauthorized cross-network communication
  • Enables SNAT (Source NAT): Translates private IP addresses to public IPs for outbound internet traffic so instances can communicate externally

When would I use a Router?

You need a router in these common cloud hosting scenarios:

Multi-tier application architecture: When your application has separate subnets for web servers, application servers, and databases, a router connects these tiers so they can communicate.

Internet access for private instances: When instances on private subnets need to download software updates, call external APIs, or reach public services, a router with an external gateway provides that connectivity.

Connecting multiple environments: When you have separate development, staging, and production networks, routers can connect them while maintaining isolation through routing rules.

Hybrid cloud connectivity: When connecting your cloud VPC to an on-premises data center or another cloud provider, routers handle the traffic exchange between these separate networks.

When would I NOT use a Router?

Routers add complexity and are unnecessary in these situations:

Single flat network: If all your instances exist on one subnet with no need for network segmentation, you do not need a router. A single flat network simplifies architecture when isolation is not required.

Completely isolated resources: If you intentionally want instances that cannot communicate with anything outside their immediate subnet and do not need internet access, adding a router would defeat that isolation.

Very small deployments: For a single instance running a simple application with no multi-tier architecture or external dependencies, the default network configuration may be sufficient without custom routing.

Cost-sensitive minimal setups: In some cloud providers, routers consume resources or incur charges. If you are running the absolute minimum infrastructure on a tight budget, a simpler network topology without routers may reduce costs.

Real-world example

Company A runs an e-commerce platform on InMotion Cloud with a three-tier architecture. They have three subnets: a frontend subnet (10.0.1.0/24) for web servers, an application subnet (10.0.2.0/24) for API servers, and a database subnet (10.0.3.0/24) for PostgreSQL.

Without a router, these subnets cannot communicate. The web servers cannot reach the API servers, and the API servers cannot query the database. All three tiers are isolated islands.

Company A creates a router and attaches all three subnets to it. They configure routing rules so the frontend subnet can reach the application subnet, and the application subnet can reach the database subnet. The router also connects to the internet gateway, allowing the frontend web servers to serve users and the application servers to call external payment APIs.

Now traffic flows correctly: Users reach the frontend web servers via floating IPs. The web servers forward requests to the API servers through the router. The API servers query the database and call external payment services through the same router. Each subnet remains logically separated while the router enables controlled communication between them.

Frequently Asked Questions

Do I need more than one router?

Most cloud VPCs use a single router that connects all subnets and provides the gateway to external networks. Multiple routers are only needed for advanced scenarios like connecting to multiple external networks with different routing policies or creating complex network topologies with strict isolation requirements. Start with one router and add more only if you have a specific architectural need that requires it.

Does creating a router affect existing resources?

Creating a router by itself does not affect existing instances or networks. The router exists but does nothing until you attach subnets to it and configure routing rules. Once you attach a subnet to a router and add routes, instances on that subnet gain connectivity to other routed networks. Existing instances will immediately be able to reach new networks according to the routing table without rebooting or reconfiguration.

What happens if I delete a router?

Deleting a router breaks all network connectivity for attached subnets. Instances on those subnets lose the ability to communicate with other subnets and cannot reach external networks or the internet. Any running applications that depend on cross-subnet communication or external API calls will fail. Before deleting a router, ensure no active resources depend on it or migrate those resources to a different network topology.

Can I control which subnets talk to each other?

Yes, through routing rules and security groups. While attaching multiple subnets to a router creates potential connectivity, you control actual communication through routing table entries and security group rules. You can configure routes that allow only specific subnet-to-subnet traffic or use security groups to block traffic from certain sources even if routes exist. This combination gives you fine-grained control over network access.

How do I give internet access to instances on a private subnet?

Attach the private subnet to a router that has an external gateway configured. Add a default route (0.0.0.0/0) in the routing table that points to the gateway. Enable SNAT on the router so it translates private IPs to public IPs for outbound traffic. Instances on the private subnet will then be able to initiate connections to the internet for updates or API calls while remaining inaccessible from the internet for inbound connections.

Summary

  • A router connects separate networks and directs traffic between them based on routing rules
  • It enables instances on different subnets to communicate and provides gateway access to external networks
  • Routers are essential for multi-tier applications, internet connectivity, and hybrid cloud architectures
  • They maintain routing tables that determine where packets should be forwarded
  • Use a router when you need network segmentation with controlled connectivity; skip it for simple single-subnet deployments

Related terms

Understanding routers requires familiarity with these cloud networking concepts:

  • Subnet: A subnet (isolated network segment) is a subdivision of a network where instances share the same IP address range, such as 192.168.1.0/24 or 10.0.2.0/24.
  • Security Group: A security group (firewall rule set) controls which network traffic can reach instances, such as allowing SSH on port 22 or HTTP on port 80.
  • Floating IP: A floating IP (public IP address) allows an instance on a private network to be accessible from the internet by mapping a public address to its private address.
  • Private Network: A private network (isolated cloud network) keeps instance communication internal and invisible to the public internet, such as a backend database network.