LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2022, 01:36 PM   #1
glestwid
LQ Newbie
 
Registered: Apr 2018
Posts: 16

Rep: Reputation: Disabled
Question Routing with VPN doesn't work, I wonder why?


Hi,

I'm establishing a VPN connection, but it doesn't seem to work like I thought. Here's the resulting routing table ant the traceroute output:

Code:
root@porteus:/home/guest# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
10.8.0.1        10.8.0.5        255.255.255.255 UGH   1000   0        0 tun0
10.8.0.5        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
192.168.0.0     10.8.0.5        255.255.255.0   UG    1000   0        0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
root@porteus:/home/guest# traceroute www.whatismyipaddress.com
traceroute to www.whatismyipaddress.com (104.16.155.36), 30 hops max, 60 byte packets
 1  home (192.168.1.1)  1.719 ms  3.817 ms  3.892 ms
 2  172.17.1.50 (172.17.1.50)  6.225 ms  6.078 ms  6.031 ms

I tried to specify in my OVPN file route-metric 0 but no luck, all packets are still not using my VPN at all. What should I change to make my VPN interface tun0 to be default and the only interface for all TCP/IP communications on my machine?

Last edited by glestwid; 10-20-2022 at 04:25 PM.
 
Old 10-20-2022, 01:48 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
First of all, please use a "code tag" on the above output to make it monospace (courier) and thus easier to read.

Then, please specify exactly what packets are "not behaving as you expected." What are the IP-addresses that you intend to be targeting? Also, what is the configuration of the server at the other side?
 
Old 10-20-2022, 04:29 PM   #3
glestwid
LQ Newbie
 
Registered: Apr 2018
Posts: 16

Original Poster
Rep: Reputation: Disabled
I expected the site www.whatismyipaddress.com to display my current IP address as if it were the VPN server address from OVPN file, but it is still showing me my original IP as if there're no VPN connection at all. Regarding the settings on the VPN server side all what I know it's a TP-Link router that supports OpenVPN server mode with quite a few settings available on its web GUI. But I used to see this model providing a correct VPN IP address for its clients, so I think there're might be a way of tweaking the client's OVPN file for achieving this.
 
Old 10-22-2022, 04:53 PM   #4
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 207

Rep: Reputation: 44
1) you aren't secure if your routing table isn't. ipv6 btw "embeds software that can change your route table unless you know how to block it". i still use ipv4 just so i don't have to hack all the "support and software hack possibly malicious payloads in ipv6" actually. But i don't suggest you use VPN for anything except preventing weak attacks (ie, by neighbor teen gamers)

2) Try routed(1) or some equivalent program that writes the route table for you. TLDP.org used to have ipv4 docs how to do routing by hand I think they've "hidden it" and give only ubuntu instructions today - IDK. but it's a lengthy discussion.

it's very simply. the first valid route is where your packet will go ( UNLESS THE FIREWALL BLOCKS IT). if you have an erronous route table then no packet will go anywhere.
 
Old 10-22-2022, 04:56 PM   #5
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 207

Rep: Reputation: 44
If you are using "tunneling" to do VPN and doing it by hand I suspect you'll need directions. Few would do that unless providig automated VPN for a new distribution. Maybe you should try installing software that sets it up for you if your anxious to get it working.
 
Old 10-23-2022, 07:21 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
It's actually very simple: since your stated destination, 104.16.155.36, does not match any of the listed "destinations" as masked by their respective "genmasks," your traffic is simply being routed through the default, which is the first entry, which specifies eth0.

If you actually want all of your network traffic to pass through tun0, then your network routing rules must specify this as the "default route."

To clarify: the very-essential concept of "VPN" is that it presents itself to the rest of the system as "an otherwise-ordinary internet router or (maybe) switch." These devices customarily occupy a particular "non-routable" IP-address range, such as [b]10.8.0.x, which they use to communicate among themselves. To all of their clients, these addresses serve as "gateways."

Right now, as you are "browsing the internet," your home computer is "talking to the internet" through a "gateway" which is probably "192.168.1.1." And, the "subnet" that is covered by this gateway is ... "everything, everywhere." But, VPNs introduce another "gateway," through which some particular subset of network traffic is (securely ...) diverted. The clients of that gateway neither know nor care that the traffic thus diverted is "secure." Your current routing rules divert only three particular streams of traffic into that secure tunnel.

Last edited by sundialsvcs; 10-23-2022 at 07:40 PM.
 
Old 10-24-2022, 09:41 AM   #7
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,018

Rep: Reputation: Disabled
Maybe edit your resolv.conf
If it lists your ISP nameserver along with VPN nameserver, then you will see leaks as both connestions are active.
 
  


Reply

Tags
route table, vpn openvpn bridge



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an vpn server and routing all trafic to remote vpn server darktic Linux - Server 7 02-19-2018 01:13 PM
VPN not routing through server but still local routing pptpd narnie Linux - Server 1 01-21-2014 06:03 PM
Application specific routing (not routing p2p over vpn) tkalfaoglu Linux - Networking 1 06-15-2013 06:33 AM
I wonder why a program I made with streams is taking so much memory eantoranz Programming 5 04-30-2004 07:37 PM
ATI TV Wonder, why is picture rolled? Infinity Linux - General 1 10-18-2001 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration