SSH from Ubuntu to embedded linux
2014-04
I'm a beginner un networking. I'm trying to connect an embedded linux to my Ubuntu 12.04.3 LTS by Ethernet.
I have configured the embedded system to work with a static IP adress (192.168.9.119).
I've add an eth1 interface on my Ubuntu, and set static IP to 192.168.9.118.
The embedded linux is directly connected to my eth1 via ethernet, but it doesn't works.
My ifconfig :
eth0 Link encap:Ethernet HWaddr 00:25:64:f8:7a:7a
inet addr:192.168.200.58 Bcast:192.168.200.255 Mask:255.255.255.0
inet6 addr: fe80::225:64ff:fef8:7a7a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:339694 errors:0 dropped:0 overruns:0 frame:0
TX packets:122045 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:81556483 (81.5 MB) TX bytes:92889268 (92.8 MB)
eth1 Link encap:Ethernet HWaddr 00:50:ba:51:d2:9e
inet addr:192.168.9.118 Bcast:192.168.9.255 Mask:255.255.255.0
inet6 addr: fe80::250:baff:fe51:d29e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:66 dropped:0 overruns:0 carrier:132
collisions:1122 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:4068 (4.0 KB)
Interrupt:22 Base address:0xec00
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:65536 Metric:1
RX packets:82 errors:0 dropped:0 overruns:0 frame:0
TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6696 (6.6 KB) TX bytes:6696 (6.6 KB)
The ifconfig on the embedded device (don't care of eth0) :
eth0 Link encap:Ethernet HWaddr 00:50:C2:D5:D3:3D
inet addr:192.168.6.118 Bcast:192.168.6.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1974 (1.9 KiB) TX bytes:2624 (2.5 KiB)
Interrupt:13 Base address:0xc000
eth1 Link encap:Ethernet HWaddr 00:50:C2:D5:D3:3E
inet addr:192.168.9.119 Bcast:192.168.9.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:97 errors:0 dropped:0 overruns:0 frame:0
TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10905 (10.6 KiB) TX bytes:7773 (7.5 KiB)
Interrupt:13
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
SSH error message (I think it's useless to you but I put it anyway) :
ssh: connect to host 192.168.9.119 port 22: No route to host
Have you any idea on whats wrong ? Thanks
EDIT: Is this normal ?
user@linux:~$ ethtool eth1
Settings for eth1:
Cannot get wake-on-lan settings: Operation not permitted
No data available
route -n (on embedded device) :
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.9.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 192.168.6.1 0.0.0.0 UG 0 0 0 eth0
And now, arp -n and route -n on Ubuntu :
user@linux:~$ arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.200.120 ether b8:ac:6f:b5:90:61 C eth0
user@linux:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.200.1 0.0.0.0 UG 100 0 0 eth0
192.168.9.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Did you make the cabling yourself? It looks like you have a cabling issue on eth1
collisions:1122
I have 2 ubuntu boxes in a WiFi network. Below is the 'ifconfig' of my destination machine.
But in my source machine, I tried 'ssh 192.168.1.2' I get connection refused.
$ ifconfig
eth0 Link encap:Ethernet HWaddr c8:0a:a9:4d:d6:6a
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:35
wlan0 Link encap:Ethernet HWaddr 00:23:14:32:e8:dc
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::223:14ff:fe32:e8dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:319828 errors:0 dropped:0 overruns:0 frame:0
TX packets:618371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30642011 (30.6 MB) TX bytes:921522542 (921.5 MB)
How to set up so that I can ssh from 1 box to another?
There are a couple of things you need:
- The IP address and credentials to login to the destination machine (obviously)
- Make sure you can actually reach the other IP address. The ping command is your best friend here.
- Remember that by default, root cannot remotely login via ssh. Use sudo
- You need to make sure that openssh is installed. You can do this using Synaptics, search for openssh.
- Look for a "meta package" for openssh. This will implement all needed components. Or just install openssh-server. You may have to accept other dependent packages to also be installed.
- If you have a firewall installed, make sure that port 22 is open for inbound connection. This should be open by default.
Once all this is done, start the command-line prompt on the client machine, and enter the command:
$ ssh username@ipaddress Substitute "username" with the login id to use on the destination machine, and ipaddress with the full IP address of the server.
You can go without specifying the username. Then, the destination server will assume that you will login with the same username, only asking for the password.
In more advanced setup, you can look at setting SSH to listen on a different port. You can also use the certificate-based authentication. Look around on the internet for more documentation.
Make sure on the destination machine that port 22 is open and that sshd is running.