Will there be problems if I assign my laptop a fixed IP address?

2

My laptop is virtually always behind some local network so it almost always has an IP address of 192.168.x.x.

I often want to SSH into the laptop. Right now, whenever it turns off it gets assigned a new IP address and I have to go over to it, get its IP address, walk back to my desktop, and then SSH in.

Is there any big harm in just assigning it an IP address like 192.168.1.337 and dealing with collisions if they ever arise, rather than dealing with having to check for a new IP every few weeks?

Alternatively, is there some solution that sidesteps this problem?

JoshuaD

Posted 2020-01-02T01:43:57.283

Reputation: 733

1I would be impressed if you manage to assign an IP ending in 337 – Sirap – 2020-01-02T02:38:58.030

Answers

2

Allow your router to assign a pre-assigned DHCP IP address based on MAC address instead.

In general, manually assigning a static IP address in a DHCP setup is not a great idea. Even if you are 100% in control if your network, it’s still enough of an edge risk that it’s not worth dealing with.

Instead, allow your router to do the “heavy lifting” and assign the laptop a pre-assigned IP address.

Many routers allow you to assign an IP address based on MAC address. The naming of how to do this varies but it is generally something like “pre-assigned DHCP IP address” and such.

I would highly recommend doing this instead of going down the static IP address route.

Also past this, I SSH remotely to my MacBook Air for other devices all the time, but I never use IP addresses; I use the machines hostname on the LAN and it all works fine. The name is always something like MacBookAir.local. Unclear what OS you are on but if you can use a local LAN hostname or similar — something that is broadcast on the LAN — that might be better long term solution.

JakeGould

Posted 2020-01-02T01:43:57.283

Reputation: 38 217

1

Limit the range of IP addresses that your router uses for DHCP

Most routers allow you to define the DHCP address range. If your LAN is 192.168.0.1 subnet mask 255.255.255.0, you can change the range that DHCP uses from 192.168.0.50 to 192.168.0.254 for instance. That way you can use 192.168.0.2 to 192.168.0.49 for static IP assignment.

With this method you don't have to mess with MAC address, and you can change the static IP simply by changing it in your laptop. Of course you're the one responsible to maintain static IP assignments so no two devices use the same one.

Paul S. Lee

Posted 2020-01-02T01:43:57.283

Reputation: 113