ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Voxl 2 Mini Static IP

    Ask your questions right here!
    3
    11
    1006
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wilkinsafW
      wilkinsaf ModalAI Team @bendraper
      last edited by

      @bendraper It is possible to set a static ip on both the voxl2 and voxl2 mini.

      It is just ubuntu OS. What modem/router are you connecting to?

      B 1 Reply Last reply Reply Quote 0
      • B
        bendraper @wilkinsaf
        last edited by

        @wilkinsaf I was just connecting to my laptop for now. Laptop set with a static IP

        wilkinsafW 1 Reply Last reply Reply Quote 0
        • wilkinsafW
          wilkinsaf ModalAI Team @bendraper
          last edited by

          @bendraper

          Here is what one of my guys uses

          ip addr flush dev eth0
          ip link set dev eth0 up
          ip addr add 192.168.1.100/255.255.255.0 dev eth0
          
          wilkinsafW 1 Reply Last reply Reply Quote 0
          • wilkinsafW
            wilkinsaf ModalAI Team @wilkinsaf
            last edited by

            i would make sure that the ethernet is the only thing connected that is supplying network connectivity. (no modem, 4g/5g hat, etc...)
            otherwise you willl need to do some extra configuration with voxl-modem

            B 3 Replies Last reply Reply Quote 0
            • B
              bendraper @wilkinsaf
              last edited by

              @wilkinsaf This worked! Thank you

              1 Reply Last reply Reply Quote 0
              • B
                bendraper @wilkinsaf
                last edited by

                @wilkinsaf Actually it seems these settings don't stick after rebooting the voxl... Any ideas?

                1 Reply Last reply Reply Quote 0
                • B
                  bendraper @wilkinsaf
                  last edited by

                  @wilkinsaf google seems to suggest changing a /etc/network/interfaces file may do the trick but this file does not exist in the voxl filesystem

                  wilkinsafW blueB 2 Replies Last reply Reply Quote 0
                  • wilkinsafW
                    wilkinsaf ModalAI Team @bendraper
                    last edited by

                    @bendraper

                    If you make a script to do this, you might want to make it monitor eth0 state so if eth0 goes down and back up, the IP doesn't get removed.
                    Here's a bash example of what I do to check the IP address of ethernet and put it back if it goes down and back up

                    while true
                    do  
                       if [[ -e "/sys/class/net/$eth_dongle_interface" ]]; then
                             eth_dongle_ip=$(ip -4 addr show $eth_dongle_interface | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1)
                       else
                             eth_dongle_ip=""
                       fi
                    
                       if [[ "$eth_dongle_ip" != *"$ETHERNET_IP"* &&  -e "/sys/class/net/$eth_dongle_interface" ]]; then
                                    echo "setting IP address to: $ETHERNET_IP"
                                    ip addr flush dev $eth_dongle_interface
                                    sleep 1
                                    ip link set dev $eth_dongle_interface up
                                    sleep 1
                                    ip addr add $ETHERNET_IP/255.255.255.0 dev $eth_dongle_interface
                        fi
                        sleep 1
                    done
                    

                    Of course, this is in my modified voxl-modem with custom variables for the interface (eth0 or eth1) and variables for the IP address. You might just want to hard code those when testing.

                    1 Reply Last reply Reply Quote 0
                    • blueB
                      blue @bendraper
                      last edited by

                      @tom @wilkinsaf @Moderator I am hoping you can help shed some light on an issue with setting up the VOXL2 Mini with a static IP. I have seen mention of utilizing a customized version of voxl-modem for a static IP so perhaps I am missing something but I have tried every approach to setting a static IP and more than I have ever used with no avail. It seems there is a service that is enabled by default to clear the IP address of the VOXL2 Mini and messes with the routing of the eth0 interface because anything I implement does not function properly. I must be missing something here if you would please enlighten me 🙂

                      Goal:
                      Set a persistent static IP on VOXL2 Mini that is maintained after reboots and during operation, then access the VOXL2 Mini with an ssh connection via a Ethernet to USB adapter.

                      Overview of Approaches:
                      -Approach #1: Does NOT Work- Use commands to flush and wipe the eth0 interface and set a new IP as shown below. This works temporarily but is overwritten typically within 30 seconds while running. After a reboot, the IP address defaults back to 169.254.4.1 and VOXL2 Mini cannot be accessed via ssh on eth0.

                      -Approach #2: Does NOT Work- Use system.d file to set eth0 interface with a new IP as shown below. This works temporarily but is overwritten typically within 30 seconds while running. After a reboot, the IP address defaults back to 169.254.4.1 and VOXL2 Mini cannot be accessed via ssh on eth0.

                      -Approach #3: Does NOT Work- Use bash script to constantly check and set the IP. This works to set the IP but the VOXL2 Mini cannot be accessed via ssh on eth0.


                      Approach #1
                      Steps to Reproduce:

                      1. adb into VOXL2 Mini
                      2. Run:
                      ip addr flush dev eth0
                      ip link set dev eth0 up
                      ip addr add 192.168.1.100/255.255.255.0 dev eth0 
                      ifconfig
                      
                      1. Wait 2 minutes and run:
                      ifconfig
                      

                      Actual Result:
                      -IP address changes back to 169.254.4.1.
                      -Device no longer available via ssh on eth0 at 169.254.4.1.

                      Expected Result:
                      -IP should not change after being set.


                      Approach #2
                      Steps to Reproduce:

                      1. adb into VOXL2 Mini
                      2. Run: sudo mkdir -p /etc/systemd/network
                      3. Run: sudo vi /etc/systemd/network/10-eth0-static.network
                      4. Add the following to the file created above:
                      [Match]
                      Name=eth0
                      
                      [Network]
                      Address=192.169.144.15/24
                      Gateway=192.169.144.1
                      DNS=8.8.8.8
                      
                      1. Run:
                      sudo systemctl restart systemd-networkd
                      sudo systemctl enable systemd-networkd
                      ip addr show eth0
                      sudo systemctl status systemd-networkd
                      
                      1. Wait 2 minutes and run:
                      ifconfig
                      

                      Actual Result:
                      -IP address changes back to 169.254.4.1.
                      -Device no longer available via ssh on eth0 at 169.254.4.1.

                      Expected Result:
                      -IP should not change from 192.169.144.15 after being set.


                      Approach #3
                      Steps to Reproduce:

                      1. adb into VOXL2 Mini
                      2. Run:
                        vi /usr/local/bin/set-eth-dongle-ip.sh
                      3. Add the following to the file created above:
                      #!/bin/bash
                      
                      eth_dongle_interface="eth0" # Replace with your dongle interface name
                      ETHERNET_IP="192.168.144.15" # Replace with your desired IP address
                      BROADCAST_IP="192.168.144.255" # Replace with the correct broadcast address
                      
                      while true; do
                          if [[ -e "/sys/class/net/$eth_dongle_interface" ]]; then
                              eth_dongle_ip=$(ip -4 addr show $eth_dongle_interface | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1)
                          else
                              eth_dongle_ip=""
                          fi
                      
                          if [[ "$eth_dongle_ip" != "$ETHERNET_IP" && -e "/sys/class/net/$eth_dongle_interface" ]]; then
                              echo "Setting IP address to: $ETHERNET_IP"
                              ip addr flush dev $eth_dongle_interface
                              sleep 1
                              ip link set dev $eth_dongle_interface up
                              sleep 1
                              ip addr add $ETHERNET_IP/24 broadcast $BROADCAST_IP dev $eth_dongle_interface
                          fi
                          sleep 1
                      done
                      
                      1. make service file executeable, run:
                        sudo chmod +x /usr/local/bin/set-eth-dongle-ip.sh
                      2. create systemd service file, run:
                        vi etc/systemd/system/set-eth-dongle-ip.service
                      3. Add the following to the file created above:
                      [Unit]
                      Description=Set Ethernet Dongle IP Address
                      After=network.target
                      
                      [Service]
                      ExecStart=/usr/local/bin/set-eth-dongle-ip.sh
                      Restart=always
                      User=root
                      
                      [Install]
                      WantedBy=multi-user.target
                      
                      1. Run:
                      #reload the systemd daemon to recognize the new service 
                      sudo systemctl daemon-reload
                      
                      # enable the service so that it runs on boot
                      sudo systemctl enable set-eth-dongle-ip.service
                      
                      # start service immediately
                      sudo systemctl start set-eth-dongle-ip.service
                      
                      # verify service has started properly
                      sudo systemctl status set-eth-dongle-ip.service
                      
                      1. Wait 2 minutes and run:
                      ifconfig
                      

                      Actual Result:
                      -IP address changes back to 169.254.4.1.
                      -Device no longer available via ssh on eth0 at 169.254.4.1.

                      Expected Result:
                      IP should not change from 192.169.144.15 after being set.

                      Thank you,

                      Aaron

                      blueB 1 Reply Last reply Reply Quote 0
                      • blueB
                        blue @blue
                        last edited by

                        After having some issues with a static IP on the VOXL2 Mini above it ended up being an issue with being on the wrong subnet for the host computer to communicate.

                        We ended up fixing the issue by changing the subnet for the host computer once we changed the IP on the VOXL2 Mini.

                        e.g VOXL2 Mini IP of 192.168.144.15 will require a host computer on the same subnet e.g. 192.168.144.98.

                        Thank you,

                        Aaron

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB | Contributors