User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Headless Ethernet connection - refused

Mon Dec 04, 2017 6:30 pm

I have the latest raspbian on an sd card and I have added the file 'ssh' to the /boot partition.

When I connect to the pi using putty I get the connection refused reply.

I am connecting from xubuntu via a cat5 cable and the ethernet is shared. In the network connection information the ip address is given as 10.42.0.1 and I can ping that address.

Putty is using 10.42.0.1; SSH on port 22.

I cannot fathom why the connection is refused and cannot go any further with using the pi as a WOL server.

wh7qq
Posts: 708
Joined: Thu Oct 09, 2014 2:50 am

Re: Headless Ethernet connection - refused

Mon Dec 04, 2017 7:59 pm

Is 10.42.0.1 your router's LAN ip adress? with a "buntu" you should not need to bother with putty but just enter the account address (for example, pi@192.168.1.XX)

Code: Select all

 ssh pi@192.168.1.xx
in a cli window and when requested, pi's password, and you should get in. If you get a "connection refused" response to that, you may have the username or password wrong or the headless Pi may be offline or not have ssh enabled.

One thing that regularly fools me is the keyboard thing...a new installation of Raspbian always defaults to a UK keyboard layout which has "@" and " " " reversed from the US keyboard and my password uses @; and there seems to be a disconnect between the "raspi-conf" cli implementation and the GUI in LXDE...one does not set the other so between the two, I get in a mess.
Last edited by wh7qq on Tue Dec 05, 2017 5:02 am, edited 1 time in total.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Mon Dec 04, 2017 10:41 pm

The pi is connected to the pc with a network cable and according to the linux active network connections the address of the pi is 10.42.0.1.

The router address is 192.168.2.1 but the pi has not yet been set up because I cannot ssh in.

I have connected the pi to a wireless keyboard and mouse and hdmi to my tv. With that I have set up raspi-config to enable ssh. However I am still locked out. But know I am connected because I can ping the pi.

I need to setup the pi with the information required to connect to my wifi.

putty get the password request after connecting. I know the password is correct because I set it up in raspi-config. The username is pi. It is online because I can ping it.

Code: Select all

makem@ssdTOSH:~$ pi@10.42.0.1
pi@10.42.0.1: command not found
makem@ssdTOSH:~$ ssh pi@10.42.0.1
ssh: connect to host 10.42.0.1 port 22: Connection refused
makem@ssdTOSH:~$

wh7qq
Posts: 708
Joined: Thu Oct 09, 2014 2:50 am

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 5:31 am

Not sure where the 10.... address is coming from. Can you see the RPi in the router's device list page? That is the address you should be trying to ssh into and if the router's address is 192... as most are, the RPi should be in that grouping also: 192.168.2.XX . If the router is set up to give out IP addresses with DHCP it almost has to be in that subnet.

If you have an ethernet connection and you can bring up the RPi desktop, with either the console window or the main menu you should be able to enable ssh. In the console, use

Code: Select all

sudo raspi-config
and you will be able to enable ssh with the Interfacing Options. From the desktop main menu?Preferences>Raspberry Pi Configuration>Interfaces you can enable or disable SSH by clicking on the appropriate radio button. It should have been automatically enabled if you put the empty file named simply ssh in the top directory of the /boot partition.

Putty may just be bringing up some default value for the IP address but forget Putty and just use xubuntu's console window (command line window or cli or terminal) and enter

Code: Select all

ssh pi@102.168.2.XX
Enter and put in the password "raspberry" (without quotes) when requested. Both the RPi and the xubuntu ethernet ports should be connected to the LAN outputs of the router.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

wh7qq
Posts: 708
Joined: Thu Oct 09, 2014 2:50 am

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 5:36 am

I just reread your post. Connect the RPi directly to the router LAN port...going to the PC just complicates things for now. DO NOT CONNECT RPI TO THE PC!!! If you need to go that route for your own reasons, do it later after the RPi is all set up and working.
Sent by WH7QQ from an RPi3/Raspbian/pixel desktop.

User avatar
HawaiianPi
Posts: 1388
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 6:29 am

You can pre-configure Raspbian to connect to your wireless network, and it can be done in the small FAT32 partition that is accessible from Windows or Mac computers. This pre-configuration feature was added in Raspbian Jessie and works equally well in Stretch.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card. You don't need to extract the image or format the card prior to writing. Just choose the Raspbian .zip, pick your SD card and write (if you have trouble, verify the SHA256 checksum of the download).
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the SD card.
  5. On that small partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. If you are connecting to your router with an Ethernet cable, safely eject the card and use it to boot your Pi.
  7. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
    	ssid="Your network name/SSID"
    	psk="Your WPA/WPA2 security key"
    	key_mgmt=WPA-PSK
    }
    Edit country=, ssid= and psk= with your information and save the file.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. If you have installed iTunes or Bonjour you should be able to connect using raspberrypi.local instead of the Pi's IP address. However, if you have more than one Raspberry Pi on your network, and you have not changed the default hostnames, then you'll probably need to use the IP address.

To get your Pi's IP address, login to your router and look for raspberrypi in the list of connected clients. Or you could use a network scanner app, like Fing for your phone, which will scan your network and list all connected devices. If you have an ASUS router they have their own phone app.

Fing app: https://play.google.com/store/apps/deta ... fing&hl=en
ASUS Router app: https://play.google.com/store/apps/deta ... home&hl=en
Both of these should also be available for iPhone.
My password is the last 8 digits of Pi.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 11:08 am

For the moment because a lot of suggestions have been made at one time for which I am grateful, please let me say:

I have had since the pi first came out, a pi working as a backup store which has two 1TB drives and I understand how to set up the pi using a wired system. That pi is only turned on when I need it (no conflict) and is used headless.

I wanted to set up the pi with a shared network connection from a pc which seems easy to do using windows. I wanted to do this headless from the start as I see many guides.

It does look like I will have to set up the pi with a wire first eventually but what I do not understand is why having enabled ssh in raspi-config, I cannot ssh in.

I will reformat the sd card, and as before use etcher to install a fresh copy.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 11:15 am

wh7qq wrote:
Tue Dec 05, 2017 5:31 am
Not sure where the 10.... address is coming from. Can you see the RPi in the router's device list page?
I am connecting from a xubuntu pc via a cat5 cable and the ethernet is shared. In the network connection information the ip address is given as 10.42.0.1 and I can ping that address. No, I cannot see the pi in the router. I do not expect to at this stage as it is not connected to the router.

https://noargs.wordpress.com/2015/05/0 ... n-server/
That is the address you should be trying to ssh into and if the router's address is 192... as most are, the RPi should be in that grouping also: 192.168.2.XX . If the router is set up to give out IP addresses with DHCP it almost has to be in that subnet.

If you have an ethernet connection and you can bring up the RPi desktop, with either the console window or the main menu you should be able to enable ssh. In the console, use

Code: Select all

sudo raspi-config
and you will be able to enable ssh with the Interfacing Options. From the desktop main menu?Preferences>Raspberry Pi Configuration>Interfaces you can enable or disable SSH by clicking on the appropriate radio button. It should have been automatically enabled if you put the empty file named simply ssh in the top directory of the /boot partition.

Putty may just be bringing up some default value for the IP address but forget Putty and just use xubuntu's console window (command line window or cli or terminal) and enter

Code: Select all

ssh pi@102.168.2.XX
Enter and put in the password "raspberry" (without quotes) when requested. Both the RPi and the xubuntu ethernet ports should be connected to the LAN outputs of the router.
Last edited by makem on Tue Dec 05, 2017 1:27 pm, edited 1 time in total.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Tue Dec 05, 2017 12:43 pm

HawaiianPi wrote:
Tue Dec 05, 2017 6:29 am
You can pre-configure Raspbian to connect to your wireless network, and it can be done in the small FAT32 partition that is accessible from Windows or Mac computers. This pre-configuration feature was added in Raspbian Jessie and works equally well in Stretch.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card. You don't need to extract the image or format the card prior to writing. Just choose the Raspbian .zip, pick your SD card and write (if you have trouble, verify the SHA256 checksum of the download).
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the SD card.
  5. On that small partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. If you are connecting to your router with an Ethernet cable, safely eject the card and use it to boot your Pi.
  7. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
    	ssid="Your network name/SSID"
    	psk="Your WPA/WPA2 security key"
    	key_mgmt=WPA-PSK
    }
    Edit country=, ssid= and psk= with your information and save the file.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. If you have installed iTunes or Bonjour you should be able to connect using raspberrypi.local instead of the Pi's IP address. However, if you have more than one Raspberry Pi on your network, and you have not changed the default hostnames, then you'll probably need to use the IP address.

To get your Pi's IP address, login to your router and look for raspberrypi in the list of connected clients. Or you could use a network scanner app, like Fing for your phone, which will scan your network and list all connected devices. If you have an ASUS router they have their own phone app.

Fing app: https://play.google.com/store/apps/deta ... fing&hl=en
ASUS Router app: https://play.google.com/store/apps/deta ... home&hl=en
Both of these should also be available for iPhone.
Thank you for that full explanation. However, I am aware of some 99% of it having used the pi for several years. In this case I have neve tried sharing but for my purpose I need to so I thought why not from square one use headless sharing. It is the ssh lockout I have never had before having used the 'ssh file' method and the raspi-config of enabling ssh. But I will fix it.

The link for Fing re. ASUS is interesting. I have a RT-AC68U with asus-wrt firmware. (Bit of a gimmick so have uninstalled it)

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 11:49 am

Thanks all.

I have connected the pi to a tv and directly to the router. I have set up the pi completely and can access it via putty whilst connected that way.

To set up the pi for a connection to the internet from a shared connection with my linux pc I do need access via that shared connection in some way.

I am back to the same problem. The connection information given is:

Ipv4
ip address: 10.42.0.1
Broadcast address: 10.42.0.255
Subnet mask: 255.255.255.0

I can ping that address (as I could before) but trying to access it using putty I get the connection refused error.

When I first attempted this I was able to connect but during my attempt to setup the connection I decided to reformat and reinstall raspbian. Since then I have had this error. I was wondering if it was related to certificates being different so so have tried uninstalling and removing all putty setting and using a fresh install. The same error occurs.

If it is a fresh install of raspian it cannot be that end of the certificates. So, what is causing this error? I have no way that i am aware of finding out.

Dycius
Posts: 3
Joined: Thu Nov 23, 2017 10:28 am

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 12:27 pm

Is your Ethernet cable a crossover cable?

The way I understand it, is that you want a a direct connection to your desktop with the RPi for back up over Ethernet as it's faster to transfer files? I use to do this with a host and guest set up with KVM/qemu. You need to have a separate subnet and ip structure.

https://askubuntu.com/questions/22835/h ... t-a-router
But change the subnet mask to different than your main PC is getting from the router.
Later you can add routes to allow the RPi onto your main network.

User avatar
rpdom
Posts: 11793
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 12:37 pm

Dycius wrote:
Thu Dec 07, 2017 12:27 pm
Is your Ethernet cable a crossover cable?
That doesn't matter. The Pi can handle crossover or straight cables. It will auto detect the cable type and switch the port to match. The PC will probably do the same. It's quite rare now to find something that doesn't auto switch.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 3:52 pm

To set up the pi to connect to the internet via a linux pc I find from research here and in ubuntu forums that I need to:

1. Go to edit connections in the pc and make a new ethernet connection if one does not exist.
2. Check that 'Device' has the MAC address of the pi
3. On IPv4 tab change 'Method' to Shared to other computers
4. Check that the pi is recognised and given an IPv4 address etc.

In my case this is given as 10.42.0.1;
Broacast: 10.42.0.255;
Mask: 255.255.255.0

That is all for the pc.

1. Go to the pi using putty and setup that side of the connection.

This is where I fail now although I am sure I was able to initially, before I re-flashed the SD card to remove entries made following post instruction when setting up the pi side which failed.

Of course, I could set up the pi side via the router where I can use putty and then reconnect to the pc direct cable. But, if putty cannot communicate, how is the communication suddenly going to start? I think something on the pc side is stopping the communication.

I need some way of tracing the putty connection request to see where it fails.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 4:05 pm

Dycius wrote:
Thu Dec 07, 2017 12:27 pm
Is your Ethernet cable a crossover cable?

The way I understand it, is that you want a a direct connection to your desktop with the RPi for back up over Ethernet as it's faster to transfer files? I use to do this with a host and guest set up with KVM/qemu. You need to have a separate subnet and ip structure.

https://askubuntu.com/questions/22835/h ... t-a-router
But change the subnet mask to different than your main PC is getting from the router.
Later you can add routes to allow the RPi onto your main network.
I am afraid that post is out of date. Out of date posts is what I have suffered from lol. Even /etc/network/interfaces is the wrong place to make entries now! It is made in /etc/dhcpcd.conf for static ip's.

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Thu Dec 07, 2017 6:56 pm

Installing openssh-server in the pc has allowed putty access to the pi BUT now the pi is not happy with the password!

The password is a very simple unforgettable word which I have confirmed works if I connect the pi to the router. I can ssh into the pi and I can access the vnc both with the same password but that password is not accepted when I connect directly from the pc.

This is doing my head in!

Surely I can access the pi from two difference routes with the same password?

EDIT: pi@192.168.2.8 - give him access!

pi@10.42.0.1 - lock him out! Even if he has the password

User avatar
makem
Posts: 178
Joined: Tue Jun 18, 2013 9:22 pm

Re: Headless Ethernet connection - refused

Sat Dec 09, 2017 5:48 pm

Having set up the pi with both ethernet and wifi connections I now have ssh access to the pi.

I have lost the ability to browse the remainder of the LAN but as that is a ubuntu problem I will research there.

The page which gave me guidance (although is is for windows/pi) was:

https://noargs.wordpress.com/2015/05/0 ... n-server/

I have not achieved WOL or WOWAN yet but getting there :-)

Return to “Raspbian”

Who is online

Users browsing this forum: cjan and 26 guests