Mailinglist Archive: opensuse (3261 mails)

< Previous Next >
RE: [SLE] Getting the IP of ppp0
  • From: Cory Steers <cory.steers.gmu9@xxxxxxxxxxxxx>
  • Date: Sat, 14 Apr 2001 11:06:35 -0500
  • Message-id: <FFE54901205FD311B3BA00902771C69C070CA8D6@xxxxxxxxxxxxxxxxxxxxx>
Here's what I do:

extint="eth0"
extip="`/sbin/ifconfig $extint | grep 'inet addr' | awk '{print $2}' | sed
-e 's/.*://'`"
extmask="`/sbin/ifconfig $extint | grep 'inet addr' | awk '{print $4}' | sed
-e 's/.*://'`"
extbcast="`/sbin/ifconfig $extint | grep 'inet addr' | awk '{print $3}' |
sed -e 's/.*://'`"
extnet="${extip}/${extmask}"



-----Original Message-----
From: andrew@xxxxxxxxxxxxxxxxxxxx [mailto:andrew@xxxxxxxxxxxxxxxxxxxx]
Sent: Saturday, April 14, 2001 8:00 AM
To: suse-linux-e@xxxxxxxx
Subject: [SLE] Getting the IP of ppp0


Hi

After changing ISPs I no longer get a static IP so I want to be able to
somehow get the IP of ppp0 and use it in my custom firewall script. So far I
have the following:

MYIPADDRESS=`ifconfig | grep P-t-P | awk '{ print $3 }'`

although this puts 'addr:xxx.xxx.xxx.xxx' in the variable MYIPADDRESS. How
can the front 'addr:' be chopped off, or is there an easier way to get just
the IP of the current session?

Many thanks



Andrew


--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx

Also check the FAQ at http://www.suse.com/support/faq and the
archives at http://lists.suse.com

< Previous Next >