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?
|
After I've booted up, what's the easiest way to obtain and display the IP address that the device is currently using? Are there any widgets that display this information in LXDE? |
|||||||||||
|
|
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:
or
or if you still want to use ifconfig, and it is not already installed
|
|||||||||||||||||
|
|
You can use this little python script as well.
|
|||||||||||||||
|
|
You may be able to check the DHCP status/logs on your DHCP server. Especially if it's on your home network. On all the routers I have owned this has been fairly easy to find. This is helpful if you are running headless and just want to know the address to ssh to. |
|||||
|
|
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. |
|||
|
|
|
$ host raspberrypi –> raspberrypi has address 192.168.1.20 $ host raspberrypi | grep ‘address’ | cut -d’ ‘ -f4 –> 192.168.1.20 $ nslookup 192.168.1.20 –> Server: 192.168.1.1 –> Address: 192.168.1.1#53 –> 20.1.168.192.in-addr.arpa name = raspberrypi. $ nslookup 192.168.1.20 | grep ‘=’ | cut -d’ ‘ -f3 –> raspberrypi. |
|||
|
|
|
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 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... |
|||
|
|
|
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 |
|||||||
|