Results 1 to 3 of 3
Hello,
I need your help. I am implementing Mobile IP with VTUN. Main idea is to route all data through tun device via default gw (HA (or VPN server) tun ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-21-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 3
dynamic routing
Hello,
I need your help. I am implementing Mobile IP with VTUN. Main idea is to route all data through tun device via default gw (HA (or VPN server) tun dev ip). Except of course, "true" conection of VTUN.
Everything works great then I am stationary. Internet data goes through tun dev.
This is my client side configuration:
192.168.3.254 is my subnet GW.up {
ifconfig "%% 10.3.0.150 pointopoint 10.3.0.50 mtu 1450";
route "add 192.168.2.50 gw 192.168.3.254";
route "del default";
route "add default gw 10.3.0.50";
};
192.168.2.50 is server's IP.
10.3.0.50 is server tun dev IP.
Subnet mask is /24.
Then i move to other subnet, i get my IP and default GW via DHCP.
Then VTun initialize i want, that all data go through tun, so add line: add default gw 10.3.0.50
Then problem occurs- VTun actual tunnel headers wants to go through this GW. Nonsense...
And of course- connection terminates after some time.
The Q:
how to make so, that
this {actual_gw} must be dynamic.route "add 192.168.2.50 gw {actual_gw}";
and all other data simply goes through gw 10.3.0.50.
I would really appreciate help. because I fell stuck here and without any ideas...
Vikapone
- 05-23-2011 #2Just Joined!
- Join Date
- May 2011
- Posts
- 3
I actually found solution, I made few script's. routing.sh script to change GW with variable. Monitoring.sh works too, but has a nasty habit to loop if there is no default gw ir routing table.
routing.sh
monitoring.shCode:#!/bin/sh defaultgw=`route -n | grep '^0\.0\.\0\.0[ \t]' | awk '{print $2}'` if [ "$defaultgw" != "10.3.0.50" ]; then route add 192.168.2.50 gw $defaultgw route del default route add default gw 10.3.0.50 /home/VykisFe12/monitoring.sh fi exit
Code:#!/bin/sh defaultgw2=`route -n | grep '^0\.0\.\0\.0[ \t]' | awk '{print $2}'` while [ "$defaultgw2" = "10.3.0.50" ] do defaultgw2=`route -n | grep '^0\.0\.\0\.0[ \t]' | awk '{print $2}'` done exit
- 05-26-2011 #3Just Joined!
- Join Date
- May 2011
- Posts
- 3
My scripts are not so good actualy, I would like to ask- if there is any way to route, for example 192.168.2.50 through main table, while where is higher priority table with default route?
Something like that:
"Higher table" to reach internet via VPN server
Destination Gateway Genmask Flags Metric Ref Use Iface
10.3.0.50 * 255.255.255.255 UH 2 0 0 tun0
default 10.3.0.50 0.0.0.0 UG 0 0 0 tun0
Main table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.3.0 * 255.255.255.0 U 2 0 0 wlan0
default 192.168.3.254 0.0.0.0 UG 0 0 0 wlan0
Main Idea to route 192.168.2.50 destination packets through main table.


Reply With Quote
