-1

I have connected my raspberry pi via ethernet cable to my laptop, whose wifi connection I intend to use to allow the raspberry pi to connect to the internet.

But when I turn on internet sharing I can't ssh to my raspberry pi anymore, while I can when internet sharing is turned off.

EDIT: I am sometimes able to get it connected to the internet, but it will disconnect after 30 seconds or so. When the internet is up I can ping from one to the other, but after it goes down again I can't anymore.

Pi IP: 192.168.137.150

Laptop IP: 192.168.137.1

Ok after disabling my ethernet and enabling it again I can get the raspberry pi to connect to the internet again, but it still stops working after 30 seconds to a minute

Furthermore after it disconnects the routing table on the raspberry pi takes a lot longer to load, I hope this helps someone figure out what my issue is

  • Welcome to Stack Exchange! Depending on your knowledge level this is probably too simple or too complex but... You have used the private IP address block 192.168.137.0/24 on the wired connection between the laptop and the Pi. Can you confirm that on the wireless network, your laptop has a different IP address on a different block, which connects to a gateway router on that block? E.g. you might have a router at 10.0.0.1 and the laptop is assigned 10.0.0.50 on that network. Can you also mention what OS you are using on the laptop? This connection sharing concept should work, but the details are – Tai Viinikka Oct 25 '17 at 15:28

2 Answers2

0

Why can you not access your Pi while internet sharing? Your computer is creating a new independent network for your Pi. So you have to think...

Without internet sharing your Pi is part of a different network than with internet sharing. So your computer and your Pi will have different IP addresses.

The easiest way to overcome this is to NOT USE IP ADDRESSES when trying to connect to your Pi over ssh. USE THE HOSTNAME instead. Your computer and your Pi will happily find eachother. ssh pi@raspberrypi or ssh pi@raspberrypi.local should do the trick if you take a plain vanilla RaspiOS image without changes.

kwasmich
  • 2,702
  • 15
  • 22
0

This is NORMAL. You can have EITHER ICS OR ssh access, not BOTH.

It is not impossible to have both, but this requires additional software and complex configuration on the laptop, and this is off-topic for this site. NOTHING you can do on the Pi is going to make it work.

Milliways
  • 59,890
  • 31
  • 101
  • 209