AmbroseChapel
Posts: 6
Joined: Sun Sep 29, 2013 3:29 am

How to find the current IP address?

Tue May 27, 2014 1:53 am

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?

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: How to find the current IP address?

Tue May 27, 2014 2:15 am

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).
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4098
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: How to find the current IP address?

Tue May 27, 2014 2:20 am

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

AmbroseChapel
Posts: 6
Joined: Sun Sep 29, 2013 3:29 am

Re: How to find the current IP address?

Tue May 27, 2014 4:03 am

ifconfig
Have you tried this, specifically on Pidora? Please try this command on Pidora and report your results.

AmbroseChapel
Posts: 6
Joined: Sun Sep 29, 2013 3:29 am

Re: How to find the current IP address?

Tue May 27, 2014 4:04 am

I assume that you mean from the command prompt
Either command prompt or GUI answers will be fine.

bullwinkle
Posts: 117
Joined: Wed Jan 09, 2013 12:14 pm

Re: How to find the current IP address?

Tue May 27, 2014 5:17 am

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

User avatar
DougieLawson
Posts: 35364
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: How to find the current IP address?

Tue May 27, 2014 6:49 am

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.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
georgehudson
Posts: 10
Joined: Tue May 20, 2014 10:41 am
Location: ohio

Re: How to find the current IP address?

Tue May 27, 2014 6:50 am

I think nmap option is good one for current IP address.

User avatar
tedsluis
Posts: 107
Joined: Sun Mar 03, 2013 11:49 am
Location: The Netherlands

Re: How to find the current IP address?

Wed May 28, 2014 1:02 pm

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....
--- If you cannot divide then you cannot multiply. ---

oatley
Posts: 20
Joined: Thu May 16, 2013 8:00 pm
Location: Toronto
Contact: Website

Re: How to find the current IP address?

Thu May 29, 2014 3:03 pm

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

coralnut
Posts: 15
Joined: Wed Dec 31, 2014 11:40 pm

Re: How to find the current IP address?

Thu Jan 01, 2015 1:38 am

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

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: How to find the current IP address?

Thu Jan 01, 2015 2:23 am

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
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

kayvan
Posts: 14
Joined: Mon Dec 29, 2014 6:30 am

Re: How to find the current IP address?

Thu Jan 01, 2015 5:15 am

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.

LakesGeek
Posts: 4
Joined: Tue Apr 17, 2012 9:11 pm

Re: How to find the current IP address?

Thu Feb 12, 2015 9:57 pm

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.

User avatar
hexelpdkk
Posts: 177
Joined: Fri Feb 24, 2012 4:40 pm

Re: How to find the current IP address?

Fri Feb 20, 2015 1:00 pm

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/

aamnah
Posts: 7
Joined: Thu Oct 03, 2013 9:39 am

Re: How to find the current IP address?

Sun Mar 06, 2016 8:40 am

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

85battle1190
Posts: 1
Joined: Mon Jan 07, 2019 8:29 am

Re: How to find the current IP address?

Mon Jan 07, 2019 9:05 am

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 ,

Return to “Pidora / Fedora”