Skip to main content

IP ADDRESS on raspberry pi

IP ADDRESS

Any device connected to a Local Area Network is assigned an IP address.

In order to connect to your Raspberry Pi from another machine using SSH or VNC, you need to know the Pi's IP address. 

This is easy if you have a display connected, and there are a number of methods for finding it remotely from another machine on the network.

USING THE PI WITH A DISPLAY

If you boot to the command line instead of the desktop, your IP address should be shown in the last few messages before the login prompt.

Using the terminal (boot to the command line or open a Terminal window from the desktop), simply type hostname -I which will reveal your Pi's IP address.

USING THE PI HEADLESS (WITHOUT A DISPLAY)

It is possible to find the IP address of your Pi without connecting to a screen using one of the following methods:

ROUTER DEVICES LIST

In a web browser navigate to your router's IP address 

e.g. http://192.168.1.1, which is usually printed on a label on your router; this will take you to a control panel. Then log in using your credentials, which is usually also printed on the router or sent to you in the accompanying paperwork. Browse to the list of connected devices or similar (all routers are different), and you should see some devices you recognise. Some devices are detected as PCs, tablets, phones, printers, etc. so you should recognise some and rule them out to figure out which is your Raspberry Pi. Also note the connection type; if your Pi is connected with a wire there should be fewer devices to choose from.

NMAP COMMAND

The nmap command (Network Mapper) is a free and open-source tool for network discovery, available for Linux, Mac OS, and Windows.

To install on Linux, install the nmap package e.g. apt-get install nmap.

To install on Mac OS or Windows, see the nmap.org download page.

To use nmap to scan the devices on your network, you need to know the subnet you are connected to. First find your own IP address, in other words the one of the computer you're using to find your Pi's IP address:

On Linux, type hostname -I into a terminal window

On Mac OS, go to System Preferences then Network and select your active network connection to view the IP address

On Windows, go to the Control Panel, then underNetwork and Sharing Center, click View network connections, select your active network connection and clickView status of this connection to view the IP address
Now you have the IP address of your computer, you will scan the whole subnet for other devices. 

For example, if your IP address is 192.168.1.5, other devices will be at addresses like 192.168.1.2, 192.168.1.3, 192.168.1.4, etc. The notation of this subnet range is 192.168.1.0/24 (this covers 192.168.1.0 to192.168.1.255).

Now use the nmap command with the -sn flag (ping scan) on the whole subnet range. 

This may take a few seconds:

nmap -sn 192.168.1.0/24

Ping scan just pings all the IP addresses to see if they respond. For each device that responds to the ping, the output shows the hostname and IP address like so:

Starting Nmap 6.40 ( http://nmap.org ) at 2014-03-10 12:46 GMT
Nmap scan report for hpprinter (192.168.1.2)
Host is up (0.00044s latency).

Nmap scan report for Gordons-MBP (192.168.1.4)
Host is up (0.0010s latency).

Nmap scan report for ubuntu (192.168.1.5)
Host is up (0.0010s latency).

Nmap scan report for raspberrypi (192.168.1.8)
Host is up (0.0030s latency).

Nmap done: 256 IP addresses (4 hosts up) scanned in 2.41 seconds


Here you can see a device with hostname raspberrypi has IP address192.168.1.8.

Comments

Popular posts from this blog

Jio

Reliance Jio planning its own  cryptocurrency called JioCoin  elder son Akash Ambani leading the JioCoin project, Reliance Jio plans to build a 50-member team of young professionals to work on blockchain technology, which can also be used to develop applications such as smart contracts and supply chain management logistics

garbage monitoring using arduino code with gsm

#include <SoftwareSerial.h> #include <LiquidCrystal.h> //LiquidCrystal lcd(7, 6, 5, 4, 3, 2); LiquidCrystal lcd(13, 12, 11, 10, 9, 8); SoftwareSerial mySerial(0,1); #define trigPin 2 #define echoPin 3 #define PIR_sensor 4 #define m11 5 #define m12 6 void setup() {    lcd.begin(16, 2);    lcd.print("    Garbage    ");    Serial.println("garbage ");   lcd.setCursor(0,1);   lcd.print("   Open Close    ");   Serial.println(" open close");   delay(3000);   lcd.clear();   //lcd.print(" ");   delay(2000); mySerial.begin(9600); // Setting the baud rate of GSM Module Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);  pinMode(m11, OUTPUT);   pinMode(m12, OUTPUT);   } void loop() {  readPIR();  pingDist();  SendMessage(); } void pingDist ()   {     long duration, distance;...