Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raspberry PI IP address

Tags:

raspberry-pi

I have a Raspberry PI and a Wi-Pi wireless dongle.

I want to connect the PI to the computer using Remote Desktop Connection via wireless.

But I'm not sure how to get the IP of the Raspberry (without having access to the router), that I need to connect to it.

Now I get into router's page and see what IP it assigned to the pi, and use it to connect

But my goal is to be able to use it on the "field", using the phone's "internet sharing" option, to connect the PI and laptop to it, and then connect to pi from the laptop.

How can I get the IP address that the phone gave to the PI?

like image 231
PuiuCristian Avatar asked Sep 11 '13 15:09

PuiuCristian


2 Answers

You could make your Raspberry Pi speak its IP-address, like described here.

First, install the espeak package:

$ sudo apt-get install espeak

Then, create a init script:

$ sudo vi /etc/init.d/sayIPbs

Paste the following content into it:

#! /bin/sh
# /etc/init.d/sayIPbs
## Some things that run always
# Carry out specific functions when asked to by the system
case "$1" in  start)
    echo "Starting script sayIPbs "
    sleep 5
    public=`curl ifconfig.me`
    private=`hostname -I`
    string="public address is $public and private address is $private"
    echo $string | espeak -s 120 -v en-uk
    sleep 2
    echo $string | espeak -s 120 -v en-uk
    ;;  stop)    
echo "Stopping script sayIPbs"
    ;;  *)
    echo "Usage: /etc/init.d/sayIPbs {start|stop}"
    exit 1
    ;;esac
exit 0

Finally, issue these commands:

$ cd /etc/init.d
$ sudo chmod a+x sayIPbs
$ sudo update-rc.d -f sayIPbs defaults
$ sudo reboot

Plug in some headphones and listen to the ip address which will be read out at the end of the boot process.

like image 189
Werner Kvalem Vesterås Avatar answered Oct 04 '22 02:10

Werner Kvalem Vesterås


You should configure your raspy to have always the same ip address. Try to edit your interfaces.man file with nano or cat command with your own parameters as shown below. Remember to reboot after editing:

pi@raspberrypi ~ $ cat /etc/network/interfaces.man 
auto lo

    iface lo inet loopback
    iface eth0 inet static
    address 192.168.1.69
    netmask 255.255.255.0
    gateway 192.168.1.1


    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.67
    netmask 255.255.255.0
    gateway 192.168.1.1
    wpa-passphrase password
    wpa-ssid myssid
like image 22
aleph Avatar answered Oct 04 '22 01:10

aleph