Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to make vpn the default route [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
oteren
n00b
n00b


Joined: 06 Feb 2007
Posts: 1

PostPosted: Tue Feb 06, 2007 2:13 pm    Post subject: How to make vpn the default route [SOLVED] Reply with quote

I live in a student home, and to connect to the internet I have two choices.

1. Just type in any webpage, get a popup box and use my username/pw through the proxy.

2. Connect to a VPN server and get my own IP and a non-NAT'ed connection to the internet.

I obviously hate sitting behind the proxy, cause it resets every 30 minutes, kicking me off msn/irc and forcing me to log back in.
Using the guide i found on gentoo-wiki.com I have gotten the vpn up and running, no problem (awesome guide btw, cred to whoever made it).

According to that guide you can just set "defaultroute" as an option in the conf.d/net, but that doesnt do anything here.
So i made my own rule in the net config, using a guide I also found on gentoo-wiki.

No matter how I add routes to ppp0, the eth0 one -ALWAYS- overrides whatever I do.
So no matter if my vpn is up and running, all traffic is always routed through eth0 and the proxy.
Even when the proxy times out and need a re-login, it wants to route through eth0, even though there
should be a working route for ppp0. So in effect, I just end up with "no route to host" whenever the proxy
times out.

I need help! :(

My conf.d/net:
Code:
config_eth0=( "dhcp" )
dhcp_eth0=""

config_ppp0=( "ppp" )
pppd_ppp0=(
  "persist"
  "call uib"
  "holdoff 10"
  "mru 1460"
  "mtu 1460"
  "idle 600"
  "defaultroute"
)
link_ppp0="pty \"pptp 10.0.0.2 --nolaunchpppd\""

routes_ppp0=( "-net 0.0.0.0 netmask 0.0.0.0 gw 129.177.45.1" )



Route table, with and without -n, no idea what the difference is really..
Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
uib-vpn-gw.uib. *               255.255.255.255 UH    0      0        0 ppp0
10.8.6.0        *               255.255.254.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         *               0.0.0.0         U     0      0        0 eth0
default         uib-vpn-gw.uib. 0.0.0.0         UG    0      0        0 ppp0

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
129.177.45.1    0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
10.8.6.0        0.0.0.0         255.255.254.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0
0.0.0.0         129.177.45.1    0.0.0.0         UG    0      0        0 ppp0


[edited in] Just for the record, I have no idea if it is correct to set 129.177.45.1 (the vpn server) as a gateway, but when I leave it blank (as in route add default ppp0) something gets messed up, and the pptp software loses connection to the vpn server and the vpn link dies.
As also happens when I remove the eth0 default route.
[/edited in]

Proof the vpn tunnel is up and running(and working):
Code:

Malaz oliver # tracepath 129.177.45.1
 1:  tunnel-45-43.vpn.uib.no (129.177.45.43)                0.091ms pmtu 1456
 1:  uib-vpn-gw.uib.no (129.177.45.1)                       1.449ms reached
     Resume: pmtu 1456 hops 1 back 1


How a random tracepath looks:
Code:
Malaz oliver # tracepath www.vg.no
 1:  dhcp-8-7-70.alrek.privnett.uib.no (10.8.7.70)          0.097ms pmtu 1500
 1:  gw.alrek.privnett.uib.no (10.8.6.1)                   12.403ms
 2:  proxy-gw.privnett.uib.no (10.0.0.9)                    1.198ms
 3:  uib-bt-gw.uib.no (129.177.138.97)                      1.830ms
etc etc etc


How ifconfig looks:

Code:
eth0      Link encap:Ethernet  HWaddr 00:17:31:83:07:4F 
          inet addr:10.8.7.70  Bcast:10.8.7.255  Mask:255.255.254.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3830369 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533050 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:975907494 (930.6 Mb)  TX bytes:48322773 (46.0 Mb)
          Interrupt:17 Base address:0x6000

ppp0      Link encap:Point-to-Point Protocol 
          inet addr:129.177.45.43  P-t-P:129.177.45.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1456  Metric:1
          RX packets:83 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:8257 (8.0 Kb)  TX bytes:1548 (1.5 Kb)


Not sure what other info is useful, just tell me what I need to put in here and I will do so asap.

Thx to whoever even bothered reading this far down :)


Solution:

Add a static route to 10.0.0.2(vpn server), delete eht0 default route, reinstate vpn.
Voila!
Back to top
View user's profile Send private message
keli
Apprentice
Apprentice


Joined: 18 Jul 2003
Posts: 210
Location: TgMures, RO

PostPosted: Wed Feb 07, 2007 12:15 pm    Post subject: Reply with quote

You don't (or at least shouldn't need to) reinstate your vpn, just delete the eth0 default route, or alternatively increase it's metric value, while you're using the VPN.

When you disconnect, you might want to add back (if deleted) the eth0 default route. However, if it's the only default route, it will be used regardless of it's metric.

Ex: route to eth0-with a metric of 2 will never be used if there's a route to ppp0 with (default) metric of 0. But if the ppp0 interface goes down (usually when you disconnect from the VPN) you still have a default route.
_________________
"The future masters of technology will have to be lighthearted and intelligent. The machine easily masters the grim and the dumb."
Marshall McLuhan, 1969
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