# Policy-based routing

![](https://3594902569-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LA8bJEHYZEGCK8WGuvC%2F-LN6bHx53c13gz26-kKK%2F-LN6dA34qF4XpSH0_fKz%2Fimage.png?alt=media\&token=008cebd4-9464-4ede-be85-90d84ede19c1)

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
```
