Find the answer to your Linux question:
Results 1 to 2 of 2
from this article: Tun/Tap interface tutorial
the author created a tun interface Code: # openvpn --mktun --dev tun2 # ip link set tun2 up # ip addr add ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    87

    openvpn interface, local routing and linux kernel routing table


    from this article: Tun/Tap interface tutorial \1
    the author created a tun interface
    Code:
        # openvpn --mktun --dev tun2
        # ip link set tun2 up
        # ip addr add 10.0.0.1/24 dev tun2
    then he did a ICMP ping to 10.0.0.2
    Code:
        # ping 10.0.0.2
        PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
        From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
        From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
    ...
    and he used tshark or tcpdump to capture packets on interface tun2, and he can capture packets as below:
    Code:
         0.000000     10.0.0.1 -> 10.0.0.2     ICMP Echo (ping) request
         0.999374     10.0.0.1 -> 10.0.0.2     ICMP Echo (ping) request
         1.999055     10.0.0.1 -> 10.0.0.2     ICMP Echo (ping) request
    I followed the same procedures, but I can't capture packets like he did, and I don't get `Destination Host Unreachable`. I think the problem is due to local routing, in his test, it seems that the system regard `10.0.0.1` as the default gateway for subnet 10.0.0.0/24, but in my test, it is not the case.

    so how can I get the same result as the author's?


    BTW, on my machine:
    Code:
            tun2      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
                      inet addr:10.0.0.1  P-t-P:10.0.0.1  Mask:255.255.255.0
                      UP POINTOPOINT NOARP MULTICAST  MTU:1500  Metric:1
                      RX packets:7 errors:0 dropped:0 overruns:0 frame:0
                      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                      collisions:0 txqueuelen:100
                      RX bytes:420 (420.0 b)  TX bytes:0 (0.0 b)
    Code:
        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    0      0        0 wlan0
        10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun2
        192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
    I don't understand what is the meaning of `0.0.0.0` for gateway, so I did add a route:
    Code:
        route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
    and get
    Code:
            Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
            0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
            10.0.0.0        10.0.0.1        255.255.255.0   UG    0      0        0 tun2
            10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun2
            192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
    still it doesn't work. I really don't understand why.

  2. #2
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    416
    I haven't gotten as far in to it yet as you have. I've been looking at setting up a Tun/Tap for GNS3 instead of OpenVPN. Here's the one I've been looking at. Maybe it will help you?

Posting Permissions

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