LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-28-2009, 12:51 PM   #1
berrance
Member
 
Registered: Aug 2004
Location: Hull - England
Distribution: Ubunto and slowly switching to debian
Posts: 308

Rep: Reputation: 30
get my wan IP


i am writing a script to change the ip address in bind based upon my wan ip, but how can I get the IP displayed as just the ip. Normally I would just ping myself but that returns to much info. I just want my wan ip to be displayed when i issue a command.

any help will be much appreciated

berrance
 
Old 04-28-2009, 12:57 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You could use
Code:
lynx -dump http://www.pcmesh.com/ip-check.cgi | awk '/REMOTE_ADDR/{print $2}'
 
Old 04-28-2009, 01:14 PM   #3
berrance
Member
 
Registered: Aug 2004
Location: Hull - England
Distribution: Ubunto and slowly switching to debian
Posts: 308

Original Poster
Rep: Reputation: 30
Code:
curl -s checkip.dyndns.org|cut -d ":" -f2|cut -d "<" -f1
done it this way but i need to sent the result as a variable havnt done this for a while so i cant remember
 
Old 04-28-2009, 01:27 PM   #4
berrance
Member
 
Registered: Aug 2004
Location: Hull - England
Distribution: Ubunto and slowly switching to debian
Posts: 308

Original Poster
Rep: Reputation: 30
ah ah

found out where i was going wrong I was putting

PHP Code:
wandip='command' 
instead of

PHP Code:
wanip=`command
The quotes in the second line are not apostrophes but single quotes
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
2 wan and 1 lan xplozia Linux - Networking 3 02-06-2007 07:48 PM
Lan with three WAN... tusher Linux - Networking 3 06-28-2006 02:01 PM
The WAN and X WeNdeL Linux - Security 5 08-08-2005 02:46 PM
FreeS/Wan Vs. OpenS/Wan Vs. StrongS/Wan bkankur Linux - Security 1 03-01-2005 09:27 AM
WAN : unable to ping to WAN ckl Linux - Networking 0 11-18-2004 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration