carl47
Posts: 9
Joined: Wed Oct 02, 2013 5:00 am

Cant find ip address in ssh

Tue Oct 08, 2013 6:13 am

I'm using raspbian "wheezy". It all works fine with my keyboard,mouse and hdmi screen.

I'm using the rasberry pi handbook- linux magazine special.

I have enabled ssh.

How ever I get:
pi@raspberrypi ~ $ sudo service sshd status
sshd: unrecognized service
If I look at:
pi@raspberrypi ~ $ sudo service ssh status
[ ok ] sshd is running.
That is strange, if I:
pi@raspberrypi ~ $ sudo sshd start
sshd re-exec requires execution with an absolute path
Which seems as if the daemon is running.

But with:
pi@raspberrypi ~ $ sudo ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:be:8c:ad
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19348 (18.8 KiB) TX bytes:4200 (4.1 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
There is no sign of the ip address.

also:
pi@raspberrypi ~ $ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface

I've tried as much as I know. Any hints on my next move.

User avatar
Davespice
Forum Moderator
Forum Moderator
Posts: 1665
Joined: Fri Oct 14, 2011 8:06 pm
Location: The Netherlands
Contact: Twitter

Re: Cant find ip address in ssh

Tue Oct 08, 2013 10:44 am

Can you post the output of this command?

Code: Select all

cat /etc/network/interfaces

User avatar
RaTTuS
Posts: 10563
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Cant find ip address in ssh

Tue Oct 08, 2013 10:53 am

have you plugged the NIC lead into the RPi?
what does your router say?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

carl47
Posts: 9
Joined: Wed Oct 02, 2013 5:00 am

Re: Cant find ip address in ssh

Tue Oct 08, 2013 9:16 pm

Thanks for the answers.

First cat /etc/network/interfaces gives file not found.

But the file is there in /ect/network and the interfaces file reads:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

I'm not connected to a router what I have is:

Windows laptop(ready to run putty)-----------------ethernet cable---------------RPi


The laptop detects and connects as a LAN to an unidentified network(the RPi).

The RPi shows orange LED's on for "Ethernet connection is full duplex" and
"Ethernet is connected" and "connection is 100 Mbps"

Hope this is helpfull.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5645
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Cant find ip address in ssh

Tue Oct 08, 2013 9:44 pm

carl47 wrote:Thanks for the answers.

First cat /etc/network/interfaces gives file not found.

But the file is there in /ect/network and the interfaces file reads:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

I'm not connected to a router what I have is:

Windows laptop(ready to run putty)-----------------ethernet cable---------------RPi


The laptop detects and connects as a LAN to an unidentified network(the RPi).

The RPi shows orange LED's on for "Ethernet connection is full duplex" and
"Ethernet is connected" and "connection is 100 Mbps"

Hope this is helpfull.
The problem is that the Pi is expecting a dynamic IP address to be assigned to it by a DHCP server. This would normally be running on a router, for example. By default your Windows laptop will not have such a server running. As I understand things, one of the ways to do this is to enable "Internet Connection Sharing (ICS)" etc. Unfortunately, this is something I don't do, since I'm usually running Ubuntu linux, and thus cannot "fill in the details". However there are other posts on the forum that should be of help.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

carl47
Posts: 9
Joined: Wed Oct 02, 2013 5:00 am

Re: Cant find ip address in ssh

Wed Oct 09, 2013 5:13 am

Thanks trevor for your answer.

I only have dialup internet.I cannot share this connection
with the LAN network(and so the RPi).

I'm would like to have broadband and connect my RPi into the router.
Then I could use "apt-get install xbomb".

To install "xbomb" I have to download xbomb_2.2a-2_armhf.deb from the rasberry pool.
Load it onto a usb then use it in the RPi:
"Sudo dpkg --install xbomb_2.2a-2_armhf.deb".

Very messy. If I could get ssh going It would be much easier.

I want to understand what is going on.

I realise that on connecting to a network cable socket the RPi
would look for an ip. Connect to it and so on to the internet.
The laptop LAN will not provide this and so the RPi cannot access
the net.

Fine, but the ethernet connection is still available as shown by
the led's and the laptop.
Now the ssh should still run the daemon sshd.
This is a server and provides a connection ip address and name for
the client(laptop putty) to connect to.

If the RPI has to first connect to the internet before running
the sshd then we could not have a standalone laptop and RPi
being used as headless.

I hope this is not true.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5645
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Cant find ip address in ssh

Wed Oct 09, 2013 2:16 pm

carl47 wrote:Thanks trevor for your answer.

I only have dialup internet.I cannot share this connection
with the LAN network(and so the RPi).

I'm would like to have broadband and connect my RPi into the router.
Then I could use "apt-get install xbomb".

To install "xbomb" I have to download xbomb_2.2a-2_armhf.deb from the rasberry pool.
Load it onto a usb then use it in the RPi:
"Sudo dpkg --install xbomb_2.2a-2_armhf.deb".

Very messy. If I could get ssh going It would be much easier.

I want to understand what is going on.

I realise that on connecting to a network cable socket the RPi
would look for an ip. Connect to it and so on to the internet.
The laptop LAN will not provide this and so the RPi cannot access
the net.

Fine, but the ethernet connection is still available as shown by
the led's and the laptop.
Now the ssh should still run the daemon sshd.
This is a server and provides a connection ip address and name for
the client(laptop putty) to connect to.

If the RPI has to first connect to the internet before running
the sshd then we could not have a standalone laptop and RPi
being used as headless.

I hope this is not true.
Hi @carl47,
I appear to have confused you a little. "Internet Connection Sharing" (MS Windows terminology) does not literally refer to (mean) an "internet connection" (be it dial-up or broadband). It's a mechanism that allows Windows to share two network connections (often WiFi & wired ethernet) so that, for example, computer A, connected by wired ethernet to computer B, can use Computer B's Wifi to connect to another computer which may, or may not be "on the internet". As I understand things, as a "by-product" of that mechanism a DHCP server is set running on computer B. Since a Pi's network setup default's to requiring DHCP if you cannot change that then the use of ICS (even though computer B's WiFi may not be in use) is required.

However there is an alternative, if you can login to the Pi directly, use a static IP address on the Pi (there are a number of threads that should provide info. about that process). The "tricky bit", perhaps, is setting up the Windows ethernet port with an appropriate static address too. That depends upon the Windows version, and it's some years since I last did that (probably for Windows 98) so I'm not the best person to advise you. Hope that's a "bit clearer", sorry I can't be of more help.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

carl47
Posts: 9
Joined: Wed Oct 02, 2013 5:00 am

Re: Cant find ip address in ssh

Wed Oct 09, 2013 9:42 pm

Thanks trevor for your followup.

I was refering to windows ICS. This allows any internet connection
to be shared via lan or wifi to another computer.
I's easy to setup and full instructions are available with windows.

I have done this when I had a broadband dialup. I could share the
connection with a second computer using lan cable.
I could also set up a wifi hotspot on the dialup computer and
connect to it using a tablet.

The problem is that now I have a switched telephone line dialup.
The bandwidth is 3 khz and the fastest speed I can get is 31 kb/s.

There is always a reduction of speed the for a sharing connection.
I can still setup sharing but the speed is to low to get anything to work.
The connecton times out before anything can happen(lan or wifi).

Windows can setup a static ip address for the shared lan connection.
However that wont help the speed problem.

Setting a static ip for the Pi sounds interesting,I will follow thatup.
Thanks for that.

I still have a questions.



1.Do we have to have the RPi connected to the net to allow ssh to operate.

2.Is there something wrong with my ssh operation.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5645
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Cant find ip address in ssh

Thu Oct 10, 2013 7:29 am

carl47 wrote: ...
I still have a questions.
1.Do we have to have the RPi connected to the net to allow ssh to operate.
2.Is there something wrong with my ssh operation.
1) The Pi does not have to be connected to the (inter)net for ssh to operate. However you do need a network (LAN) connection and the Pi has to get it's (LAN) IP address somehow. (In principle it's also possible to use ssh via a serial connection IIRC) Since using IRC to provide a DHCP server gives you other problems that leads to static IP address setups. (There are other methods but the software to use those, "Apple-like", approaches is not installed by default IIRC. Another possibility is to use a router just as a DHCP server ie. LAN connections only, no WAN)
2) Maybe. FWIW there are some PuTTY "setup" screenshots here: http://www.cpmspectrepi.webspace.virgin ... aspPi.html (They're somewhat brief though).

W.r.t. "static IP's etc." I've also experimented with USB-USB networking which uses that method. My notes on that are here: http://www.cpmspectrepi.webspace.virgin ... Cable.html
(that "network" appears as USB0)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

carl47
Posts: 9
Joined: Wed Oct 02, 2013 5:00 am

Re: Cant find ip address in ssh

Sat Oct 12, 2013 4:51 am

Trevor,thanks for pushing on. You have a happy customer.

Not only did I get ssh working between a standalone windows pc and my RPi,
I think I understand how.

From your answer(1), I decided to push on and try to establish lan connection between
my PC and my RPi.
As your previous answer suggested this had to use a static IP address on the RPi.

I will detail my setup incase this thread is of help to someone else.
Not to mention me if I need to do this again later:

On the PC I set the lan ipv4 address:
Ipaddress 169.254.117.89
Subnetmask 255.255.0.0
Defaultgateway 169.254.117.89
169.254.*.* is the link local address. Cant use this if you want to also
connect to the internet. If you have an internet connection to share and
that connection gave you an ip like 192.168.0.* you may be able to use that.


On the RPi I set the file /etc/network/interfaces to:
auto lo

iface lo inet loopback
iface eth0 inet static
address 169.254.118.2
netmask 255.255.0.0
gateway 169.254.117.89

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Now I reboot the RPi and connect the lan cable.


Windows pc-------------------lan cable----------------RPi
169.254.117.89 ~~~~~~~~~~~~~~~~~~~~169.254.118.2

In windows the firewall comes up for a new connection.Set "home"
a trusted connection.
Widows will set this lan connection as "home" without any passwords.


There should now be a lan ipv4 connection.
From a command line in windows we can ping the RPi:
C:\Users\carl>ping -n 5 169.254.118.2

Pinging 169.254.118.2 with 32 bytes of data:
Reply from 169.254.118.2: bytes=32 time=30ms TTL=64
Reply from 169.254.118.2: bytes=32 time<1ms TTL=64
Reply from 169.254.118.2: bytes=32 time<1ms TTL=64
Reply from 169.254.118.2: bytes=32 time<1ms TTL=64
Reply from 169.254.118.2: bytes=32 time<1ms TTL=64

Ping statistics for 169.254.118.2:
Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 30ms, Average = 6ms
From the RPi we can ping the pc:
pi@raspberrypi ~ $ ping -c 5 169.254.117.89
PING 169.254.117.89 (169.254.117.89) 56(84) bytes of data.
64 bytes from 169.254.117.89: icmp_req=1 ttl=128 time=1.75 ms
64 bytes from 169.254.117.89: icmp_req=2 ttl=128 time=0.628 ms
64 bytes from 169.254.117.89: icmp_req=3 ttl=128 time=0.660 ms
64 bytes from 169.254.117.89: icmp_req=4 ttl=128 time=0.623 ms
64 bytes from 169.254.117.89: icmp_req=5 ttl=128 time=0.643 ms

--- 169.254.117.89 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.623/0.861/1.752/0.445 ms
From the RPi we can now see the ip address to use in putty on the pc:
pi@raspberrypi ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:be:8c:ad
inet addr:169.254.118.2 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:72 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7734 (7.5 KiB) TX bytes:1588 (1.5 KiB)
In my handbook we should be able to see full information about sshd:
pi@raspberrypi ~ $ sudo service sshd status
sshd: unrecognized service]
Same as before, but sshd does work.


On the pc run putty and select 169.254.118.2
This gets us into ssh:
login as: pi
pi@169.254.118.2's password: (I set password to rasberry)
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

pi@raspberrypi ~ $
Thanks for the advice
Cheers from carl

Return to “Troubleshooting”