Beginner's Guide: How to Set a Static IP on Home Networks

Have you ever wanted to assign a static IP to a device in your home?

When building a server yourself or using smart home devices, it’s common to face “The IP address changed again…” at random timings. In most cases, home routers automatically assign IP addresses via DHCP function, so while it’s convenient that you can join the network just by connecting devices, the address changing when the lease expires is a headache.

This leads to cumulative “quiet inconveniences,” like unable to access the application you built or making SSH operations difficult…

So this time, I summarized methods to set a static IP within a local network, partly as my own memorandum. I introduce both patterns: fixing on the Router side and setting on the Device side, so if you are thinking “I want to fix my IP and operate my server comfortably…!”, please refer to this.

Note: This article is about fixing IP within LAN. If you want to connect from WAN side, consider DDNS or your Provider’s Static IP Option.

Method to Fix on DHCP Side

First is the method to fix on the Router Side. Here I introduce the method for RTX830 which I use at home. Routers capable of command operations should offer similar commands, so look for them.

Also, even routers that cannot use commands, for example NEC’s Aterm, might have a setting item called DHCP Fixed Assignment Setting. Look for it. If it doesn’t exist in setting items, fixing via DHCP is difficult, so I think it’s good to try fixing on the Device side.

From here I introduce the setting method for RTX830.

First use the following commands to dedicate the range 192.168.100.2-192.168.100.51/24 for static IPs.

Terminal window
dhcp scope lease type 1 bind-only
dhcp scope 1 192.168.100.2-192.168.100.51/24
dhcp scope 2 192.168.100.102-192.168.100.151/24

Ref: https://www.rtpro.yamaha.co.jp/RT/manual/rt-common/dhcp/dhcp_scope_lease_type.html

Ref: https://www.rtpro.yamaha.co.jp/RT/manual/rt-common/dhcp/dhcp_scope.html

Next, confirm the MAC address or Client ID of the server PC. In my case, I checked the target host’s Client ID with the show dhcp status command. Once confirmed, register the server PC as a target for static IP allocation to DHCP. Routers where clientId is disabled might require slightly different commands.

Terminal window
dhcp scope bind 1 192.168.100.2 ff aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa

Ref: https://www.rtpro.yamaha.co.jp/RT/manual/rt-common/dhcp/dhcp_scope_bind.html

Method to Fix on Device Side

Next is the method to fix IP address via settings on the Device side.

For Ubuntu Server, you can set it just with NetPlan settings. Distributions without NetPlan can install it later.

First create /etc/netplan/99-static-address.yaml (Filename is arbitrary except for numbers and extension). You might need admin privileges, so if scolded, add sudo to the command or execute as root user.

Here, set values as follows. Others can be fixed.

  • eth0
    • Network interface name
    • Checkable with commands like ifconfig
  • dhcp4, dhcp6
    • Disable as we don’t want allocation
  • addresses
    • Address requested by device
    • Set within Router’s subnet
  • routes.via
    • Router address
  • nameservers
    • DNS server address
    • Basically Router address should be fine
    • Can explicitly specify 8.8.8.8, 8.8.4.4 etc.
network:
version: 2
renderer: networkd
ethernets:
dhcp4: false
eth0:
addresses: [192.168.100.102/24]
routes:
- to: default
via: 192.168.100.1
nameservers:
addresses: [192.168.100.1]

Once configured, apply the settings. If permission issues occur, fix access rights of the target file with chmod.

Terminal window
sudo netplan apply

If correctly set and the specified address isn’t leased to other devices, it should be allocated as specified. If not, try restarting Device, Router etc.

This concludes setting on Linux. I omit fixing on Windows or smartphone as I haven’t tried at hand, but I’ll leave documents I found quickly.

Windows 11: https://www.aterm.jp/support/qa/qa_external/00244/win11.html

Mac: https://www.aterm.jp/support/qa/qa_external/00244/mac.html

iOS: https://www.aterm.jp/support/qa/qa_external/00244/ios.html

Android: https://aterm.jp/support/qa/qa_external/00244/android.html

Conclusion

Just properly setting a Static IP eliminates the need to verify IP address every time accessing the server, making operations significantly easier.

For those playing around standing up servers often, the small stress of “Oh, IP changed again…” accumulates quietly. Just eliminating that feels good.

Of course, depending on home routers or devices, settings might feel a bit tedious. But becoming able to control the network yourself brings a bit of accomplishment, and leads to confidence like “I protect my own network!”

So, I’d be happy if this article becomes a trigger for someone to think “Maybe I should try Static IP too.”