> For the complete documentation index, see [llms.txt](https://hamidsec.gitbook.io/cisco/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hamidsec.gitbook.io/cisco/policy-based-routing.md).

# Policy-based routing

![](/files/-LN6dA34qF4XpSH0_fKz)

In this diagram, we're going to map the PC1 traffic to the R1 and ISP1 router and the P2P traffic to the ISP2.

```
(config)# ip access-list standard PC1
(config-ext-nacl)# permit host 192.168.0.2

(config)# ip access-list extended P2P
(config-ext-nacl)# permit tcp host 192.168.0.0 0.0.0.255 any eq 6881
```

Now, start writing your route-map based on your access-list:

```
(config)# route-map HRT permit 10
(config-route-map)# match ip address PC1
(config-route-map)# set ip next-hop 10.1.1.2
```

Set the P2P service for the ISP2:

```
(config)# route-map HRT permit 20
(config-route-map)# match ip address P2P
(config-route-map)# set ip next-hop 10.1.2.2
```

Set the other traffic to the ISP1, so just write the set command without match:

```
(config)# route-map HRT permit 30
(config)# set ip next-hop 10.1.1.2
```

Finally, add the policy you've defined in the interface:

```
(config)# interface GE2/2/23
(config)# ip policy route-map HRT
```


---

# 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:

```
GET https://hamidsec.gitbook.io/cisco/policy-based-routing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
