Date: Fri, 9 Jul 2004 00:39:47 +0200 From: Christian Hiris <4711@chello.at> To: freebsd-questions@freebsd.org Cc: Bill Moran <wmoran@potentialtech.com> Subject: Re: add route called from script Message-ID: <200407090040.01913.4711@chello.at> In-Reply-To: <20040708182058.0419994a.wmoran@potentialtech.com> References: <40EDBCC7.8010007@intersonic.se> <20040708182058.0419994a.wmoran@potentialtech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-02=_B1c7ALxc4zct4Kt Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 09 July 2004 00:20, Bill Moran wrote: > "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 =3D `ifconfig | awk '<awk magic to extract the IP>'` > route add 192.168.0.0/16 $IPADDR If you know the number of the interface, ie tun0: IPADDR=3D`ifconfig tun0 | awk '$1~/inet/&&$1!~/inet6/{print $2}'` hth ch > > I hope this is helpful, sorry I don't have a more precise answer. =2D-=20 Christian Hiris <4711@chello.at> | OpenPGP KeyID 0x941B6B0B=20 OpenPGP-Key at hkp://wwwkeys.eu.pgp.net and http://pgp.mit.edu --Boundary-02=_B1c7ALxc4zct4Kt Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBA7c1Bcyi/EZQbawsRAgVOAJ91rmJAXv8lCzmo3VfG338TgqxtEACdEtJj WMu+R/hoZIEhfkvd8gX/R3E= =tbfF -----END PGP SIGNATURE----- --Boundary-02=_B1c7ALxc4zct4Kt--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407090040.01913.4711>