From: Eric Hodel Date: 2003-01-27T07:37:38+09:00 Subject: Re: Getting the dynamic IP address of a dialup interface (ppp0) --TmwHKJoIRFM7Mu/A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Mauricio Fern?ndez (batsman.geo@yahoo.com) wrote: >=20 > I need to get the dynamic IP address of the ppp0 interface > (point-to-point) under Linux. I cannot do a reverse DNS > lookup since the associated name is dynamic too (something like > user-bla-bla-IP-.someisp.com), and I would prefer to avoid parsing > `/sbin/ifconfig` since > a) I don't know how reliable it would be (and it's ugly anyway) > b) I cannot get sample output to work on since I have no access to the > remote machine (I was planning on somebody installing my script that) >=20 > [Context: I'm binding a socket to that interface and sending the IP and > port info w/ UDP to another computer (server) behind a firewall that then > connects to the client. This is all required because of quite draconian > firewalling rules (my machine is behind _THREE_ different firewalls, > ouch!)] ifconfig should be virtually the same everywhere, so parsing should be something like this: (works on FreeBSD) http://segment7.net/ruby-code/snippits/get_ip.rb --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --TmwHKJoIRFM7Mu/A Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+NGMtMypVHHlsnwQRAtMNAJ9w9b4Z5+8I2hnw9ItlKRmnspcxZgCgwS1Y dNPSQE6X8FOWUShzWUgKBPw= =YEfU -----END PGP SIGNATURE----- --TmwHKJoIRFM7Mu/A--