> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/networking/router.md).

# Router

#### **What is a Network Router?**

**The Role of a Switch vs. Router**

* **Switches:** These are used to connect devices on the same local network. They operate at Layer 2 of the OSI model, primarily using MAC addresses to ensure data packets reach the correct destination within a local segment.
* **Routers:** These are essential for connecting two or more different networks. They operate at Layer 3 and use IP addresses to direct data traffic between these distinct networks.

**Key Networking Concepts**

* **IP Addresses:** These act as the addresses for individual devices. Devices on the same network typically belong to the same range of IP addresses.
* **Default Gateway:** This is the router's IP address on a local network. When a device realizes it needs to send data to an IP address outside of its own network range, it forwards the traffic to its gateway (the router) to be passed along to the destination.
* **ARP (Address Resolution Protocol):** This is the process used by devices to find the MAC address of a destination when they only have the IP address. A broadcast message is sent to all devices on the network, and the device that owns the target IP address responds with its MAC address.

**How Data Travels**

* When a device sends data to a different network, it uses both Layer 2 (for the switch to find the router's interface) and Layer 3 (for the router to determine the path to the final destination).
* Routers maintain a "routing table" or a map that tells them which interface to use to reach specific destination networks.

**The Role of DNS**

* DNS (Domain Name Service) is the system that translates user-friendly names (like a website URL) into the actual IP addresses that computers use to communicate across networks.

**Common Commands**

* **show ip route:** This command is used on a Cisco router to display the routing table, which shows how the router is connected to various networks and how it routes traffic between them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://capcap-1.gitbook.io/capcap/readme/networking/router.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
