Phedg1
Posts: 5
Joined: Mon Jun 24, 2019 6:48 am

How can I set a static ip without having a static router ip?

Mon Jun 24, 2019 7:03 am

When a Pi does not have a static ip address, when it connects to wifi, it will automatically determine the default gateway ip address. When you set a static ip address in dchpcd.conf, you also need to set a static default gateway for the profile. In the project I'm working the Pi's will have several known mobile hotspot SSID's and passwords. When it is in range of these networks it should automatically connect. I want the Pi to use whatever default gateway the hotspot has automatically, but have a consistent static ip regardless of which network it is connected to. Is this possible?

The goal is that I want to be able to ssh into a headless Pi, regardless of which network it happens to be connected to as long as I'm on the same network.

Phedg1
Posts: 5
Joined: Mon Jun 24, 2019 6:48 am

Re: How can I set a static ip without having a static router ip?

Mon Jun 24, 2019 7:20 am

Never mind. I found that I just set different hostnames on the Pi's and this will achieve the result I'm looking for.

User avatar
thagrol
Posts: 3078
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: How can I set a static ip without having a static router ip?

Mon Jun 24, 2019 1:04 pm

Well yeah. As a matter of course you should set unique hostnames for each pi on your network. You'll have difficulty accessing them by name if you don't.
Arguing with strangers on the internet since 1993.

Return to “Beginners”