Find the answer to your Linux question:
Results 1 to 4 of 4
I'm trying to get VPN correctly set up (tun0 interface). Whenever I start vpn by running Code: sudo service openvpn start the tun0 interface kicks in, but I get no ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    14

    Unhappy Need help getting correct ip routing with VPN


    I'm trying to get VPN correctly set up (tun0 interface). Whenever I start vpn by running
    Code:
    sudo service openvpn start
    the tun0 interface kicks in, but I get no Internet. Also I'd like the eth0 interface to be the default route. The tun0 interface is only supposed to be used by a specific user, not my main user.

    So there are two problems I need help solving:
    • Get Internet when using the tun0 interface.
    • Make eth0 the default interface when both eth0 and tun0 are active.


    My route -n output after starting VPN is
    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.109.1.5      128.0.0.0       UG    0      0        0 tun0
    0.0.0.0         192.168.19.1    0.0.0.0         UG    0      0        0 eth0
    10.109.1.1      10.109.1.5      255.255.255.255 UGH   0      0        0 tun0
    10.109.1.5      0.0.0.0         255.255.255.255 UH    0      0        0 tun0
    46.165.251.68   192.168.19.1    255.255.255.255 UGH   0      0        0 eth0
    128.0.0.0       10.109.1.5      128.0.0.0       UG    0      0        0 tun0
    192.168.19.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
    192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
    Before starting VPN it is:
    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.19.1    0.0.0.0         UG    0      0        0 eth0
    192.168.19.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
    192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    626
    The VPN added a second "default gateway" which is now the one being used. As root (or via sudo) do the following after connecting to the VPN:
    Code:
    route del default gw 10.109.1.5 tun0
    Then if you look at your route table you should see:
    Code:
    ernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.19.1    0.0.0.0         UG    0      0        0 eth0
    10.109.1.1      10.109.1.5      255.255.255.255 UGH   0      0        0 tun0
    10.109.1.5      0.0.0.0         255.255.255.255 UH    0      0        0 tun0
    46.165.251.68   192.168.19.1    255.255.255.255 UGH   0      0        0 eth0
    128.0.0.0       10.109.1.5      128.0.0.0       UG    0      0        0 tun0
    192.168.19.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
    192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

  3. #3
    Just Joined!
    Join Date
    Jun 2006
    Posts
    14
    Thanks, but I get
    Code:
    SIOCDELRT: No such process
    when I try to delete it.

  4. #4
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    626
    I errored, it should be "eth0" not "tun0". Sorry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •