PcDuino8 Uno – Networking

Written by Cathal. Posted in IOT

Background

If you havent already, checkout the previous Post which covers the Serial Debug Port on the PcDuino8 Uno.

Most of the time you will want to use these devices in a connected capacity, If that means a connection to the world wide web, a local intranet connection or even just a direct connection to a PC or other device.

This bodes esspecially true for these small devices which slot into the embedded category of IOT (Internet of Things) which describes a collection of small interconnected devices talking to each other each programmed and equipped for a special purpose.

Hardware

We will need the following to get a basic device connection up and running.

  • A PC, I will be using a Windows 10 machine that has wifi capabilities and a free ethernet port.
  • A PcDuino8 Uno running Linaro Ubuntu
  • A Serial Debug cable similar to the previous tutorial
  • USB to Micro USB cable to power the PcDunio.
  • And Finally an Ethernet Cable (Crossover shouldnt be required with modern hardware)

Setup 1 – Manual Static Connection

I provide this method for those who dont need or have no access to an internet connection and simply want to SSH or VNC into their PcDunio8 Uno. You will need to do quite a bit more tinkering to enable internet on a statically connected device. This method comes courtessy of Smily03 over on the LinkSprite Community Forums
Edit Network Configuration Files on the Target

Firstly lets make a connection to our target through the Serial Debug cable we setup in the previous tutorial. Once connected lets make the following edits:

I assume you are using a clean image downloaded from Linksprite as covered in our initial tutorial. This means that the easy to use text editor Nano is not installed so we will have to rely on the slightly more hardcore vi text editor. I wont get into an arguement as to which editor is better, I simply prefer to use Nano as it was the first I was introduced to. However since we dont have it we will need to use vi/vim to edit the file.

Open the first file (/etc/resolv.conf) like so:

vi /etc/resolv.conf

Change the contents to look like this:

nameserver 192.168.1.1

You can change the contents by hitting INSERT to enable modification of the file, Once finished making your changes hit CTRL-C to exit edit mode and then type :w to write your changes to the disk. To exit vi simply type :q

Next lets make changes to /etc/network/interfaces:

Open the file for edit

vi /etc/network/interfaces

Add this to the end of the file or to replace your own previous manual attempts

#The Primary Network Interface
auto eth0
iface eth0 inet static
address 192.168.1.200
network 192.168.1.0
netmask 255.255.255.0

gateway 192.168.1.1
dns-nameservers 192.168.1.1

The last thing to do is to create an override for the network manager to force it into manual mode
You can do this by issuing the following command:

vi /etc/init/network-manager.override

and adding the following to that file

manual

Save your changes
Next we need to make changes in windows to the ethernet adapter to set static values that will work with our new configuration on the target.

Prepare the PC for a Static Connection

Open the Control Panel > Network and Internet > Network Connections Page. There you should see all the network related adapters you have connected or emulated on your PC.

Right-Click on the Ethernet adapter that is connected to your device. Open Properties, and select Internet Protocol Version 4 from the list and again select Properties

You will see the following:

Here we will add the static IP and other settings:

  • IP address: 192.168.1.100
  • Subnet Mask: 255.255.255.0
  • Default Gateway: 192.168.1.1

Hit Ok to finalize the settings, You should Now Reboot your device to apply the changes we made earlier.
Once your device has restarted type the following into the terminal:

ifconfig

You should see the following:

As you can see the device has an Ethernet inet address of 192.168.1.200

SSH into the Device

Using Putty we can SSH into the PcDuino8 Uno using our newly set Static IP Configuration.
Open Putty and select the SSH Radio button, Under host set it as the following linaro@192.168.1.200 and make sure the port remains at 22.



Open the connection and when prompted for a password use the word linaro

Success, Your static configuration and connection to the target device works

Connect via VNC

The VNC service allows you to visualize the desktop on your pcDunio8 Uno when you dont have an hdmi cable or monitor handy. It works much along the same lines as teamviewer and sends the graphical information over the network with the obvoius drawback being some slight lag but well worth it for ease of use.

Thankfully the VNC Daemon come preinstalled and is already running on the PcDuino Image I am running
All that you must now get is a VNC Client software for windows which you can download from here

I am using RealVNC as its easy to use and handle

Create a new connection in the software and provide the same IP address we used for connecting via SSH

Double-Click on the connection to open it.
When prompted for a password use ubuntu

You should successfully load into your Linaro desktop environment remotely

Setup 2 – Automatic Dynamic Connection

Edit Network Configuration Files on the Target
This section describes how to share your PC’s Wifi Internet connection with the PcDuino8 Uno, The settings below will also work if you coonect your PcDuino Directly into a router and restart it

If you followed the steps from Setup 1 – Manual Static Connection above we will need to undo or change them.
Firstly we need to remove the override file

rm /etc/init/network-manager.override

Then we must update /etc/resolv.conf

vi /etc/resolv.conf

Remove the nameserver we added earlier (nameserver 192.168.1.1)

Finally we must update the interface file /etc/network/interfaces

vi /etc/network/interfaces

Remove all that we added earlier and replace it with:

auto eth0
iface eth0 inet dhcp

These settings will automatically grab the settings from windows when we share our PC’s internet connection.

Prepare the PC for sharing its WIFI Internet connection

In windows enter once again the Network Connections Page through Control Panel > Network and Internet > Network Connections
Right-Click on the Ethernet Adapter and once again select Properties and then select the Properties for Internet Protocol Version 4

Set it to obtain an IP address automoatically.
Return to the Network Connections Page and Right-Click on your WIFI Adapter (or whatever device is providing internet to your PC) and select properties.

Select the Sharing Tab and Share internet with the Ethernet Adapter

You should now reboot your pcDuino8 to apply the new network configuration.
Once the device has restarted run the following again to check its connection status

ifconfig

As you can see an Ethernet inet address has been automatically applied to the device

Test your new IP and Internet Connectivity

Try to SSH into the target using the ip address ifconfig returns for you, If it works then its a great success again but this only confirms a local connection

Open the VNC Client again and connect to your new IP, Once connected open a browser and try to navigate to a web page

Thats it folks, I hope this helps those who have been struggling with networking on their pcDuino8 Uno’s.
Feel free to comment below if you have any issues or questions

Also if you wanted to you could now install Nano the text editor via this command

apt-get install nano

Have Fun Tinkering!

References

Tags: , , , , ,

Leave a comment

Copyright © 2017 Cathal McNally