Personal tools

How to test and use VisionSOM-6ULL Ethernet interface

From SomLabs Wiki

Revision as of 15:39, 14 November 2017 by Admin (talk | contribs)
Jump to: navigation, search

How to test and configure Ethernet interface


Default configuration

By default your VisionSOM-6ULL IP address is retrieved from DHCP server (if it is available in your network), it is a good feature, as you can connect it to network without any configuration and it will be accessible. To get VisionSOM-6ULL IP address you can log in via UART-USB converter and execute ip a command:

root@somlabs:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether a6:e3:1c:a0:3d:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.24/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:a310:813c:d700:a4e3:1cff:fea0:3db0/64 scope global mngtmpaddr dynamic
       valid_lft 1066909sec preferred_lft 462109sec
    inet6 fe80::a4e3:1cff:fea0:3db0/64 scope link
       valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default
    link/sit 0.0.0.0 brd 0.0.0.0

In this case VisionSOM address is 192.168.0.24. Other way to get the IP is to use network scanner, for example Advanced Network Scanner for Windows or use arp-scan tool on Linux:

root@somlabs:~# apt install arp-scan
root@somlabs:~# arp-scan --interface=eth0 --localnet
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.1     90:5c:44:57:3b:4a       (Unknown)
192.168.0.87    00:c0:00:04:52:5b       LANOPTICS, LTD.
192.168.0.178   58:fb:84:a3:a2:82       (Unknown)

3 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 3.178 seconds (80.55 hosts/sec). 3 responded

If you want to check if your board can communicate with Internet then you can use ping command with external IP address like 8.8.8.8 (Google DNS):

root@somlabs:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=59 time=10.7 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=59 time=16.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=59 time=15.1 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=59 time=12.9 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 10.782/13.900/16.735/2.244 ms

In some cases dynamic IP address can cause problems, for example when you want to forward a port on the router to your Linux system. In such case you should assign static IP address.

Assigning static IP address with ConnMan

By default there is ConnMan installed in VisionSOM-6ULL Debian image. To set static IP with ConnMan you need to get service name first:

root@somlabs:~# connmanctl services
*AO Wired                ethernet_000010234567_cable

Now IP address can be configured:

root@somlabs:~# connmanctl config ethernet_000010234567_cable --ipv4 manual 192.168.0.4 255.255.255.0 192.168.0.1

After manual there are: IP address, network mask and gateway IP. To switch back to DHCP IP enter:

connmanctl config ethernet_000010234567_cable --ipv4 dhcp

NOTE! As i.MX6 processors do not have configured MAC address there is random MAC assigned while booting. That will confuse ConnMan, because it identifies interfaces with MAC address and it will assign dynamic IP after every reboot. To prevent that you should set i.MX6 MAC address.

Assigning static IP address - Debian style

To assign static IP edit /etc/network/interfaces, it should contain:

auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1

Now you need to restart netrwork services:

root@somlabs:~# service networking restart

Make sure that ConnMan does not control your boards network interfaces, otherwise your settings will be lost after reboot. If you want to uninstall ConnMan execute:

root@somlabs:~# apt remove connman

Setting i.MX6-ULL MAC address

By default i.MX6 processor does not have MAC address configured, while booting you can see a message:

Warning: FEC0 (eth0) using random MAC address - a6:e3:1c:a0:3d:b0

WARNING! You can set your i.MX6-ULL processor only once! To set your MAC address to 01:23:45:67:89:ab execute these commands:

root@somlabs:~#echo 0x0123 > /sys/fsl_otp/HW_OCOTP_MAC1
root@somlabs:~#echo 0x456789ab > /sys/fsl_otp/HW_OCOTP_MAC0