Connecting To An Ethernet Sensor
Ethernet sensors have a static IP address that must be entered in the SDF Configurator to allow PolySync nodes to communicate. Once the sensor's IP address is known, the ECUs network must be configured to allow PolySync to communicate with the sensor through the Ethernet interface. The Ethernet interface is the Network Interface Card (NIC) where the sensor is connected to the ECU. On Linux, multiple Ethernet interfaces are commonly shown as `eth0`, `eth1`, etc. ### 1. Listing available interfaces Determine the Ethernet interface name(s) using the system network tool **ifconfig**: ``` $ ifconfig eth0 Link encap:Ethernet HWaddr XX:7b:XX:3b:0d:XX UP BROADCAST MULTICAST MTU:9000 Metric:1 RX packets:2893321 errors:0 dropped:0 overruns:0 frame:0 TX packets:1141728 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3150169684 (3.1 GB) TX bytes:864658858 (864.6 MB) Interrupt:20 Memory:e1200000-e1220000 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:478680 errors:0 dropped:0 overruns:0 frame:0 TX packets:478680 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1733767001 (1.7 GB) TX bytes:1733767001 (1.7 GB) ``` If there is one Ethernet interface─like the above example─the interface name will likely be **eth0**. Each of the **eth0/eth1/etc** entries map directly to a physical Ethernet NIC interface on the machine. For most machines, you will see at least two entries: _eth0_ and _lo._ ### 2. Set IP address and subnet mask Once the Ethernet interface name is known, use the **ifconfig** utility to set a temporary IP address: ```bash $ sudo ifconfig eth0 192.168.2.200 netmask 255.0.0.0 ``` A persistent IP address can be set using the Ubuntu network manager utility. ### 3. Zenmap / Nmap [Zenmap](https://nmap.org/zenmap/) is an easy to implement front-end wrapper to Nmap. Zenmap scans the specified network for hosts, and can be used to find sensors and ECUs. Utilities can be downloaded on Ubuntu with _apt-get_: ```bash $ sudo apt-get install zenmap nmap ``` ### 4. Searching for Ethernet devices Start Zenmap to scan the network for other devices. ```bash $ sudo zenmap ``` You will enter both the IP range they wish to search, as well as the verbosity of the search. To find sensors a "Quick scan" works well. ``` Target: 192.168.0.1/8 Profile: Quick scan ``` ![Searching with Zenmap](/wp-content/uploads/2016/09/zenmap_wide_search.png) Once "Scan" is pressed, it can take up to ten minutes to locate the device depending on the sensor's IP address and a developer's host IP address. One result (the developer's host) should always be visible. If there are just two returned hosts, then the sensor has been found. If three or more hosts are visible, then narrow the search by removing other sensors or ECU's from the network. Next, the PolySync SDF Configurator will need to be updated so that the dynamic driver knows which IP address to connect to. Then set the system IP address by overriding the network manager. ### 5. Overriding Ubuntu network manager The Ubuntu network manager defaults Ethernet interfaces to a DHCP mode that expects a dynamic IP address to be provided by a DHCP server (like a router). Most sensors aren't routers. It is necessary to switch the mode from **DHCP** to **Manual**, which allows you to set a static IP address matching the subnet of the sensor. Open the network manager, select the appropriate Ethernet interface, and set the IPv4 method from **DHCP** to **Manual**. IP address, subnet mask, and gateway are required fields. Test the new connection with the ECU and sensor by using the system tool **ping**, and entering the IP address of the sensor. ``` $ ping
64 bytes from localhost ( ): icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from localhost ( ): icmp_seq=2 ttl=64 time=0.033 ms
64 bytes from localhost ( ): icmp_seq=3 ttl=64 time=0.027 ms
64 bytes from localhost ( ): icmp_seq=4 ttl=64 time=0.038 ms
Congratulations! You have now successfully connected to an Ethernet sensor.