TurnKey Linux Virtual Appliance Library

How to find the External IP Address from command line

How do I determine my external IP address from the command line? I am using the Vtiger appliance and have had no difficulty logging in and using the program as well as Webmin remotely from inside my network. I just have no idea how to determine my external IP without a graphical web browser. Dropping down to the command prompt on the server or the terminal with Webmin is no problem. Any help would be appreciated.
Jeremy's picture

Why not use a web browser from a PC on same LAN?

If you use a PC that shares the same internet connection then the external IP will be the same.

But a quick google turned up a number of solutions, I haven't tested this one, but it looks like one of the better options IMO.

Don Sanderson's picture

Not sure.........

 what you are looking for the 'external IP address' of.

'ip addr' will show all IP's on the appliance.

http://myipaddress.com will show your router or gateways external internet address, which will be the same for all machines on your LAN. This can be done from the machine you are using webmin from since it has a browser.

Setting up 'port forwarding' on your router/gateway will allow you to access the appliance from the internet on this external IP address.

If these don't help please give a few more details and post again.

PS: Sorry JedMeister, I was typing as you were posting. :-)


How to find the External IP Address from command line

 

Many thanks Don & JedMeister,

I learned a great deal from your posts, but first let me share a simple solution that I found on my own:

from the terminal "curl icanhazip.com" returns the external IP Address.

Clearly I do not know what I am doing, but will learn.  The end goal is to connect to the appliance from outside my own home network.  What I knew for sure is that I needed to know the external IP address, as the 192.168.1.117 address won't work from the road.  I had no idea that the external IP Adress was common to my entire network.   I thought that this would directly address the appliance.  Now that I am corrected,  I am guessing that some router port forwarding will be required.  I have never actually done this, but I have found the settings on my router administration page.  If somebody is feeling generous and could share the general steps, or point me to a solution, I would be grateful.

Many thanks.

 

Don


Don Sanderson's picture

Ports - Custom

Ports - Custom Services

 
Service Name
Service Type TCP/UDPTCPUDP
Starting Port (1~65534)
Ending Port (1~65534)
Server IP Address . . .

In my NetGear router the entry looks like the above.

For an example to set up forwarding for a web server the entries would be:

Service Name: HTTP

Service Type: TCP/UDP

Starting Port: 80

Ending Port: 80

Server IP Address: <Your Internal Server IP>

Pretty easy really but will vary a bit by router brand/model.

Some even have 'preset' configs for standard services.

Your owners manual is a good reference. ;-)


Ports for communicating with Turnkey

Hello,  Thanks for all the help, especially since we have moved beyond Turnkey specific questions and into networking.  Above seems pretty simple: I must forward port 80 to the local address of my appliance.   (As a side note: Not sure how this effects all my other computers as I thought that port 80 is used for lots of stuff.) When outside my network, what IP address do I use to address the appliance?  It must be the External IP address, but if my entire home network has the same external IP, then I guess I must add a port number to the end.  Do I need to enter something like 67.81.109.95:80, where 80 is the port number to access the appliance?

I am further assuming that the Webmin feature needs port 12321 also ported to the appliance and to access it, the external IP address is used followed by :12321.

Am I correct?

Don


Jeremy's picture

No need to append port for http/https if you forward ports

http & https assume ports 80 & 443 respectively so if you forward those ports you don't need to specify them when you browse there. Eg http://67.81.109.95:80 will produce the same result as http://67.81.109.95 and https://67.81.109.95:443 will produce the same result as https://67.81.109.95. Yes, you need to also forward port 12321 to use Webmin and whenever connecting to Webmin (or a web serivce running on a non standard port) you will need to specify the port, eg https://67.81.109.95:12321 

Forwarding port 80 (or any other port) will only effect another computer on your LAN if you have another web server already using port 80 (or any other port you wish to use). Web browsing etc from another LAN connected PC will use any local port so will be uneffected.

Another thing to keep in mind is that often residential internet plans have a dynamic IP rather than a static one. If that is the case your external IP will change occasionally so you may need to use a Dynamic DNS provider such as DynDNS.com or ChangeIP.com. Then rather than using the IP, use the domain name registered by your DDNS account.

Thank you for your generosity in answering my questions..

Jeremy,

Thank you for answering my networking questions.  Your detail was well beyond any of my reasonable expectations.  It is quite amazing how much easier it is to find answers to most open source questions while getting answers can be a nightmare for many closed source applications.    

Many thanks,

Don


Jeremy's picture

No problem, all part of the service :)

It isn't always the way, and IMO sometimes 'official' FOSS documentation can be quite lacking, but in general I think you are right. I seem to come across a lot more helpful people in FOSS communities and IMO the breadth and depth of 'unofficial' and often informal documenation & support is unrivaled in the proprietry world.

One thing I have noticed is how often I come across an issue with Windows (especially servers) where all I can find via google is others with the same problem and it can take great patience to actually find answers. Although I have also experienced this with Linux too, but I find more often that I need to sift through multiple answers to find the one that is most appropriate!

Anyway, I'm rambling a bit... Glad we got you going. Any further questions don't hesitate to ask (can't guarantee I'll be able to answer them all but hopefully someone will). Just start a new thread for a new question (ie not related to your networking) :)

@Don Sanderson- No worries mate. Team effort! :)

Sorry i dont have any idea on

Sorry i dont have any idea on that.If you want to find the external ipaddress means  you can use  this site  Ip-details.com


Website database server IP address

Hi,

How to find Website database server IP address in command prompt?

 

Sudip

Jeremy's picture

Have you read the thread above?

If you read above there are a number of ideas and at least one solution and a link to instructions...

If you have tried some/all of the above and it's not relevant for some reason, or it doesn't work, then please feel free to post back detailing what the issue was/is, or why it's not relevant...

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)