I got my hands on an Intel Galileo as a reward for a hackathon, and have been having a blast playing around with it. I followed the tutorial here, and it got me almost started. There was one big issue though, every tutorial glossed over how the heck to ssh into it!
This was a big issue for me, every tutorial assumes that you have prior knowledge of how to network together two devices manually. I threw everything but the kitchen sink at it, and couldn’t figure a thing out. Eventually I got it together though, so let me share how to get connected to your device.
Which network is which?
So far as we are concerned, there’s two components of the network we meed to be aware of – the ip address and the subnet mask. I’m sure you’ve heard of an ip address, but if you’re like me you likely saw the term ‘subnet mask’ and went “eh, I’ve heard that word before… I think”.
For each network, a computer has an ip address and subnet mask. Roughly speaking, the computer knows what range of addresses belong to a network by doing a bitwise ‘and’ between the ip address and mask and comparing that to the address ‘and’ed with the mask. This is roughly equivalent to mask & ip == mask & address.
If the above formula returns true, the given address is on that network, and the computer will try to communicate with that address over the network.
Getting the Galileo Up
Using the Intel Arduino IDE, run this sketch:
It will set the Galileo to use the eth0 network, with the ip address 10.0.0.2 and subnet mask 255.255.255.0. This means that it knows that if it receives a message over the eth0 connection addressed to 10.0.0.2, it knows to respond as appropriate. If a message is to be sent to a 10.0.0.X address, it will be sent out over the eth0 connection.
That’s all you need to connect the Galileo to the Ethernet, there’s only one little bit more to do on the client side to get everything set up!
Connecting over the PC
If we were to try to ssh into the Galileo now, we would see some error along the lines of ‘host not found’. The device is set up on the network, but the pc doesn’t know which network is connected to the address 10.0.0.2.
After making the physical connection, all you need to do is run ifconfig eth0 10.0.0.1 netmask 255.255.255.0. This will inform the pc that eth0 is where to look for any address in the 10.0.0.X range.
And that’s all we need! Now, if you run ping 10.0.0.2, you should get a response. Congratulations, you’re now on your way to spending waaaaaay too much time on your Galileo!