Set Static Ethernet IP Address

Most automotive sensors use static IP addresses for Ethernet communication. Each Network Interface Card (NIC) on the PolySync ECU that is communicating with a sensor must be configured to have a static IP address.

The IP address of each NIC on the ECU depends on the IP address of the sensor it’s communicating with.

1. Listing available interfaces

On Linux machines multiple Ethernet interfaces are commonly shown as eth0, eth1, etc.

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 named eth0. Each of the eth0/eth1/etc entries map directly to a physical Ethernet NIC on the ECU.

For most machines, you will see at least two entries: eth0 and lo.

2. Set IP address and subnet mask

By default the Ubuntu network manager sets the MTU packet size to automatic, and the wired connection type to DHCP. The MTU size should be increased to the maximum MTU value 9000 for the best runtime performance. The Ethernet interface must have a static IP address in the same subnet as the sensor.

On the target Linux Ubuntu ECU:

  1. Connect an Ethernet cable between the sensor and ECU
  2. Power the sensor to initiate the network communication
  3. Open the Ubuntu network manager from the toolbar at the top of the screen with WiFi WiFi, or wired Wired connection icons
  4. Click on the “Edit Connections” menu item at the bottom of the drop-down list
    • Network connections
  5. Select the NIC that is associated to the physical Ethernet port the sensor is connected to
    • If multiple interfaces are active in the Ubuntu network manager, disconnect and reconnect the sensor’s Ethernet cable and monitor which connection disappears and reappears to determine which NIC the sensor is connected to
  6. Click the “Edit…” button
  7. In the second tab “Ethernet” update the MTU size from automatic, to the desired value 9000
    • eth0
  8. In the fourth tab “IPv4 Settings” click the “Method” drop-down menu and select the connection type “Manual”
  9. In the same tab, click the “Add” button and populate each of the three fields
    • Address: Sensor specifc
    • Netmask: 255.255.255.0
    • Gateway: 0.0.0.0
  10. Click the “Save…” button
  11. For the changes to take effect, click on the connection name in the Ubuntu network manager interface

2.1. Finding the sensor IP address

If the IP address of the sensor is unknown, you can use network scanning utilities to locate the IP address of the sensor.

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:

$ sudo apt-get install zenmap nmap
2.1.1 Searching for Ethernet devices
  1. Configure the Ethernet IP address for the NIC connected to the sensor
    • IP address: 192.168.0.1
    • Subnet mask: 255.0.0.0
    • Gateway: 0.0.0.0
    • MTU: automatic or 9000
  2. Start Zenmap to scan the network for other devices
    • $ sudo zenmap
  3. Enter the IP range to search, as well as the verbosity of the search
    • Target: 192.168.0.1/8
    • Profile: Quick scan
      • To find sensors, a “Quick scan” works well
      • Command generated by the above settings
      • $ sudo nmap -T4 -F 192.168.0.1/8

Searching with Zenmap

Once “Scan” is clicked, it can take up to ten minutes to locate the device depending on the sensor’s IP address.

One result (the local 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.

5. Validate Ethernet connection

Test the new connection with the ECU and sensor by using the system tool ping, and entering the IP address of the sensor.

$ ping <sensors-ip-address>
64 bytes from localhost (<hosts-ip-address>): icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from localhost (<hosts-ip-address>): icmp_seq=2 ttl=64 time=0.033 ms
64 bytes from localhost (<hosts-ip-address>): icmp_seq=3 ttl=64 time=0.027 ms
64 bytes from localhost (<hosts-ip-address>): icmp_seq=4 ttl=64 time=0.038 ms