dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Issue "Network Error : Connection refused"

Mon Jun 17, 2019 1:38 am

I am facing a strange problem. I am using windows 10, raspbian stretch lite(2019)/raspbian stretch(Nov2018) and I don't have a monitor. Earlier I could get through ras-pi screen using my laptop after creating 'ssh' file in root and using putty. However now I get connection refused error. Here is what all I tried.

a) deleting raspberrypi.mshome.net from putty and adding it again, same error.
b) changing ethernet's(raspberrypi's) ip from 192.168.137.66 to 192.168.137.67. putty with 'raspberrypi.mshome.net' now gives timeout error. I can not successfully ping to 'raspberrypi.mshome.net' as well. command arp-a shows new address(192.168.137.67) though and I can ping to 192.168.137.67.
c) ipconfig /release and ipconfig/renew. same error
d) My laptop's Wi-Fi ip is different(192.168.0.102) and this command 'arp-a' confirms that
e) this is strange. I removed power of ras-pi, still I was able to ping successfully 'raspberrypi.mshome.net' with 192.168.137.66 ip address through 'arp-a' command showed only my laptop's ip address(192.168.0.102). It did not show 192.168.137.66
f) Whenever I put 'ssh' file in boot and try to connect using putty, the 'ssh' file gets deleted, still putty gives connection refused error
g) this is one small green light. I could connect from windows command line using command "ssh pi@raspberrypi" and password. I could change default country and enable SSH using raspi-config however that is it. After that commands like "sudo apt-get -y install xrdp" does not work. I get this error. "Err:1 http://raspbian.raspberrypi.org/raspbian stretch/main armhf fonts-dejavu-core all 2.37-1
Temporary failure resolving 'raspbian.raspberrypi.org'
Err:2 http://archive.raspberrypi.org/debian stretch/main armhf libgbm1 armhf 13.0.6-1+rpi2
Temporary failure resolving 'archive.raspberrypi.org'"
etc..etc..

h) My main internet connection is shared and I have ticked both the boxes. Tried to two Wi-Fi connections. Same error.

I used to be able to connect earlier with just creating 'ssh' file using putty. Please help; let me know what else I can try out.

Regards, Dipayan

epoch1970
Posts: 6283
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Issue "Network Error : Connection refused"

Mon Jun 17, 2019 10:31 pm

At this point I think I would recommend a USB-serial adapter, e.g.
https://www.adafruit.com/product/954

That will give you a keyboard and a screen. Working with the Pi without any local access is challenging.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 1:02 am

I can buy one. So after I install the drivers and connect this cable with my laptop, this software would give me a keyboard and monitor on my laptop ??

dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 1:06 am

Also, how I can delete the 'raspberrypi.mshome.net' DNS from my windows. It seems like windows has locked on this DNS with 192.168.137.66 ip address. Any time I change my raspi's(Ethernet's) IP address to 192.168.137.67 and try to ping 'raspberrypi.mshome.net' , windows still tries to connect to 192.168.137.66.

dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 1:49 am

//some more information//

After I login using 'ssh pi@raspberrypi'

1) $ cat /etc/network/interfaces .. gives me this

interfaces(5) file used by ifup(8) and ifdown(8)
Please note that this file is written to be used with dhcpcd
For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

2) $ ip addr .. gives me this

1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:6f:56:87 brd ff:ff:ff:ff:ff:ff inet 169.254.127.248/16 brd 169.254.255.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::2059:5528:b4b2:d2df/64 scope link valid_lft forever preferred_lft forever 3: wlan0: mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:27:eb:3a:03:d2 brd ff:ff:ff:ff:ff:ff

3) I can not ping 8.8.8.8 and I can not see an ip4 address as well in $ip addr

How can this be resolved ??

PhatFil
Posts: 1705
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 4:20 am

dipayan wrote:
Tue Jun 18, 2019 1:06 am
Also, how I can delete the 'raspberrypi.mshome.net' DNS from my windows. It seems like windows has locked on this DNS with 192.168.137.66 ip address. Any time I change my raspi's(Ethernet's) IP address to 192.168.137.67 and try to ping 'raspberrypi.mshome.net' , windows still tries to connect to 192.168.137.66.
are you using a hosts file pointing raspberrypi.mshome.net to the x.x.x,66 addy on your windows machine (lmhosts.txt iirc)

when applying network changes its always a good idea to reboot the router/ap too. I have had more than one tail chasing episode cured by a router reboot.

best way to set an ip addy is via the router/dhcp server address reservation options if available.

btw the ssh file placed in the boot partition should disappear after you boot the system with it and its been 'processed' so not finding it where you left it is NOT a bad thing ;)

Ernst
Posts: 1368
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 6:03 am

dipayan wrote:
Tue Jun 18, 2019 1:06 am
Also, how I can delete the 'raspberrypi.mshome.net' DNS from my windows. It seems like windows has locked on this DNS with 192.168.137.66 ip address. Any time I change my raspi's(Ethernet's) IP address to 192.168.137.67 and try to ping 'raspberrypi.mshome.net' , windows still tries to connect to 192.168.137.66.
What you could try is to enter the following command on the windows command prompt:

Code: Select all

nbtstat -R
for more information enter nbtstat without parameters:

Code: Select all

C:\Users>nbtstat

Displays protocol statistics and current TCP/IP connections using NBT
(NetBIOS over TCP/IP).

NBTSTAT [ [-a RemoteName] [-A IP address] [-c] [-n]
        [-r] [-R] [-RR] [-s] [-S] [interval] ]

  -a   (adapter status) Lists the remote machine's name table given its name
  -A   (Adapter status) Lists the remote machine's name table given its
                        IP address.
  -c   (cache)          Lists NBT's cache of remote [machine] names and their IP addresses
  -n   (names)          Lists local NetBIOS names.
  -r   (resolved)       Lists names resolved by broadcast and via WINS
  -R   (Reload)         Purges and reloads the remote cache name table
  -S   (Sessions)       Lists sessions table with the destination IP addresses
  -s   (sessions)       Lists sessions table converting destination IP
                        addresses to computer NETBIOS names.
  -RR  (ReleaseRefresh) Sends Name Release packets to WINS and then, starts Refresh

  RemoteName   Remote host machine name.
  IP address   Dotted decimal representation of the IP address.
  interval     Redisplays selected statistics, pausing interval seconds
               between each display. Press Ctrl+C to stop redisplaying
               statistics.

The road to insanity is paved with static ip addresses

User avatar
DougieLawson
Posts: 41083
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 9:57 am

dipayan wrote:
Tue Jun 18, 2019 1:06 am
Also, how I can delete the 'raspberrypi.mshome.net' DNS from my windows. It seems like windows has locked on this DNS with 192.168.137.66 ip address. Any time I change my raspi's(Ethernet's) IP address to 192.168.137.67 and try to ping 'raspberrypi.mshome.net' , windows still tries to connect to 192.168.137.66.
ipconfig /flushdns
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

LTolledo
Posts: 5055
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 10:04 am

Am confused by all the IP addresses, seems not consistent with a local network connection...
If your win10pc's IP address is 192.168.0.102, your RPi should be in the same range as 192.168.0.xxx.

How about restarting again.... from zero start.

Also please heed epoch1970's recommendation regarding the keyboard and screen...
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Ernst
Posts: 1368
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 12:24 pm

dipayan wrote:
Mon Jun 17, 2019 1:38 am
I am facing a strange problem. I am using windows 10, raspbian stretch lite(2019)/raspbian stretch(Nov2018) and I don't have a monitor. Earlier I could get through ras-pi screen using my laptop after creating 'ssh' file in root and using putty. However now I get connection refused error. Here is what all I tried.
Please give us the full information on what you have done, how you have the Pi connected to your computer, what you have changed on your computer, and what you changed on the Pi while you were logged in over ssh.
The road to insanity is paved with static ip addresses

Ernst
Posts: 1368
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 12:27 pm

LTolledo wrote:
Tue Jun 18, 2019 10:04 am
Am confused by all the IP addresses, seems not consistent with a local network connection...
If your win10pc's IP address is 192.168.0.102, your RPi should be in the same range as 192.168.0.xxx.

How about restarting again.... from zero start.

Also please heed epoch1970's recommendation regarding the keyboard and screen...
I don't think that a keyboard and screen is needed, this looks to be a PICNIC problem. IMHO there is ICS hidden in the background, maybe with a bit of creative DHCP mangling.
The road to insanity is paved with static ip addresses

dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 5:52 pm

Ernst wrote:
Tue Jun 18, 2019 12:24 pm
Please give us the full information on what you have done, how you have the Pi connected to your computer, what you have changed on your computer, and what you changed on the Pi while you were logged in over ssh.
I connected raspberry pi and laptop with an Ethernet cable. Power supply to Ras-pi is done using my 5V cellphone charger. I am using raspbian stretch lite and also created a ssh file in root folder.

After this problem occurred, I tried changing IP address of Ethernet connection(at windows network & sharing option). After connecting over SSH, I changed the the default country and enabled SSH option.

Also strangely, though my raspberry pi is not connected to may laptop now, I still can successfully ping to 'raspberrypi.mshome.net'. I tried ipconfig /flushdns. However I still can ping without connecting raspberry pi to laptop. This ping was supposed to fail as ras-pi is not connected.

Here is what I got
============================================================
C:\Users\dipayan>ping raspberrypi.mshome.net

Pinging raspberrypi.mshome.net [192.168.137.66] with 32 bytes of data:
Reply from 192.168.137.66: bytes=32 time<1ms TTL=128
Reply from 192.168.137.66: bytes=32 time<1ms TTL=128
Reply from 192.168.137.66: bytes=32 time<1ms TTL=128
Reply from 192.168.137.66: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.137.66:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
============================================================

Ernst
Posts: 1368
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Issue "Network Error : Connection refused"

Tue Jun 18, 2019 9:14 pm

dipayan wrote:
Tue Jun 18, 2019 5:52 pm
Ernst wrote:
Tue Jun 18, 2019 12:24 pm
Please give us the full information on what you have done, how you have the Pi connected to your computer, what you have changed on your computer, and what you changed on the Pi while you were logged in over ssh.
I connected raspberry pi and laptop with an Ethernet cable. Power supply to Ras-pi is done using my 5V cellphone charger. I am using raspbian stretch lite and also created a ssh file in root folder.

After this problem occurred, I tried changing IP address of Ethernet connection(at windows network & sharing option). After connecting over SSH, I changed the the default country and enabled SSH option.
What problem ?

The PC provides a DHCP service and a DNS proxy when Internet Network Sharing (ICS) is configured. This means that you do not have to change IP addresses to get it to work. This has nothing to do with SSH or country settings.

Very important question: How long did you wait before removing power after you booted the Pi the first time ? If it was less than 5 minutes I suggest you re-image the card, place ssh file, and try again, this time be patient.
The road to insanity is paved with static ip addresses

dipayan
Posts: 15
Joined: Mon Jun 17, 2019 1:08 am

Re: Issue "Network Error : Connection refused"

Thu Jun 20, 2019 1:03 am

Ernst wrote:
Tue Jun 18, 2019 9:14 pm

What problem ?

The PC provides a DHCP service and a DNS proxy when Internet Network Sharing (ICS) is configured. This means that you do not have to change IP addresses to get it to work. This has nothing to do with SSH or country settings.

Very important question: How long did you wait before removing power after you booted the Pi the first time ? If it was less than 5 minutes I suggest you re-image the card, place ssh file, and try again, this time be patient.
Good news is, finally I was able to resolve this problem. I rather went for a static ip(changed cmdline). Once logged on, entered SSID to connect to wi-fi. Once connected, installed xrdp package, connected using windows remote desktop and boom. I have ras-pi screen :) :). Thanks to all of you for helping me out, love this community.

User avatar
DougieLawson
Posts: 41083
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Issue "Network Error : Connection refused"

Thu Jun 20, 2019 8:06 am

Now take the ip= out or you WILL delay booting by 120 seconds when the ethernet cable is disconnected.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Return to “General discussion”