From owner-freebsd-questions@FreeBSD.ORG Thu Jul 8 22:40:25 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A717516A4ED for ; Thu, 8 Jul 2004 22:40:25 +0000 (GMT) Received: from chello080110061116.502.15.vie.surfer.at (chello080110061116.502.15.vie.surfer.at [80.110.61.116]) by mx1.FreeBSD.org (Postfix) with SMTP id DFD3643D46 for ; Thu, 8 Jul 2004 22:40:03 +0000 (GMT) (envelope-from 4711@chello.at) Received: (qmail 13429 invoked from network); 8 Jul 2004 22:40:02 -0000 Received: from matrix010.matrix.net (192.168.123.10) by ns.matrix.net with SMTP; 8 Jul 2004 22:40:02 -0000 From: Christian Hiris <4711@chello.at> To: freebsd-questions@freebsd.org Date: Fri, 9 Jul 2004 00:39:47 +0200 User-Agent: KMail/1.6.2 References: <40EDBCC7.8010007@intersonic.se> <20040708182058.0419994a.wmoran@potentialtech.com> In-Reply-To: <20040708182058.0419994a.wmoran@potentialtech.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-02=_B1c7ALxc4zct4Kt"; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407090040.01913.4711@chello.at> cc: Bill Moran Subject: Re: add route called from script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2004 22:40:25 -0000 --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" 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 > > 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 ''` > 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--