bhavasam wrote:
Thank you, but it seems like I didn't explain myself properly.
I connect to different Wifi networks. For some of them, I need to have a fixed IP, because I use my machine as a server. So, for my home network, I need to be 192.168.0.10, but when I go outside and connect to a restaurant Wifi, I can't use that same IP, so I need to let the DHCP server assign me an IP automatically. The problem is, I haven't been able to find how to set up different configuration profiles for different networks. There seems to be only one window for your Network Settings, shared across all the networks, which you can imagine is a bit of a pain in the *** because every time I hop networks I have to configure the IPs again, and sometimes it might take 20 or 30 minutes of troubleshooting why my networks doesn't have Internet Access until I remember that I have assigned a fixed IP.
How can I do this in MacOS? I want some networks to give me a fixed IP, and others to just assign based on available IPs by the DHCP server
Your current approach seeks to have the network world bend to your will, and that seldom works out.
The IPv4 network design you envision is not going to be portable across networks not cooperating for the management of your IPv4 (or various IPv6) client. You may well disrupt local networking activity with errant IP address assignments or ARP shenanigans, too. Whether that is attempting 0.0.0.0 as you seem to have tried, or some other multicast address, or conflicting with the IP of some locally-important network gear or server.
For networks that are cooperating, the DHCP server can be configured to vend a specific and consistent network-locally-appropriate IP address. You can’t control this assignment from the client, but the DHCP server administrator can control it from the DHCP server.
You might conceivably be able to use a global-scope IPv6 address here, but I’d wager more than a few small networks don’t play well with routing globally-scoped IPv6. And whether your apparently-wants-fixed-IPv4 local apps and services know from IPv6?
There are quite possibly other impediments awaiting for your portable-server design too, including the need for proper reverse DNS for some authenticated network services. Some DNS and DHCP servers can cooperate to provide this, though most small networks are not running authoritative DNS services.
Pragmatically, you’re going to need to fix whatever of your local services expect fixed IP addressing, migrating to using some other means of locating and connecting. That might be switching to a 127/8 address, or maybe running some entirely-local authoritative DNS server, or otherwise. Probably the easiest is to stuff all your client and server giblets into a VM guest, and NAT it all within your own little private fixed-address network universe. This if you want a “roaming” server.
And some questions:
Details of whatever local network services are getting tangled would be interesting.
Which particular network services?
Can DDNS (potentially) work?
PS: you’re definitely not going to get the same IPv4 subnet address assignment across disparate networks; a “globally fixed private IPv4 address’, as it may.