No internet connection
  1. Home
  2. Technical Support

Setting static IP address

By @Lb1
    2021-04-21 13:13:24.287Z

    Hello, we have an environment where all of the IP addresses on our networks have to be static. I'm readying two Tiny Pilots to send to a remote location, and they need to have the IPs set for the network where they will live (no DNS). Everything is set up, except for setting the IPs for the destination network, and disabling writing to the MicroSD cards. The problem is that after I set the IP, I won't be able to test it again on the network here, and I won't have access to it in the remote location. I'm not that familiar with Linux, so is there someone who can help me set the IP addresses, and any other network information (default gateways, subnet masks, etc.) that has to be correct on the first try, when they boot it up there? Also, once I set the static IP here, can I still SSH in using the host name, and a wireless router with a different IP network than the static IP for the Tiny Pilot, to disable writing to the MicroSD card?
    Thanks for your help.

    Solved in post #2, click to view
    • 8 replies
    1. Michael Lynch @michael2021-04-21 21:43:48.032Z2022-04-29 19:30:48.014Z

      Update (2022-04-29)

      There's now an easier way to set a static IP address.


      Interesting scenario!

      To set up a static IP, you can open /etc/dhcpcd.conf and add lines to specify the network configuration.

      In this example, the static IP I'm requesting is 10.0.0.222 and the router is at 10.0.0.1.

      interface eth0
      static ip_address=10.0.0.222
      static routers=10.0.0.1
      static domain_name_servers=10.0.0.1
      

      If you look in the examples of that file, you can see another option for a hybrid configuration where it tries DHCP first and falls back to a static IP if DHCP is unavailable. That might be useful for your scenario.

      Also, once I set the static IP here, can I still SSH in using the host name, and a wireless router with a different IP network than the static IP for the Tiny Pilot, to disable writing to the MicroSD card?

      No, if you're on a different network, you won't be able to access the device by hostname unless you configure the TinyPilot to join your VPN.

      Does the remote location have Internet access? If it does, I'd recommend setting up Tailscale on the TinyPilot and on your client machine. That way, you'll still be able to access the TinyPilot securely even when it's on a different network. If you want more control over the infrastructure, you could also use WireGuard, as Tailscale is just a friendly abstraction over WireGuard.

      You can also disable microSD writes before you ship. If you configure a static IP and then disable microSD writes, everything should still work when they boot it up at the remote location.

      I'd also recommend trying this process on a test network where you can still access the TinyPilot before you ship it off. You can set up a separate router that has the same IP subnet as the remote network you're shipping to, and that will provide an opportunity to verify that this will work how you expect.

      ReplySolution
      1. L@Lb1
          2021-06-22 12:25:20.398Z

          Update: I set up two Tiny Pilots as described above (wireless router set to target IP address), and tested both with a Win10 desktop computer, and a Dell PowerEdge R420. I used a powered VGA-HDMI adapter on the server, and a straight HDMI cable on the Win10 box. Both worked, and I could control everything. I shipped one of the units to the remote location, and I have not been able to get video from that server. It is also a Dell PowerEdge R420. I have tried both the front and rear VGA ports, but the USB power cable has only been tried on one USB port on the back of the server. I will try another port when someone is back on site, to make the change.

          Right now, I can SSH into the Tiny Pilot, but I can't log into the web interface. It looks like it's letting me log in, but it says disconnected at the bottom of the display, and I can't reboot it with the GUI interface. I rebooted it through the SSH interface, but it still shows Disconnected. Do you have any ideas, other that powering it off?

          1. Sorry about that! I think you're hitting this bug:

            That's fixed in the latest version. Can you try updating via System > Update?

        • J
          In reply toLb1:
          John Sikora @johnsikora
            2022-01-08 22:34:07.784Z

            For those of us who are Linux challenged, can you detail what is required to change the file. I'm getting a message about it not being write enabled. Sorry for my Linux ignorance.

            1. Sure, you need to open the file with root permissions, so if you're editing with the nano text editor, you'd open the file like this:

              sudo nano /etc/dhcpcd.conf
              

              When you've made the changes, hit Ctrl+O to save the file and then Ctrl+X to exit nano. You'll need to reboot with sudo reboot for the changes you've made to /etc/dhcpcd.conf to take effect.

            2. Y
              In reply toLb1:
              John Smith @yournottheonesir
                2023-09-14 15:23:04.291Z

                Can you explain the failover in more detail? Could you provide an example of what I should change or uncomment in this configuration file, please? Additionally, I looked at your guide on how to set a static IP. Could you also explain that command with an example? The guide mentions setting variables and then running a command. Am I misunderstanding it?

                1. David @david2023-09-14 18:14:19.449Z

                  Hi @yournottheonesir, thanks for your question!

                  Firstly, to use the commands from our FAQ, you will need to provide values for the variables relating to the static IP address configuration. For example, if I wanted to set my TinyPilot's static IP to 192.168.0.200, and my router's IP address was 192.168.0.1, I would replace the values in the variables with those addresses like this:

                  TINYPILOT_STATIC_IP="192.168.0.200/24" # Set to your desired IP address / netmask
                  ROUTERS="192.168.0.1"                  # Set to your router's IP address
                  # Choose your preferred DNS settings. The default DNS setting (below) queries
                  # your router's DNS, then Google (8.8.8.8), then Cloudflare (1.1.1.1).
                  DNS="${ROUTERS} 8.8.8.8 1.1.1.1"
                  

                  Once you have an SSH connection with your TinyPilot, you'd run the snippet to set the variables (copy the snippet then paste it in the SSH window and hit "Enter" to run it). After that, run the second snippet from the FAQ to actually set the static IP address on the TinyPilot.

                  As for the fallback behavior you're referencing from an earlier post, you will need to make some changes to /etc/dhcpcd.conf on your TinyPilot. I believe Michael was referencing these lines towards the end of the file:

                  # fallback to static profile on eth0
                  #interface eth0
                  #fallback static_eth0
                  

                  I believe that if you un-comment the interface eth0 and fallback static_eth0 lines, your TinyPilot should fallback to a static IP address if DHCP is unavailable.

                  I hope that helps! Please let me know if you have any other questions.

                  1. YJohn Smith @yournottheonesir
                      2023-09-15 13:57:17.663Z

                      Thanks so much for the clarification.