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
On Sat, 14 Apr 2001, Andrew Smith wrote:
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?
when the IP protocol is established, pppd calls the ip-up script. The 4th parameter passed to this script is the local IP address. That makes ip-up an ideal place to initialize your firewall rules. Or, you can just install and configure Marc's SuSEfirewall. He already has his hooks in ip-up. -- Rick Green "I have the heart of a little child, and the brain of a genius. ... and I keep them in a jar under my bed"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You wrote:
On Sat, 14 Apr 2001, Andrew Smith wrote:
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?
when the IP protocol is established, pppd calls the ip-up script. The 4th parameter passed to this script is the local IP address. That makes ip-up an ideal place to initialize your firewall rules. Or, you can just install and configure Marc's SuSEfirewall. He already has his hooks in ip-up.
Duuh ! How about answering the dudes question ?? The answer is: /sbin/ifconfig ppp0 | grep inet | awk '{print $2}' | awk '{FS=":"}END{ print $2}' and thus for scripting purposes: MYIP=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}' | awk '{FS=":"}END{ print $2}'`
"I have the heart of a little child, and the brain of a genius. ... and I keep them in a jar under my bed"
Apparently, not well used >;-) - -tosi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE62IS96mRH+PEpr2YRArOyAJwKvcK6XvGidF2DGtA4bJLlC0AIVACfXEyh 5aNAGL7W1R/V2HMR/TyqWIo= =IKi0 -----END PGP SIGNATURE-----
Hi Thanks to everyone who has helped! :o) Andrew -----Original Message----- From: Andrew Smith [mailto:andrew@andrewsmith.plus.com] Sent: 14 April 2001 14:00 To: SuSE Linux Mailing List 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@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
participants (3)
-
Andrew Smith
-
Rick Green
-
Tor Sigurdsson