Hi. sorry for my english
. I have a problem. server is configured to mikrotik openvpn. I would want that Mikrotik pushing routes client to the local network. But I would not succeed. Mikrotik support this feature? If not, what are the alternatives?
MT doesnβt push the routes. You have to set them in the config file. I think you cannot set the default route because of permission problems, but you can create a set of rules that route everything through the vpn interface except the address to the VPN server itself. Usually you can make it with 10-15 rules
Here is a small perl app that can do this
run it from command line and give it the IP of the server as the first parameter and the IP of the new default GW as the second.
You need to install the Net::CIDR and NetAddr::IP modules.
β¦ and I apologize for any possible mistypes.
#!/usr/bin/perl -w
use Net::CIDR;
use Net::CIDR β:allβ;
use NetAddr::IP;
@c2s=(
β0.0.0.0β,
β128.0.0.0β,
β192.0.0.0β,
β224.0.0.0β,
β240.0.0.0β,
β248.0.0.0β,
β252.0.0.0β,
β254.0.0.0β,
β255.0.0.0β,
β255.128.0.0β,
β255.192.0.0β,
β255.224.0.0β,
β255.240.0.0β,
β255.248.0.0β,
β255.252.0.0β,
β255.254.0.0β,
β255.255.0.0β,
β255.255.128.0β,
β255.255.192.0β,
β255.255.224.0β,
β255.255.240.0β,
β255.255.248.0β,
β255.255.252.0β,
β255.255.254.0β,
β255.255.255.0β,
β255.255.255.128β,
β255.255.255.192β,
β255.255.255.224β,
β255.255.255.240β,
β255.255.255.248β,
β255.255.255.252β,
β255.255.255.254β,
β255.255.255.255β);
$ip=$ARGV[0];
$gw=$ARGV[1];
my $prv=NetAddr::IP->new($ip) - 1;
my $nxt=NetAddr::IP->new($ip) + 1;
my @mi=Net::CIDR::range2cidr(β0.0.0.0-β.$prv);
foreach $mi(@mi)
{
($elso,$masodik)=split(///,$mi);
print βroute β.$elso.β β.$c2s[$masodik].β β.$gw.β \nβ;
}
my @mo=Net::CIDR::range2cidr($nxt.β-255.255.255.255β);
foreach $mo(@mo)
{
($elso,$masodik)=split(///,$mo);
print βroute β.$elso.β β.$c2s[$masodik].β β.$gw.β \nβ;
}