Dynamic or static IP in terminal!
Hi!
What terminal command I need to use to find out what kind of IP I have dynamic or static!
I have to do it exactly in terminal because I'm conencting to other mac's over ssh!
Thanks!
Hi!
What terminal command I need to use to find out what kind of IP I have dynamic or static!
I have to do it exactly in terminal because I'm conencting to other mac's over ssh!
Thanks!
What kind of service do you have? If residential, the IP's are usually dynamic (they change).
There is no Terminal command to find out what kind of service you are paying for - check the contract from your Internet Service Provider.
system_profiler SPNetworkLocationDataType
Then parse the output looking for "Active Location: Yes". Once you have found that, then look for "IPv4:" and if the next line says "Configuration Method: DHCP", then you are dynamic IP address. If it says Manual, then you have a fixed IP address.
I was guessing the OP was talking about their WAN address - wouldn't you always get 'DHCP' if you are behind a router using its DHCP server?
If your router is configured to get an external IP address from DHCP, then the address is dynamic (although it may change rarely, if ever.) If the router has a manually-assigned IP address, it's static.
Agreed - there's a lot of chance of confusion here, especially if you're on a NAT network.
It's possible for your NAT router to have a dynamic IP address from your ISP, while your system has a static IP address on your LAN.
It's also possible for your NAT router to have a dynamic IP address from your ISP, while your system also has a (different) static IP address on your LAN.
Similarly, it's also possible for your NAT router to have a static IP address while your system has a dynamic IP address on your LAN.
Just like it's possible for your NAT router to have a static IP address while your system also has a static IP address on your LAN.
So, as you can see, multiple configurations are possible. What's not possible is determining which case you're referring to in your post. There isn't enough data.
What are you looking to achieve?
Thanks this was exactly what I was looking for!
I was guessing the OP was talking about their WAN address - wouldn't you always get 'DHCP' if you are behind a router using its DHCP server?
Yes, and similarly, you'd always get 'Manual' if your machine is manually configured, even if your router is getting a dynamic address from your ISP (and therefore you have a dynamic public address). Therefore, knowing the machine's configuration is only relevant for the LAN, and it's impossible to say whether that solves the OP's quest without knowing more.
Dynamic or static IP in terminal!