Issues Setting Static IP w/ Microhard
-
We just got a few of the new sentinels with microhard carrier add-on boards. I set up the radios, but with these (as opposed to some older vehicles we got about two years ago) something is assigning an ip address on boot such that the voxl-modem service never runs successfully.
The journalctl logs show that voxl-modem is constantly "waiting for usb0 to have correct ip address" (e.g. the one I assigned while running voxl-configure-modem). The ip address that gets assigned is random every boot and on the same subnet as referenced in the file /etc/networks in the line
link-local 169.254.0.0
So I'm assuming some service is calling this on boot and assigning a random ip. Does anyone know how I can disable this? I found the voxl-static-ip script and updated it with the correct address and it works, but I don't want to have have to run it every time I boot a vehicle. Enabling the voxl-static-ip service doesn't work, I have to run the script from the terminal.
Since these new vehicles also come with a usb wifi dongle plugged into the carrier board (which is awesome) I also need to know how to turn off mac address randomization for that adapter. I need to have the adapter's mac address fixed in order to be able to access our network and I noticed it changes every time I run ifconfig. Does anyone know how to accomplish that as well?
Thanks
-
Update - I found the issue. I didn't realize how the voxl-modem service worked so I went back and looked at the sdk-1.1 version (that worked fine for me) and the sdk-1.3.2 version that shipped out with the new vehicles and noticed there's a change in logic that doesn't make sense to me
relevant portion of v1.1.0 voxl-modem
voxl-sdk/utilities/voxl-modem/-/blob/sdk-1.1.0/scripts/voxl-modem
starting at line 587else: print '[INFO] Using usb0 for Microhard' while "usb0" not in dmesg_output: time.sleep(1) try: dmesg_output = subprocess.check_output(["dmesg"], shell=True) except: print("waiting for usb0...") print '[INFO] usb0 detected, pulling up' if "qrb5165" in uname or "qrb5165-rb5" in uname or "m0104" in uname or "m0054" in uname or "m0052" in uname: print("[INFO] Opening config file...") config_file = open("/etc/modalai/voxl-modem.conf") print("[INFO] Converting to json...") config_dict = json.load(config_file) print("[INFO] Reading Microhard IP...") microhard_ip = config_dict["microhard_ip"] print("[INFO] Waiting for usb0 interface to be available") while "usb0" not in subprocess.check_output(["ifconfig"], shell=True): time.sleep(1) print("[INFO] Setting IP to:", microhard_ip) subprocess.call(["ifconfig", "usb0", microhard_ip]) else: subprocess.call(["ifup", "usb0"])
^ this just checks for "usb0" to show up as an available interface in the "ifconfig" call then assigns the appropriate ip address (microhard_ip) to that interface with the call to subprocess.call(["ifconfig", "usb0", microhard_ip])
relevant portion of v1.3.2 voxl-modem
voxl-sdk/utilities/voxl-modem/-/blob/sdk-1.3.2/scripts/voxl-modem
starting at line 610else: print '[INFO] Using usb0 for Microhard' while "usb0" not in dmesg_output: time.sleep(1) try: dmesg_output = subprocess.check_output(["dmesg"], shell=True) except: print("waiting for usb0...") print '[INFO] usb0 detected, pulling up' if "qrb5165" in uname or "qrb5165-rb5" in uname or "m0104" in uname or "m0054" in uname or "m0052" in uname: print("[INFO] Opening config file...") config_file = open("/etc/modalai/voxl-modem.conf") print("[INFO] Converting to json...") config_dict = json.load(config_file) print("[INFO] Reading Microhard IP...") microhard_ip = config_dict["microhard_ip"] while(True): print("Waiting for 'usb0' to have the correct IP address...") try: Execute the command to get network interface information result = subprocess.check_output(["ifconfig usb0"], shell=True) print(result) # Check if the command executed successfully if "inet 192.168.168." in result: break except Exception as e: print("IP not yet set") time.sleep(1) print("[INFO] Setting IP to:", microhard_ip) subprocess.call(["ifconfig", "usb0", microhard_ip]) else: subprocess.call(["ifup", "usb0"])
^ since this is blocking on a check for ifconfig usb0 to already show up with an ip address assigned to the 192.168.168. subnet (and it's not because some network service is assigning an address on a different subnet via assumingly dhcp first) it never gets to the call to set the correct ip address for the microhard modem for the usb0 interface
I'm not sure why it's necessary to check for the existence of a usb0 interface that already has an ip address on the 192.168.168 subnet, I'm assuming it never will by default. Even if I could set it up to (maybe change the etc/networks file to use the correct subnet) I'm not sure I'd want to since I could have ip conflicts with other devices on the network on boot
Follow up questions:
- can the logic in this script in the voxl-modem package be reverted so it doesn't hang when it encounters the wrong ip here and just check for the interface and sets the correct one as done previously?
- where is this shell script located in the file system so I can change it in the interim without rebuilding the package? (or do I have to rebuild the package to realize changes regardless?)
also if anyone has experience turning off mac address randomization as per the second part of my original post I'd appreciate any tips
Thanks
-
@jmltt The script itself lives at
/usr/bin/voxl-modem-start
If you have suggested changes feel free to fork the repo and submit a merge request and I'll take a look!
-
@tom I found the voxl-modem script in usr/bin, thanks! Swapping out the logic in the microhard_configure function with the v1.1.0 sdk revision worked for me.
My only suggested change would literally be reverting to the exact same logic for that function as was used in the previous version. I'm assuming it was changed for a reason,but idk what that reason is. I guess my question was more "why did this change and can we just change it back?". Is that more something I should raise as an issue on the gitlab repo or should I just submit a merge request like you said and let you guys figure it out?
Sorry not sure what best practices are when raising these kinds of things