Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
routing one destination (only) through a vpn [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1523

PostPosted: Sun Jun 18, 2017 11:45 am    Post subject: routing one destination (only) through a vpn [solved] Reply with quote

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

Start with something simple:

Code:

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

Code:

$ 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
Back to top
View user's profile Send private message
mike155
l33t
l33t


Joined: 17 Sep 2010
Posts: 988
Location: Frankfurt, Germany

PostPosted: Sun Jun 18, 2017 12:19 pm    Post subject: Reply with quote

Code:
route add 1.2.3.4/32 gw 10.0.0.3
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1523

PostPosted: Sun Jun 18, 2017 6:58 pm    Post subject: Reply with quote

bug_report wrote:
Code:
route add 1.2.3.4/32 gw 10.0.0.3


That worked. Thank.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum