Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just setup the OpenVPN and it is working as expected. However, the routing table of the client is confusing me to no end. Here is the route table:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.8.0.5        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
10.8.0.1        10.8.0.5        255.255.255.255 UGH   0      0        0 tun0
54.202.18.143   10.0.2.2        255.255.255.255 UGH   0      0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     1      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         10.8.0.5        128.0.0.0       UG    0      0        0 tun0
128.0.0.0       10.8.0.5        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

So lets dissect it line-by-line

  1. Any packet destined for 10.8.0.5 has no gateway and will use tun0
  2. any packet destined for 10.8.0.1 will use 10.8.0.5 as gateway via tun0
  3. any packet destined for 54.202.18.143 will use 10.0.2.2 as gateway via eth0
  4. any packet destined for 10.0.2.0/24 has no gateway and will use eth0
  5. Lets ignore the 169.254.0.0 part
  6. All other packets (destined for 0.0.0.0) will us 10.8.0.5 as default gateway via tun0. So this is default gateway, isn't it?
  7. Any packet destined for 128.0.0.0/7 will use 10.8.0.5 as default gateway via tun0
  8. All other packets (0.0.0.0) will use 10.0.2.2 as default gateway via eth0

Questions:

  • Do I have 2 default gateways if we consider point 6 and 8? (there can be only 1 Default Gateway though, so I know I am wrong but can't justify) (probably answered, see below)
  • Considering point 1 and 2, anything going for 10.8.0.1 is not really using any gateway via tun0. Is this correct?
  • Considering point 3 and 4, anything going for 54.202.18.143 is not really using any gateway via eth0. Is this correct?

UPDATE...

After reading this, I found some more information. The below lines makes a lot of sense to me now:

0.0.0.0         10.8.0.5        128.0.0.0       UG    0      0        0 tun0
128.0.0.0       10.8.0.5        128.0.0.0       UG    0      0        0 tun0

So, the 1st line is defining 0.0.0.0/128.0.0.0 and second one is defining 128.0.0.0/128.0.0.0. Essentially:

0.0.0.0/128.0.0.0 = 0.0.0.0/1 = 128.0.0.0 TO 255.255.255.255
128.0.0.0/128.0.0.0 = 128.0.0.0/1 = 0.0.0.0 TO 127.255.255.255

So, above 2 routes are covering the entire IPv4 Address range [0.0.0.0 TO 255.255.255.255]. It is a clever way of OpenVPN to add a default route without replacing the original default route and this default route will be routed via tun0.

So I think I have an answer for my first question:

Do I have 2 default gateways if we consider point 6 and 8?

NO, there is only one default gateway and that is :

0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
share|improve this question
2  
The first 0.0.0.0 route has Genmask 128.0.0.0 which probably doesn't make it a default route. I have to say though that I don't have the slightest idea what this mask means and what is route is there for :/ –  Martin von Wittich Jan 24 at 9:14
    
Also be awarfe that routing 128.0.0.0 inside your network is really strange because it's public ip or reserved i don'"t remeber. but in both case this is strange. –  Kiwy Jan 24 at 9:15
    
The 128.0.0.0 part is coming from openvpn. it is explained here –  slayedbylucifer Jan 24 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.