Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jul 2004 18:20:58 -0400
From:      Bill Moran <wmoran@potentialtech.com>
To:        "Per olof Ljungmark" <peo@intersonic.se>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: add route called from script
Message-ID:  <20040708182058.0419994a.wmoran@potentialtech.com>
In-Reply-To: <40EDBCC7.8010007@intersonic.se>
References:  <40EDBCC7.8010007@intersonic.se>

next in thread | previous in thread | raw e-mail | index | archive | help
"Per olof Ljungmark" <peo@intersonic.se> wrote:

> Hi all,
> 
> I am experimenting with openvpn-2 and so far it looks promosing. As this 
> version of openvpn can assign client addresses similar to dhcp, I need 
> to find out how to assign a route from a script, like (this is the 
> client end, running FreeBSD):
> 
> [simplifed example]
> #!/bin/sh
> openvpn --daemon --config my-vpn.conf
> route add 192.168.0.0/16 <adress from tun{if} here>

I'm no guru for either of these commands, but I'm guessing this is a
canonical job for sed and/or awk.  Something like:

IPADDR = `ifconfig | awk '<awk magic to extract the IP>'`
route add 192.168.0.0/16 $IPADDR

I hope this is helpful, sorry I don't have a more precise answer.

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040708182058.0419994a.wmoran>