On my local network (at home), I have a Linux machine called A, connected to the Internet through a modem. I want to give A a static local IP address when it's at home, but a dynamically allocated one when it's not. How would I achieve this?
I think one way I could do this is to check my public IP address and see whether it is within my ISP's allocation range, but this seems unelegant and I don't know how to do it. I could also check if my modem exists between me and the Internet, but again, I do not know how.
I would appreciate any suggestions. Thanks for your attention!