Dec 9, 2013

create tunnel connection on ppp


on server
sudo apt-get install vtund

edit the options

options {
    port 5000;
    ifconfig /sbin/ifconfig;
    route /sbin/route;
    syslog auth;
}
default {
    compress no;
    speed 0;
}
home {
    type tun;
    proto tcp;
    stat yes;
    keepalive yes;
    passwd HHH;
    up {
        ifconfig "%% 198.50.138.BBB pointopoint 198.50.138.AAA";
        program /sbin/arp "-Ds 198.50.138.AAA %% pub";
        program /sbin/arp "-Ds 198.50.138.AAA eth0 pub";
        route "add -net 10.64.64.0/24 gw 198.50.138.AAA";
    };
    down {
        program /sbin/arp "-d 198.50.138.AAA -i %%";
        program /sbin/arp "-d 198.50.138.AAA -i eth0";
        route "del -net 10.64.64.0/24 gw 198.50.138.AAA";
    };
}

sudo vtund -s


on client 

options {
    port 5000;
    ifconfig /sbin/ifconfig;
    route /sbin/route;
}
default {
    compress no;
    speed 0;
}

home {
    type tun;
    proto tcp;
    keepalive yes;
    passwd HHH;
    up {
        ifconfig "%% 198.50.138.AAA pointopoint 198.50.138.BBB arp";
        route "add server gw 10.64.64.64";
        route "del default";
        route "add default gw 198.50.138.BBB";
    };
    down {
        route "del default";
        route "del server gw 10.64.64.64";
        route "add default gw 10.64.64.64";
    };
}

sudo vtund -m -p home your_server

febru@sevilla:~$ ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:198.50.138.AAA  P-t-P:198.50.138.BBB  Mask:255.255.255.255
          UP POINTOPOINT RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:1618 (1.6 KB)


febru@sevilla:~$ sudo route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         198.50.138.BBB  0.0.0.0         UG    0      0        0 tun0
10.42.0.0       *               255.255.255.0   U     9      0        0 wlan0
10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0
tiago           10.64.64.64     255.255.255.255 UGH   0      0        0 ppp0
198.50.138.BBB  *               255.255.255.255 UH    0      0        0 tun0

you will get better here ... 

create tunnel connection bypass proxy


.

on server
sudo apt-get install vtund

edit the options

options {
    port 5000;
    ifconfig /sbin/ifconfig;
    route /sbin/route;
    syslog auth;
}
default {
    compress no;
    speed 0;
}
home {
    type tun;
    proto tcp;
    stat yes;
    keepalive yes;
    passwd HHH;
    up {
        ifconfig "%% 198.50.138.BBB pointopoint 198.50.138.AAA";
        program /sbin/arp "-Ds 198.50.138.AAA %% pub";
        program /sbin/arp "-Ds 198.50.138.AAA eth0 pub";
        route "add -net 10.64.64.0/24 gw 198.50.138.AAA";
    };
    down {
        program /sbin/arp "-d 198.50.138.AAA -i %%";
        program /sbin/arp "-d 198.50.138.AAA -i eth0";
        route "del -net 10.64.64.0/24 gw 198.50.138.AAA";
    };
}

sudo vtund -s


on client 

options {
    port 5000;
    ifconfig /sbin/ifconfig;
    route /sbin/route;
}
default {
    compress no;
    speed 0;
}

home {
    type tun;
    proto tcp;
    keepalive yes;
    passwd HHH;
    up {
        ifconfig "%% 198.50.138.AAA pointopoint 198.50.138.BBB arp";
        route "add server gw 10.64.64.64";
        route "del default";
        route "add default gw 198.50.138.BBB";
    };
    down {
        route "del default";
        route "del server gw 10.64.64.64";
        route "add default gw 10.64.64.64";
    };
}

sudo vtund -m -p home your_server

febru@sevilla:~$ ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:198.50.138.AAA  P-t-P:198.50.138.BBB  Mask:255.255.255.255
          UP POINTOPOINT RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:1618 (1.6 KB)


febru@sevilla:~$ sudo route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         198.50.138.BBB  0.0.0.0         UG    0      0        0 tun0
10.42.0.0       *               255.255.255.0   U     9      0        0 wlan0
10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0
tiago           10.64.64.64     255.255.255.255 UGH   0      0        0 ppp0
198.50.138.BBB  *               255.255.255.255 UH    0      0        0 tun0

you will get better here ... 

create tunnel connection bypass proxy

No comments:

Post a Comment