ssh & ping to target works from desktop but not from laptop?

3

Now where is the problem if ssh & ping to target works from desktop but not from laptop ?

I have been able to ssh to my target from my DESKTOP using following command :--- Target IP is fixed in /etc/network/interfaces

1> target ip - 192.168.0.202
   target gateway - 192.168.0.200
   target netmask - 255.255.255.0

2> Desktop ip - 192.168.0.204
   Desktop gateway - 192.168.0.200
   Desktop netmask - 255.255.255.0

3> ssh pi@192.168.0.202 ----- ping 192.168.0.202 ----->> works fine from desktop

4> Now i am trying the same with my laptop. My laptop also have wi-fi. I have disabled wi-fi function on my laptop. And connected my target to the laptop directly. I set IP address of laptop using.

sudo ifconfig eth0 192.168.0.240 netmask 255.255.255.0

5> Ping to target from my laptop gives following error :--

ignite@ubuntu:~$ ping 192.168.0.202
PING 192.168.0.202 (192.168.0.202) 56(84) bytes of data.
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable

6> if i ifconfig on my laptop :--

ignite@ubuntu:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:90:f5:a9:89:6a  
          inet addr:192.168.0.240  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:46 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1132 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2760 (2.7 KB)  TX bytes:261875 (261.8 KB)
          Interrupt:41 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5946 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5946 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:571442 (571.4 KB)  TX bytes:571442 (571.4 KB)

Allan

Posted 2013-01-23T13:07:10.683

Reputation: 131

Answers

1

You need to add gateway to your ifconfig configuration:

route add default gw 192.168.0.200

Make sure your interface is up:

ifconfig eth0 up

I believe this should help.

maialithar

Posted 2013-01-23T13:07:10.683

Reputation:

No gateway needed to access the local LAN, and the interface does appear to be up. – Matthew Lundberg – 2013-01-23T14:27:09.557

i have tried both adding a gateway & up onto the eth0. But both are not working. Could be firewall problem ? .... Any suggestion on this ? – Allan – 2013-01-24T05:43:53.023

0

Before setting up the ip of eth0 you must make sure that the interface is down, that is

sudo eth0 down

Then set the ip address

sudo ifconfig eth0 192.168.0.240

No need to set the Netmask address :) After this enable the interface

sudo eth0 up

Now verify once using ifconfig

This should have solved your problem :)

please do revert back if you still face any problem

Santosh A

Posted 2013-01-23T13:07:10.683

Reputation: 101