Page 1 of 1

How to find the current IP address?

Posted: Tue May 27, 2014 1:53 am
by AmbroseChapel
It's hard to google for this because of the Pidora "headless" feature which reads out the IP address over the audio channel and by blinking the LEDs.

This very clever feature doesn't help when googling a pretty simple problem. My Pi, using Pidora, has booted up and successfully connected to a WiFi network. It has a dynamically assigned IP address.

What is that IP address?

Re: How to find the current IP address?

Posted: Tue May 27, 2014 2:15 am
by Richard-TX
Run nmap on another computer on the same lan.

Then you will see an entry like this:

MAC Address: B8:27:EB:24:29:70 (Raspberry Pi Foundation)
Nmap scan report for rocpi2 (10.232.1.82)
Host is up (0.00s latency).

Re: How to find the current IP address?

Posted: Tue May 27, 2014 2:20 am
by ukscone
I assume that you mean from the command prompt in which case there are several commands that will give you your ip address. the one i use just from habit is

ifconfig


and then just look for the inet addr: line for the relevant interface

Re: How to find the current IP address?

Posted: Tue May 27, 2014 4:03 am
by AmbroseChapel
ifconfig
Have you tried this, specifically on Pidora? Please try this command on Pidora and report your results.

Re: How to find the current IP address?

Posted: Tue May 27, 2014 4:04 am
by AmbroseChapel
I assume that you mean from the command prompt
Either command prompt or GUI answers will be fine.

Re: How to find the current IP address?

Posted: Tue May 27, 2014 5:17 am
by bullwinkle
Hello

I use ping HOSTNAME and it returns the IP address
eg.

Code: Select all

ping raspberry
or

Code: Select all

ping raspi
I think raspi is the default hostname for Pidora but I don't use it so you might need to check that point.

good luck

Re: How to find the current IP address?

Posted: Tue May 27, 2014 6:49 am
by DougieLawson
Install Fing on Windows or your iPhone or Android phone/tablet. That will scan your network. The Android version is very slick.

Install nmap and use nmap -v -sn 192.168.1.0/24 from another Linux system.

Re: How to find the current IP address?

Posted: Tue May 27, 2014 6:50 am
by georgehudson
I think nmap option is good one for current IP address.

Re: How to find the current IP address?

Posted: Wed May 28, 2014 1:02 pm
by tedsluis
AmbroseChapel wrote:It's hard to google for this because of the Pidora "headless" feature which reads out the IP address over the audio channel and by blinking the LEDs.

This very clever feature doesn't help when googling a pretty simple problem. My Pi, using Pidora, has booted up and successfully connected to a WiFi network. It has a dynamically assigned IP address.

What is that IP address?
I have two more options for you:
1) (If you are able to) you could login to your wireless router and you should probably find there a page which lists all the hosts that are leasing a dhcp ip address. You should find your raspberry there with it's IP address.

2) You could arrange that raspberry 'shows' (with the LEDs) or 'tells' (over the speaker) you the IP address every time you boot it (and not only in headless mode). Make sure that '/usr/bin/ip-read' and/or '/usr/bin/ip-flash' are launched every time you boot your raspberry. To do so you could login as root and create (or edit) a '/etc/rc.local' file.

Code: Select all

[[email protected] rc.d]# cd /etc/rc.d
[[email protected] rc.d]# vi rc.local
#!/bin/bash
/usr/bin/ip-flash
/usr/bin/ip-read
[[email protected] rc.d]#
I hope this helps you....

Re: How to find the current IP address?

Posted: Thu May 29, 2014 3:03 pm
by oatley
In Pidora, the easiest way to find the raspberry pi's ip address is to simply run the command:

ip addr show

If you are more familiar with "ifconfig":

yum install net-tools
ifconfig

Re: How to find the current IP address?

Posted: Thu Jan 01, 2015 1:38 am
by coralnut
Fedora installations are supposed to have net-tools installed by default, but Pidora doesn't include it. It should. Once net-tools is properly installed, the proper way to check the current ip address is to use the ifconfig utility followed by the device name. On the RPi, the device name for the ethernet port is eth0.

Code: Select all

# yum install net-tools
# ifconfig eth0

Re: How to find the current IP address?

Posted: Thu Jan 01, 2015 2:23 am
by iinnovations
These forums really need a vote up/down feature like Stack Overflow/Exchange. I constantly see between 5 and 10 answers to a question, many of which are duplicates and some complete garbage. It's probably difficult for those that ask questions to determine which answers to follow, and for others searching after the fact to determine what worked and what didn't (without reading the entire thread).

C

Re: How to find the current IP address?

Posted: Thu Jan 01, 2015 5:15 am
by kayvan
Totally agree about the vote up/down feature.

Another option is to run "pifconfig eth0" or "pifconfig wlan0".

Code: Select all

[
[email protected] ~]# pifconfig eth0
eth0   HWaddr b8:27:eb:a2:3a:fe 
          inet addr:192.168.1.136 Bcast:192.168.1.255   Mask:255.255.255.0
	  inet6 addr: 2602:306:309a:96f0:ba27:ebff:fea2:3afe/64 Scope: global
	  inet6 addr: fe80::ba27:ebff:fea2:3afe/64 Scope: link
	  UP BROADCAST RUNNING MULTICAST
Pidora does not install net-tools by default, but it installs the python-ethtool package.

Re: How to find the current IP address?

Posted: Thu Feb 12, 2015 9:57 pm
by LakesGeek
I use "hostname -I". That just outputs the IP address with no other gubbins, so you don't have to play around with regular expressions if you want to email/tweet it to yourself or display it on an LCD etc.

I don't think this is really the "proper" way to script it, it's not very tidy and there are probably much more elegant methods out there. But I email it to myself by installing and configuring msmtp (to authenticate to my mail server so it doesn't get spam trapped) and then creating /etc/network/if-up.d/notify:

Code: Select all

#!/bin/sh
#quit if action is anything but start
if [ "$MODE" != start ]; then
        exit 0
fi

#quit if phase is anything but post-up
if [ "$PHASE" != post-up ]; then
        exit 0
fi

# quit if we're called for the loopback
if [ "$IFACE" = lo ]; then
	exit 0
fi

# IFACE has also been seen as "--all" so exclude that too
if [ "$IFACE" = --all ]; then
        exit 0
fi

(
echo "From: [email protected]"
echo "To: [email protected]"
echo "Subject: Pi 'example' is online"
echo "Pi 'example' started up on $(hostname -I) using interface $IFACE"
) | /usr/bin/msmtp -a pi [email protected]
Not forgetting to also chmod +x notify.
The various "exits" prevent you getting like 4 emails every time it starts up as if-up.d is called quite a few times with various parameters.

Re: How to find the current IP address?

Posted: Fri Feb 20, 2015 1:00 pm
by hexelpdkk
The reason net-tools isn't installed by default is that it is considered deprecated - see[0]. For old timers like me, there is an excellent reference for updating to the new commands and syntax [1]

So I agree with
oatley wrote: ip addr show
or the even more succinct

Code: Select all

ip a
(a expands to addr, and show is the default), and would recommend everyone consider learning the new commands.

[0] http://www.linuxfoundation.org/collabor ... g/iproute2
[1] https://dougvitale.wordpress.com/2011/1 ... lacements/

Re: How to find the current IP address?

Posted: Sun Mar 06, 2016 8:40 am
by aamnah
I use "hostname -I". That just outputs the IP address with no other gubbins
Please note that it is a capital i and not a lowercase l. This is the best option that i have found, very precise and to the point, no extra gubbins indeed.

Code: Select all

[email protected]:~ $ hostname -I
192.168.2.102

Re: How to find the current IP address?

Posted: Mon Jan 07, 2019 9:05 am
by 85battle1190
Hallo,
I get every time the problem that when I use hostname -I my ipv6 show with my ip how get u solve this ?

Thanks ,