After I've booted up, what's the easiest way to obtain and display the IP address that the device is currently using?
I'm using Raspbian, and
ifconfig doesn't appear to be installed.
Are there any widgets that display this information in LXDE?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
The if family of tools including ifconfig are being deprecated and replaced by the newer ip commands so you can use any one of the following from the command line to determine your IP address:
sudo ip addr show
sudo hostname --ip-address
or if you still want to use ifconfig, and it is not already installed
sudo apt-get install wireless-tools sudo ifconfig -a
You can use this little python script as well.
import socket def get_local_ip_address(target): ipaddr = '' try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect((target, 8000)) ipaddr = s.getsockname() s.close() except: pass return ipaddr print "Raspberry Pi - Local IP Address" print(get_local_ip_address('10.0.1.1')) print(get_local_ip_address('google.com'))
As an alternative to finding the DHCP assigned IP address, I've added a reserved IP address in my router/DHCP server. It matches the MAC address of the Raspi and always assigns the same IP address - even after a fresh install of the OS.
With Wheezy now having SSH enabled by default, it means I can login to a freshly installed Raspberry Pi without ever needing to connect a keyboard or monitor.
Apologies for not answering the question directly, but it seemed closely related enough to suggest.
If you want to see your external ip address use this on your command line
curl http://ipecho.net/plain; echo;
You could create a function to make it easier.
Edit your .bashrc and add the following function at the end of the file.
Function to display the external ip address
Calling your function from cli
You may find more interesting ways to obtain your ip address in this link
Shea Silverman and Jacob Bates have recently created a tool called PIP that allows you to obtain the IP of your raspberry pi without even attaching it to a screen, as it installs a script that send your IP address to a server that you can visit with your main PC. It may not be the best option in every situation, but it is a very clever hack.
I suggest that you use Bonjour instead of having to find the IP address. Let it be assigned via DHCP and as long as your PC is on the same network you can access it by name.
For example.. raspberrypi.local
Once this is setup you can run completely headless, connect to the Pi with SSH, or VNC etc..
Here is an article explaining how to setup for Bonjour. http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=18207
Note that for a windows machine you will need to install Apply Bonjour printer services driver, a tiny thing...
For Mac and Ubuntu, Bonjour is already there.
Just to add some supplement here, the reason you might not have ifconfig is because your system is probably using the iproute2 suite instead. iproute2 includes updated equivalents of the old ifconfig and route suites.
I'm bringing this up because if you start to try commands you're used to with ifconfig or route, your first instinct might be to install those old packages instead of just using the newer equivalent. For instance, if you need to use netstat and realize it's missing, just do a search for "iproute2 netstat equivalent" and you should find the "ss" command. For further reading and documentation, refer to the Linux Foundation's article on it: http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
I don't know about LXDE. To know your IP address of your device visit the site Ip-Details.com . Here they will also provide IP location, ISP address, country etc...