Configure static IP settings on your Ubuntu server.
Configure static IP settings on your Ubuntu server.
I set up the old PC with Ubuntu Server and now need a fixed IP address for consistent network access. I’m unsure whether to configure it through the router or directly on the machine. Currently, I have an SSH connection using the DHCP address from the router, but that IP changes when the device reboots. I’m looking for a method to ensure it always connects reliably, whether I’m using SSH or other local services like a torrent server.
Usually updating the IP address happens through the server itself, not via a remote link. If the server offers a command line for adjusting base settings, you'll probably use that method. DHCP doesn't always reassign an IP each time the server restarts. On my FreeNAS setup, I use DHCP with the address 192.168.1.224 and left it static because it hasn't changed during shutdowns or reboots. If your network is busy with many devices coming and going, DHCP addresses shouldn't need frequent changes. Still, it's wise to reserve a range of IPs by configuring the router's DHCP pool between 192.168.1.21 and 192.168.1.220. This way, you can assign 192.168.1.2 to 192.168.1.20 and keep 192.168.1.21–192.168.1.254 as a static block. Just remember to leave 192.168.1.254 open—it's often the default for new devices.
As @manikyath mentioned, your router should offer an option to assign an IP address based on your server's MAC address. Check the router's administration panel for a menu item related to this feature. If not available, you can set a static IP with the same subnet as your router's network. But using DHCP might lead to address conflicts, so this setup isn't always ideal.
For Ubuntu servers, checking Google often yields quicker solutions compared to searching the Debian wiki. Use ifconfig to find your NIC details, then edit /etc/network/interfaces to assign a fixed IP address. Refer to the Debian wiki article on configuring interfaces manually for guidance.
Some may send messages beyond the allowed area even if settings prevent it. Still, from a system perspective, it's more effective to allow the DCHP to manage this if it already operates on the same network.
If DHCP is set to provide only a certain range and it returns IP addresses beyond that, discard your router.
Why not use something thoughtfully designed instead of throwing away potential hardware? That’s why there are open-source Linux or BSD firmwares available.