How delete the interface route in FreeBSD 9.2 (MPD5)?

Sami Halabi sodynet1 at gmail.com
Fri Oct 25 21:41:41 UTC 2013


Hi,
here is what I did:
1. in the mpd.conf under l2tp_cliet section:
set iface route default
set iface up-script /usr/local/etc/mpd5/io-up
set iface down-script /usr/local/etc/mpd5/io-down

2. io-up has the following:
#!/bin/sh
/usr/bin/netstat -nr >> /tmp/io-up-netstat
LocalGW=`/usr/local/etc/mpd5/GW`
echo $LocalGW > /tmp/.GW
route delete $4
route add $4 $LocalGW
route delete default
route add default $4
echo $4 > /tmp/pptp_GW
cp /etc/resolv.conf /etc/rsolv.conf-1
echo nameserver `echo $6|awk '{print $2;}'` > /etc/resolv.conf
echo nameserver `echo $7|awk '{print $2;}'` >> /etc/resolv.conf

echo $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 >> /tmp/io-up
/usr/bin/netstat -nr >> /tmp/io-up-netstat

3. io-down has the following:
#!/bin/sh
/usr/bin/netstat -nr >> /tmp/io-down-netstat
LocalGW=`cat /tmp/.GW`
vpnGW=`cat /tmp/pptp_GW`
route delete $vpnGW
route delete default
route add default $LocalGW
cp /etc/resolv.conf-1 /etc/rsolv.conf

echo $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 >> /tmp/io-down
/usr/bin/netstat -nr >> /tmp/io-down-netstat

4. /usr/local/etc/mpd5/GW has the following:
#!/bin/csh -f
/usr/bin/netstat -nr | /usr/bin/grep default | /usr/bin/awk '{print $2;}'



Hope this helps.

Sami



On Fri, Oct 25, 2013 at 8:04 PM, Sami Halabi <sodynet1 at gmail.com> wrote:

> You need to setup the up.sh script to modify the default route to go
> through the old default route... I have set this up at home... I'll post
> you the script when i'll be home.
>
> Sami
> בתאריך 25 באוק 2013 19:56, "Julian Elischer" <julian at freebsd.org> כתב:
>
> On 10/25/13 11:07 PM, MrStalker wrote:
>>
>>>
>>> 25.10.2013 11:08, Eugene Grosbein пишет:
>>>
>>>> On 25.10.2013 03:42, MrStalker wrote:
>>>>
>>>>> Hello!
>>>>> For my internet provider (L2TP VPN connection) is required a route to
>>>>> the VPN server via local gate.
>>>>> I'm using MPD5.
>>>>> But, MPD5 creates route to the VPN server via its same interface...
>>>>>
>>>>> root at Eviko:/home/mrstalker # netstat -nrf inet
>>>>> Routing tables
>>>>>
>>>>> Internet:
>>>>> Destination        Gateway            Flags    Refs      Use Netif
>>>>> Expire
>>>>> default            85.21.230.206      UGS         0 8    ng0
>>>>> 85.21.230.206      link#7             UH          0 8    ng0
>>>>>
>>>>> What will not work...
>>>>>
>>>>> However earlier, it was possible delete this route and then create
>>>>> right route.
>>>>> root at Test2:/home/mrstalker # route delete 85.21.230.206
>>>>> delete host 85.21.230.206
>>>>> root at Test2:/home/mrstalker # route add 85.21.230.206 10.165.32.1
>>>>> add host 85.21.230.206: gateway 10.165.32.1
>>>>>
>>>>> When i trying FreeBSD 9.2, this is no longer working...
>>>>> Thread about it at the forumhttp://forums.freebsd.**
>>>>> org/showthread.php?t=42547<http://forums.freebsd.org/showthread.php?t=42547>
>>>>> Later I found source of problem:
>>>>> http://svnweb.freebsd.org/**base?view=revision&revision=**248895<http://svnweb.freebsd.org/base?view=revision&revision=248895>
>>>>>
>>>>> Now I can't delete the interface route (ng0). What does impossible
>>>>> work with the  internet provider.
>>>>>
>>>>> How? How now resolve this problem?
>>>>> I need to add route to the vpn server via local gate...
>>>>>
>>>>> Please help me resolve this trouble. Since the release of FreeBSD 9.2
>>>>> I trying to find a solution.
>>>>>
>>>> You have to create your static route to vpn server before mpd5 starts.
>>>> Use /etc/rc.conf:
>>>>
>>>> static_routes="vpn"
>>>> route_vpn="85.21.230.206 10.165.32.1"
>>>>
>>>> Eugene Grosbein
>>>>
>>> Unfortunately failed...
>>>
>>> root at Eviko:/home/mrstalker # netstat -nrf inet|grep 85.21.230.206
>>> 85.21.230.206      10.165.32.1        UGHS        0        0 re0
>>> root at Eviko:/home/mrstalker # service mpd5 start
>>> Starting mpd5.
>>> root at Eviko:/home/mrstalker # netstat -nrf inet|grep 85.21.230.206
>>> 85.21.230.206      link#7             UH          0        4 ng0
>>>
>>> Route via ng0 overwrites the static route.
>>>
>> then you have set it up wrong.
>> you need a specific static route to the far end that does not go through
>> tunnel.
>>
>> the only other possibilty is to have mpd use a separate fib..
>> e.g.
>>
>> setfib 3 route add (destination route)
>> setfib 3 mpd (args)
>> then you can allow the default route etc to go through the tunnel
>> as the tunnel iteself will use a different routing table.
>>
>>
>>  ______________________________**_________________
>>> freebsd-net at freebsd.org mailing list
>>> http://lists.freebsd.org/**mailman/listinfo/freebsd-net<http://lists.freebsd.org/mailman/listinfo/freebsd-net>
>>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@**freebsd.org<freebsd-net-unsubscribe at freebsd.org>
>>> "
>>>
>>>
>>>
>> ______________________________**_________________
>> freebsd-net at freebsd.org mailing list
>> http://lists.freebsd.org/**mailman/listinfo/freebsd-net<http://lists.freebsd.org/mailman/listinfo/freebsd-net>
>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@**freebsd.org<freebsd-net-unsubscribe at freebsd.org>
>> "
>
>


-- 
Sami Halabi
Information Systems Engineer
NMS Projects Expert
FreeBSD SysAdmin Expert


More information about the freebsd-net mailing list