0

I have given static IP 192.168.137.20 with net mask 255.255.255.0 to my windows laptop port:

enter image description here

Then I connected my rasberry pi (which runs Ubuntu 20.04) using USB and ran following command to also give it a static IP and netmaskputtsdsdsd:

# sudo ifconfig eth0 192.168.137.50 netmask 255.255.255.0

Now both of them should be on same network. I connected my raspberry pi to my laptop using ethernet port and tried to connect to it over ssh using putty. Earlier it used to work with same procedure, but now it does not. In fact I am not able to ping each device from other device over Ethernet. I tried:

ping 192.168.137.50

on laptop and

ping 192.168.137.20

on raspberry pi. Both say Destination Host Unreachable.

Now only thing I recall could be an issue is some config file. I recall modifying /etc/resolv.conf when I was able to connect over ssh, but not able to ping google. However, I changed it back, below is how it currently looks like:

# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 127.0.0.1

Am I missing anything?

PS:

The ifconfig shows following on rasberry pi:

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 192.168.137.50  netmask 255.255.255.0  broadcast 192.168.137.255
    ether 18:9b:a5:40:5d:59  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
RajS
  • 251
  • 2
  • 3
  • 11
  • Does `ifconfig eth0` or `ip link ls eth0` at least show that it has established a link? – u1686_grawity Aug 14 '23 at 04:59
  • Added output of `ifconfig eth0`. – RajS Aug 14 '23 at 05:30
  • 1. Try to add the Pi as the default gateway for the computer? 2. Try to put a switch between the devices ( so, they won't be directly connected, just on the same network ). 3. Attach `ping` output – Netan Aug 14 '23 at 05:40
  • IIRC windows is a bit wierd https://superuser.com/questions/299901/direct-ethernet-connection-between-two-wirelessly-connected-windows-7-laptops and I'd second trying adding the PI as a default gateway. Also try a different range - I do my test net with 192.168.2.x for example and I know it works – Journeyman Geek Aug 14 '23 at 05:56

0 Answers0