I want to assign a fixed private IP address to a server so that local computers can always access it.
Currently, the DHCP address of the server is something like 192.168.1.66
.
Should I simply assign the server this same IP as fixed and configure the router so that it will exclude this IP from the ones available for DHCP?
Or are there some ranges of IP that are traditionally reserved for static addresses?
My beginner's question doesn't relate to commands but to general principles and good practices.
Practical case (Edit 1 of 2)
Thank you for the many good answers, especially the very detailed one from Liam.
I could access the router's configuration.
Router's overview panel:
========================
Connectivity type is set to DHCP and PPoE.
(...)
Network panel
=============
IPv4 address distribution (DHCP)
--------------------------------
Enable DHCP on LAN : Off
DHCP range starts at IP address : 192.168.1.33
DHCP range ends at IP address : 192.168.1.35
(...)
Nota bene: There is also an IPv6 section.
When booting any computer, it obtains its IPv4 address in DHCP.
The IP and the MAC addresses that I can see with the ipconfig all
command in Windows match those in the list of connected devices that the router displays, so that I can confirm who is who.
The list of connected devices is something like
Description IP address MAC address
«Unknown» 192.168.1.xx (static) 01:02:03:04:05:06
«Unknown» 192.168.1.yy (static) 07:08:09:10:11:12
Things that I don't understand:
- Although all IP addresses are all obtained in DCHP, they are displayed as by the router as if they are static addresses.
- The router's setting "Enable DHCP on LAN" is set on "Off" but the IP addresses are obtained in DHCP.
- IP addresses attributed to the computers are outside of the very narrow
DHCP range of
192.168.1.33
to192.68.1.35
On any Windows computer connected in DCHP, ipconfig /all
shows something like:
IPv4 Address ........ 192.168.1.xx (preferred)
Default Gateway ........ 192.168.1.1 (= IP of the router)
DHCP server ............ 192.168.1.5
I'm missing something, but what?
Practical case (Edit 2 of 2)
Solution found.
For details, see my answer to Michal's comment at the bottom of this message.
I must admit that the way the router display things keeps some parts a mystery.
The router seems to be using DHCP by default, but remembers the devices that were connected to it (probably using their mac address). It could be the reason why it lists the IPs as static although they're dynamic. There was also Cisco router at 192.168.1.4
which appeared for some business communications service, but I had no credentials to access it.
192.168.0.50
to192.168.1.70
) 3. Start the server in DHCP. In the router panel, name it, basing on its mac address so that the router will remember it. 4. In the server switch IP from DHCP mode to manual and assign an IP that is beyond the ones that the router would assign to other devices (eg.192.168.1.100
). You can use nmtui and then edit the config file where you can replacePREFIX=32
byNETMASK=255.255.255.0
. 6. Restart the network service.