# routing one destination (only) through a vpn [solved]

## curmudgeon

Either I am missing something easy, or this is much more complicated than I thought.

Start with something simple:

```

$ route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.0.254   0.0.0.0         UG    3      0        0 net0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 net0

```

Add a vpn:

```

$ ip addr

[...]

10: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100

    link/none 

    inet 10.0.0.4 peer 10.0.0.3/32 scope global tun0

       valid_lft forever preferred_lft forever

$ route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.0.254   0.0.0.0         UG    3      0        0 net0

10.0.0.1        10.0.0.3        255.255.255.255 UGH   0      0        0 tun0

10.0.0.3        0.0.0.0         255.255.255.255 UH    0      0        0 tun0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 net0

```

How do I send all of the traffic for a destination (say 1.2.3.4) through the vpn (and nothing else)?Last edited by curmudgeon on Sun Jun 18, 2017 6:58 pm; edited 1 time in total

----------

## mike155

```
route add 1.2.3.4/32 gw 10.0.0.3
```

----------

## curmudgeon

 *bug_report wrote:*   

> 
> 
> ```
> route add 1.2.3.4/32 gw 10.0.0.3
> ```
> ...

 

That worked. Thank.

----------

