General UNIHIKER

How can multiple Unihikers be plugged into the main computer and assigned to different addresses?

userHead LL 2023-08-29 10:25:58 916 Views6 Replies

How do I plug multiple Unihikers into the host computer's USB hub and assign each Unihiker to a different address, such as 10.1.2.11, 10.1.2.12, etc.?

2023-09-02 12:51:46

Hi,

You can do so with the simple steps. create the USB hub and connect it with the computer and unihiker. I would suggest handling the unihiker with the help of the browser. Here you will go to the devices tab and mange the settings. You must know the IP addresses of Unihiker and things will go smooth. 

userHeadPic Amelia.Smith
2023-08-31 16:28:52

My 1st attempt came close, but not quite.  I think I followed your steps precisely.  I was able to get the IPs changed on A and B, and independently they worked fine.  But when both were used, the 2nd Unihiker could not be connected to.  Maybe it has something to do with the values in the range statement.  I'm not sure what that's supposed to do.  I may have to try things on a fresh install, I've done a lot of updating.

userHeadPic GaiaTonic
GaiaTonic wrote:

After a good bit of researching and experimenting, I found a variation on LL's approach that worked for me.  The difference in our is that LL tested on a Windows machine and I used an Ubuntu machine.  I expect this is the reason LL's solution did not work for me and I could only get one Unihiker working at a time.

 

For my setup I have 5 Unihikers plugged into a USB hub which powers them and networks them to my master computer running Ubuntu.  Now I have a setup where the master can ping the 5 nodes at IP addresses 11.1.2.3, 12.1.2.3, 13.1.2.3, 14.1.2.3, and 15.1.2.3.  Round trip pings between the master and slaves are VERY fast averaging around 0.300ms which is over 10x faster than using wireless and without the annoying jitter due to interference issues.  The wireless on the Unihiker can take a while to connect and warm up to speed.  The new hardwired USB network connection does not experience these issues.  

 

The hard wired network connection is also faster than using the digital IO connections of the Unihiker through pinpong for which I measured a latency of about 1ms. 

 

Here are the five /etc/dhcp/dhcpd.conf configurations, one for each Unihiker node.

 

for node #1 use this

subnet 11.1.2.0 netmask 255.255.255.0 { range 11.1.2.101 11.1.2.200; host br0 {   fixed-address 11.1.2.3; }}

 

for node #2 use thissubnet 12.1.2.0 netmask 255.255.255.0 { range 12.1.2.101 12.1.2.200; host br0 {   fixed-address 12.1.2.3; }}

 

for node #3 use thissubnet 13.1.2.0 netmask 255.255.255.0 { range 13.1.2.101 13.1.2.200; host br0 {   fixed-address 13.1.2.3; }}

 

for node #4 use thissubnet 14.1.2.0 netmask 255.255.255.0 { range 14.1.2.101 14.1.2.200; host br0 {   fixed-address 14.1.2.3; }}

 

for node #5 use thissubnet 15.1.2.0 netmask 255.255.255.0 { range 15.1.2.101 15.1.2.200; host br0 {   fixed-address 15.1.2.3; }}

 

 

… and the five /root/.xsessionrc files, one for each Unihiker node.

 

#1

echo 20 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio20/directionecho 1 > /sys/class/gpio/gpio20/valuesystemctl --user start PyboardUIifconfig br0 11.1.2.3 netmask 255.255.255.0 upsystemctl restart isc-dhcp-server 

#2

echo 20 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio20/directionecho 1 > /sys/class/gpio/gpio20/valuesystemctl --user start PyboardUIifconfig br0 12.1.2.3 netmask 255.255.255.0 upsystemctl restart isc-dhcp-server 

#3echo 20 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio20/directionecho 1 > /sys/class/gpio/gpio20/valuesystemctl --user start PyboardUIifconfig br0 13.1.2.3 netmask 255.255.255.0 upsystemctl restart isc-dhcp-server

 

#4echo 20 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio20/directionecho 1 > /sys/class/gpio/gpio20/valuesystemctl --user start PyboardUIifconfig br0 14.1.2.3 netmask 255.255.255.0 upsystemctl restart isc-dhcp-server

 

#5echo 20 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio20/directionecho 1 > /sys/class/gpio/gpio20/valuesystemctl --user start PyboardUIifconfig br0 15.1.2.3 netmask 255.255.255.0 upsystemctl restart isc-dhcp-server 

 

Boot order is important.  First power up the USB bus which powers up the Unihikers and gets their IPs registered on the network.  Then plug the hub into the master computer.  If you get the order wrong and things don't work, just unplug and plug back the USB cable to the master.

 

Enjoy building your own micro cluster applications!

2023-09-01 05:03:57
LL wrote:

Yes, your method is better, modifying the first digit of the ip address can work well on windows, ubuntu, and mac.

-----

Here is a screenshot of the modified content of these two files during my testing:

 

Here is a screenshot of my test with the two boards connected to a Mac:

2023-09-01 16:09:41
2 Replies
2023-08-29 17:55:59

Explanation of the Issue

When unihiker is connected to a computer via USB, it functions as a network interface card (Remote NDIS) device. The default IP for unihiker is set to 10.1.2.3, while the address assigned to the PC is 10.1.2.101.

Since all unihiker devices have the same default settings, multiple unihiker devices connected to the same computer will result in IP conflicts. This means that only the first unihiker board will work, and others will fail to connect.

The solution to this issue is to change the default IP of unihiker to a different one, and also change the IP assigned to the computer to a different one.

 

Warning

Note 1: This method involves command line operations and requires familiarity with Linux commands, as well as knowledge of SSH connections and the use of editors like Vim or Nano.

Note 2: It is recommended to backup the files in the board before proceeding to prevent accidental data loss.

Note 3: If an error occurs during the process and connectivity is lost, you can reflash the system image to recover.

Note 4: This method was tested on system version V0.3.5 and may not be universally applicable to other versions.

 

 

Steps

Target

After the operation, the two unihiker can be accessed via 10.1.2.11 and 10.1.2.12 respectively when connected to a computer.

WiFi Connection

Since this operation involves modifying the IP address of unihiker's USB network interface, using 10.1.2.3 for SSH access may cause disconnection during the configuration process. Therefore, connect both unihiker and the computer to the same router, and use a wireless network for SSH connection to configure them.

In my case, the IP address for unihiker-A is 192.168.50.89, and the IP address for unihiker-B is 192.168.50.203.

 

 

Setting the IP address assigned to the computer

Use the following command to modify the IP address assigned to the PC by unihiker-A to 10.1.2.110~119, with the fixed address set to 10.1.2.11:

```

cp "/etc/dhcp/dhcpd.conf" "/etc/dhcp/dhcpd.conf.bak"

 

nano "/etc/dhcp/dhcpd.conf"

```

 

 

Then modify the IP address assigned to the PC by unihiker-B to 10.1.2.120~129, with the fixed address set to 10.1.2.12:

 

 

Adding commands to modify the unihiker IP address in the startup file

 

Use the following command, as we changed the IP of unihiker-A to 10.1.2.11 in the previous step:

```

cp "/root/.xsessionrc" "/root/.xsessionrc.bak"

 

nano "/root/.xsessionrc"

```

 

Add the following two commands:

```

ifconfig br0 10.1.2.11 netmask 255.255.255.0 up

 

systemctl restart isc-dhcp-server

```

 

 

Then modify the IP of unihiker-B to 10.1.2.12:

```

cp "/root/.xsessionrc" "/root/.xsessionrc.bak"

 

nano "/root/.xsessionrc"

```

 

Add the following two commands:

```

ifconfig br0 10.1.2.12 netmask 255.255.255.0 up

 

systemctl restart isc-dhcp-server

```

 

After both boards are configured, send the "reboot" command to restart them.

```

reboot

```

 

 

Verification

 

After restarting, you can see that the IP address for the Type-C port of both boards has been set to the desired address.

 

 

In the network connections panel, you can see that there are two network cards and their IPs and DHCP Server do not conflict.

 

 

Successfully connect to both unihiker boards via SSH! 

Restart the boards and test SSH connection again. Success! This proves that the method is valid.

 

 

The local web page can be accessed normally using the new IP address.

 

 

 

 

 

 

 

userHeadPic LL
2023-08-29 12:05:43

Thank you so much for posting a solution to my problem.  I will give it a try soon…

userHeadPic GaiaTonic