Monday 4 March 2013

Remotely Find Raspberry Pi IP Address

Recently I have two examples where I have needed to find devices on the local network and to establish their IP addresses.

The first of these was with my Raspberry Pi. I tend to run this as a headless server and normally SSH into it. This is impossible until I have established its IP address.

The second, and more recent, is with a new piece of hardware which the company I work for has developed. This runs embedded Linux and requires us to find its IP address in order to operate it.

For my Raspberry Pi my usual method of finding the IP address was to log into my router and check which devices were connected. As I regularly reformat my Raspberry Pi this is something I need to do often. I have always felt this was extremely cumbersome, and I am forever scrabbling around trying to find the log in details for my router.

When my colleagues needed to find our new device on the network at work, I explained my method of logging into the router and checking for the IP addresses. The company router however was not as friendly as my home one, and promptly spat out a list of 20 IP addresses. My colleagues checked these manually to find the new device. Needless to say this took time and is not a long term solution.

As an experiment I wrote a python script to ping all the IP addresses, and log the one we required. My fears were correct, that pinging 256 IP address was extremely slow!

Surely there must be a better way to do this? Initial Google searches showed other people stating they connected a TV and keyboard to the Raspberry Pi. They could then determine the IP address by typing ifconfig into the command line. What a pain!

Further searching revealed an excellent tool called nMap.

http://nmap.org

Even more appealing is the fact it works with Linux, Mac and Windows. I need to use it on all three.

I installed it on a Linux machine and ran the following from a command line:

sudo nmap -sn 192.168.1.0/24



Within seconds a list of all connected devices and their IP addresses appeared. Problem solved!

So how do you install nMap?

On a Linux system such as Raspbian it's simple. Just type the following into the command line:

sudo apt-get install nmap



Windows and Mac users need to run an installer which has the option of running a GUI (Graphical User Interface) version called Zenmap.

The installer can be found on the nmap website here:


Using nmap

I would recommend using the command line where possible. It really does save time and effort not having to run a GUI. Particularly if you are remotely logged in via SSH.

For Linux the command would be:

sudo nmap -sn 192.168.1.0/24




sudo is required to give you root permissions.

For Mac and PC just type:

nmap -sn 192.168.1.0/24




If you prefer a GUI version rather than using the command line then you are in luck! During installation onto the Apple Mac or PC you have the option to install Zenmap.

To use this load Zenmap and follow the three easy commands below.




  1. In the Target box type: 192.168.1.0/24
  2. Select Profile: Ping scan
  3. Click on: Scan
This should give you the same results you would obtain from the command line.

I hope you all find this as useful as I did!

13 comments:

  1. Angry IP Scanner. http://angryip.org/w/Screenshots

    ReplyDelete
    Replies
    1. Looks a good alternative. Thanks!

      Delete
    2. Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download Now

      >>>>> Download Full

      Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download LINK

      >>>>> Download Now

      Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download Full

      >>>>> Download LINK F3

      Delete
  2. Got another option for this

    http://docs.j2anywhere.com/?page_id=169

    ReplyDelete
    Replies
    1. I love this idea, and have thought of something similar to use as an alternative to a static IP address. You would still need to know your Raspberry Pi IP address in order to log into it to set up, but I like this a lot! Thanks for sharing!

      Delete
  3. Static dhcp makes this a lot simpler. Find the Pi's MAC address and get your router to assign the same address each time. I've got two addresses assigned, one for WiFi and one for wired. No matter what OS is on my pi, I always know the IP address from the first boot.

    ReplyDelete
    Replies
    1. Thanks Bruce I agree a static DHCP is a good route to go. However explaining this for beginners is quite a tricky thing. There are also many times when you don't have the option to set up the static DHCP so being aware of nmap is quite useful. I am thinking of covering static DHCP and static IP Addresses in a future post. Thanks for taking the time to visit my blog!

      Delete
  4. You could also try fping - can be useful if you are scripting.

    ReplyDelete
    Replies
    1. Thanks, I will have to have a look into that!

      Delete
  5. Another way to examine the routes is via the subsequent command. Find more interesting information about anonymous proxy database here.

    ReplyDelete
  6. Alternatively, you should set a quantity of money which you should bet. If you want to get more interesting details about games online, visit this site right here.

    ReplyDelete
  7. Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download Now

    >>>>> Download Full

    Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download LINK

    >>>>> Download Now

    Trevor Appleton: Remotely Find Raspberry Pi Ip Address >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete