0

I have a linux computer with a pre-configured static ip. When the pc is installed i need to access it via remote access teamviewer. Sometimes the static ip not working. Then i would like to switch to DHCP after an X time.

for example: PI connected to network, but static adress is wrong. So has to switch to DHCP after 1 minute. Then device is connected and i can use remote access.

added: the PI is sended to customer, where the static IP has to work. In a case the static ip not works (due to other subnet) failover to dhcp

WOuter
  • 11
  • 2
  • 1
    Where and how does a/the Raspberry Pi come into the equation? – Dirk Nov 14 '18 at 16:22
  • what do you mean? – WOuter Nov 14 '18 at 16:24
  • I don't see any reference to a Raspberry Pi computer, just general linux, PC, etc. Since this is the Pi section of SE we need to know how the Pi is part of it. If there's no Pi involved then you should ask your question in a different section, e.g. https://unix.stackexchange.com/ . See https://raspberrypi.stackexchange.com/help/on-topic, https://raspberrypi.stackexchange.com/tour for more information – Dirk Nov 14 '18 at 16:28
  • ah im sorry the linux computer is the rpi itself – WOuter Nov 14 '18 at 17:19
  • Then it's best to update your question. Also add the OS + version, how you set the static address, etc. BTW: is the 'pc' also the Pi, or is that a different computer (as you can see the links between the parts you describe are not completely clear) – Dirk Nov 14 '18 at 17:35

1 Answers1

3

This is impossible in principle! A static IP address cannot fail! It may be unroutable on some networks, but will still "WORK".

You can use a static IP address as fall back when DHCP lease fails.

There are methods of setting different addresses on different networks. See How to set up networking/WiFi

None of this changes the fact that static IP addresses are rarely necessary - there are better solutions which don't require you to know the IP address!

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • Dear, in this case, the device is setup with a static IP. and sended to the customer. sometimes the network at the customer is in an other subnet than the static ip. Then the dhcp should take over and we can login remotely and change the static ip – WOuter Nov 19 '18 at 15:24