How to find static IP of the Linux server using command line
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Please reword that question. What's the server? The system you have the command line for? Well, ifconfig is the correct command. If you're asking what the address of another system is, that can be any address which fits within your network hierarchy.
Is it always the same IP? I'm doubting that this is guaranteed, unless your IT guarantees it. I'm sure they would prefer to use hostname. I do understand that there is some public IP for your station, but that is from a pool. The truth is, 99.99% of the time, that will be the public IP for your system, until such time that your IT department changes the nature of the network, and then it may totally change to something vastly different.
So talk with that department, if there's no assigned hostname, ask for one, or ask what they recommend. Because using "what's my IP" and using that address so you can access remotely will work, but probably not over the long haul.
using whatismyip and using ifconfig from the console will very likely give two different results.
they will only be the same if there is no NATing going on between your system and the internet, which is highly unlikely whether in an office,cafe,airport,home or just about anywhere unless you have taken steps for this to be the case.
So, ifconfig is your best bet. If you are not satisfied that dhcp is off, go edit the interfaces file. On debian and variants it will be found at /etc/network/interfaces and edit the file accordingly.
It appears that everybody here has missed the OP's question. I'm not sure why, it seemed pretty clear to me.
OP - the only IP the machine knows about is its own IP on the local network. If you want to retrieve the machine/network's public IP, then you'll need to go to the web. You can still do this via the command line in one of many ways
Whatismyip is going to show your gateway Inet side. So most of the time it will not show the IP of that server, if it does your server is running with a direct connection to the internet and would be the same as ifconfig.
Whatismyip is going to show your gateway Inet side.
That's exactly what the OP is looking for. He clearly does not want the machine's local IP, I don't know why people keep giving him instructions on how to retrieve what he's explicitly said he does not want.