-1

I have a Raspi 2B running Raspbian and I want to connect it to the Internet with an Ethernet cable via my laptop (which is connected with WiFi to my router).

Unfortunately, I am officially connected (according to the icons in the GUI), but I can't go to the Internet and my PC cannot detect the Pi

However, when I connect my raspi directly to the router with an Ethernet cable, it works perfectly and I have a good connection.

But my router is 2 floors down, and I really can't use my Raspberry Pi properly when it is there, so I really need to connect it through my laptop (running Windows 10)...

-What I precisely want to do is to use my raspi with PuTTY on my laptop, so I enabled SSH.

-In the Network and Sharing Center on my laptop, I allowed other devices to connect to the WiFi network via my computer.

(If I don't connect it to my laptop, I know I can get a WiFi adapter, but I prefer not wasting money and trying to solve the problem instead...)

Any idea what could be wrong?

Thanks for helping

  • 1
    "Any idea what could be wrong?" Possibly, but as you have provided **ABSOLUTELY** no detail of what you have done and no status information, it would only be a guess. – Milliways Dec 11 '16 at 09:54
  • In the command prompt of my pc, I tried typing `ping raspberrypi.mshome.net `, and the first time, I lost 75% of the packets, and then I lost 100% of them everytime I tried again – Hugo Trombert Dec 11 '16 at 10:15
  • In PuTTy, when the Pi is connected to the router, I can access it, but when it is connected directly to the laptop, it is as if it wasn't connected at all ('connections times out'), so I can't access it – Hugo Trombert Dec 11 '16 at 10:18
  • Did you do anything on the Windows PC to facilitate the connection? The Pi cannot control it. – goldilocks Dec 11 '16 at 13:27
  • I only allowed other devices to connect to the network via the PC in the Network and sharing center – Hugo Trombert Dec 11 '16 at 14:04

2 Answers2

0

If you are just using a standard Ethernet cable to connect the Pi to the PC you'll likely run into problems. You will probably need to use a Crossover cable for that or put an ethernet switch (old ISP router will probably do) in between the two and assign them both static IPs on the same subnet.

As per Goldilocks' smackdown, turns out the Pi can manage crossover... Connecting the Pi direct to my Win10 PC, enabling Allow other users to connect via this connection on WiFi allowed a newly flashed Jessie/Raspbian image to connect straight away so definitely doable. Can ping the Pi's IP and {hostname}.mshome.net from PC and the Pi can ping google. Can Putty back to the Pi (after enabling SSH). Both the Windows machine and the Pi configured themselves for 192.168.137.x - can only suggest you confirm they are on the same network.

tobyd
  • 978
  • 1
  • 8
  • 13
  • This is almost certainly wrong, unless the PC is quite old. Contemporary ethernet ports -- including those on all models of Pi -- generally **do not require the use of a cross-over cable.** You can connect them directly for the exact same purpose using a normal ethernet cable. Since this is based on them sensing the crossed lines and reversing them, most likely it should work even if only *one* of the ports is so enabled, so it may not matter how old the PC is (I don't that for sure, but I do know that you don't need a cross-over cable to connect to a Pi to another non-antique computer). – goldilocks Dec 11 '16 at 13:26
  • Okay, so it's called [auto MDI-X](https://en.wikipedia.org/wiki/Medium-dependent_interface#Auto_MDI-X) and only *one* of the ports needs to be so enabled -- since the Pi is, using a crossover cable won't make any difference regardless of the PC. – goldilocks Dec 11 '16 at 13:30
  • Ok, in PuTTy, I was typing the hostname given when I typed `hostname -I` when the pi was connected to the router, and now i typed the one given to me when the pi was connected to the PC. This way, I can use the pi with PuTTy, but it still isn't connected to the internet... – Hugo Trombert Dec 11 '16 at 14:40
  • `sudo ping 8.8.8.8` Or `ping 8.8.8.8` -----> `connect: Network is unreachable` – Hugo Trombert Dec 11 '16 at 15:44
  • also unable to ping router – Hugo Trombert Dec 11 '16 at 15:51
  • If y type `route`, I get `gateway : *`, but in the command prompt of my PC, I typed `ipconfig`, and I got it, although I can't ping it... – Hugo Trombert Dec 11 '16 at 16:13
  • might be be trying `sudo route del default` then `sudo route add default gw {PC IP Address}` to point the default gateway at your PC. The routing table will restore on a reboot so might not be a permanent fix if at all. – tobyd Dec 11 '16 at 16:22
  • I only get `PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.`, and then I can't type any more command. I once got this plus `icmp_seq=x ttl=x time=x.xx ms Network is unreachable`, printing every 2 seconds forever. – Hugo Trombert Dec 11 '16 at 19:53
  • You can cancel the pings with `ctrl-c` - Did you use the IP address of the PC which is similar to the PI (on mine this was in the 192.168.137.x range) or the one on your LAN (commonly 192.168.{0.1}.x)? You would need to use the one similar to the one the Pi has gone. I'm surprised this hasn't configured itself - this worked quite well for me? – tobyd Dec 11 '16 at 22:40
  • Worked. I was copying the right IP, but not writing the right commands. So, I can ping my PC, directly through Ethernet ! – Hugo Trombert Dec 12 '16 at 17:48
  • 0% packet lost ! – Hugo Trombert Dec 12 '16 at 17:57
  • Great, and presumably out onto the Internet too? – tobyd Dec 12 '16 at 18:29
  • Nope, but at least I know that my problem is certainly a config problem, isn't ? – Hugo Trombert Dec 14 '16 at 13:55
  • Looks that way - the only difference i can think of in my setup is that i run a Pi as a DNS server so all my machines address by name - that routing thing made me wonder about this as the default gateway was the name rather than IP of my win10 machine. I'm still surprised a near identical setup doesn't work out the box. – tobyd Dec 14 '16 at 14:12
  • Thanks a lot anyway, you gave me a big picture of my problem, so I'm gonna work on it... ;) – Hugo Trombert Dec 14 '16 at 14:33
0

Try with this way, it works for me https://www.youtube.com/watch?v=NUHRhNB67F4

Mauricio

  • 1
    Welcome! Please take the [tour](http://raspberrypi.stackexchange.com/tour) and visit the [helpcenter](http://raspberrypi.stackexchange.com/help). Whilst this may theoretically answer the question, [it is preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. In fact we're [enforcing this policy](http://meta.raspberrypi.stackexchange.com/q/842/19949): please edit so that the answer stands on its own should the link break in the future. If it is not edited within 48 hours it will be converted to Community Wiki. – Ghanima Jul 28 '17 at 20:49