• {X-HTML Replaced}

How to Set Up a Static IP Address

DHCP is fine, unless you're looking to perform advanced networking tasks. Here's how to set a Static IP address (or DHCP reservation) for any device on your network.

Whitson Gordon

An IP address is a unique identifier for a specific device on your network. Your router assigns them to these devices using  Dynamic Host Configuration Protocol (DHCP). As you connect new devices to the network, they will be assigned the next IP address in the pool, and if a device hasn't connected in a few days, its IP address will "expire" so it can be assigned to something else.

For everyday use, this is perfectly fine, and you will never even notice it happening in the background. But if you regularly  SSH into your Raspberry Pi , turn your computer on from across the house with Wake-on-LAN , or perform other advanced networking tasks, DHCP can become an annoyance.

It's hard to remember which IP address is assigned to which device, and if they ever expire, you have to look it up all over again. This is where a static IP address comes in handy. Here's how to set them up.

What is a Static IP Address?

Instead of letting your router assign whatever IP address is free at any given time, you can assign specific IP addresses to the devices you access frequently. For example, I have my home server set to, my main desktop to, and so on—easy to remember, sequential, and unchanging.

You can assign these static IP addresses on the device itself—using, say, Windows' network settings on each computer—or you can do it at the router level. If you do it through the router, it will likely be called a DHCP reservation, though many people (and even some  routers ) still refer to it as a "static IP address."

DHCP reservations allow you to easily set everything up in one place with all your computers left at their default settings. Your computer will ask for an IP address via DHCP, and your router will assign it the one you reserved, with your computer being none the wiser.

How to Set Up a DHCP Reservation

To set up a DHCP reservation, you need to know your IP address , which is easy enough to find out. You must then head to your router's configuration page —usually by typing its IP address in your browser's navigation bar—and log in. (For  mesh Wi-Fi systems , you would use an app instead of a config page.)

The location is different for every config page, but you're looking for something called "DHCP reservations," "static IP addresses," or similar. On my Asus router, for instance, it's in the LAN settings category.

To assign a reservation, you need the  MAC address  of the device in question. This is a unique string of characters that identifies a particular network adapter, and you can usually find it in your router's list of connected devices . Make sure you're getting the MAC address for the correct network adapter—if you have both Ethernet and Wi-Fi on your computer, you have one MAC address for each.

On your router's config page, enter an easy-to-remember label for the device (like "Whitson's Desktop PC"), the MAC address, and your desired IP address. Save your changes, and repeat the process for any other IP addresses you want to reserve.

From then on, those devices should have your reserved IP addresses assigned to them, and you will never have to look them up again.

Like What You're Reading?

Sign up for Tips & Tricks newsletter for expert advice to get the most out of your technology.

This newsletter may contain advertising, deals, or affiliate links. Subscribing to a newsletter indicates your consent to our Terms of Use and Privacy Policy . You may unsubscribe from the newsletters at any time.

Your subscription has been confirmed. Keep an eye on your inbox!

Dig Deeper With Related Stories

Pcmag stories you’ll like, about whitson gordon, contributing writer.

Whitson Gordon

Whitson Gordon is a writer, gamer, and tech nerd who has been building PCs for 10 years. He eats potato chips with chopsticks so he doesn't get grease on his mechanical keyboard.

Read Whitson's full bio

Read the latest from Whitson Gordon

Complete Guides by How-To Geek

Our latest product roundups, reader favorites, more from how-to geek, latest geek news, latest reviews, across lifesavvy media.

Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.

By submitting your email, you agree to the Terms of Use and Privacy Policy .

How to Set Up Static DHCP So Your Computer’s IP Address Doesn’t Change


assign static ip in dhcp

DHCP makes it simple to configure network access for your home network, and port forwarding makes it easy to those computers from anywhere. By configuring static DHCP on your router, you can combine the best of both worlds.

The Problem with DHCP and Port Forwarding

DHCP is great. You configure your router to automatically assign IP addresses and the computers on your network just plain work. Port forwarding is useful because you can access your router from outside of your network and be redirected to the computer you need inside of your network. The problem is that these two wonderful things rely on one premise: your internal IP addresses don’t change. If your router changes the IP that is assigned to a machine by DHCP, then you have to reconfigure Port Forwarding. Many programs try to get around this fact by offering Universal Plug and Play (UPnP) port forwarding features, but not everything does.

Newer routers often have the ability to remember which IP address was assigned to which computer, so if they disconnect and reconnect their IP doesn’t change. Often, though, a router reset will wipe this cache and start assigning IPs on a first-come, first-served basis. Tons of older routers don’t even have this ability, and immediately assign new IP addresses. With IP addresses changing, you have to reconfigure your port forwarding settings often, otherwise you may lose the ability to connect to your home computers.

You can do this on plenty of modern routers, but we’re going to use DD-WRT for this guide. We’ve touted DD-WRT’s ability many times before, and it’s not for nothing. This amazing custom router firmware has a solution to this mess: static DHCP, also known as DHCP reservation. While configuring your router for DHCP, you have the ability to enter the MAC addresses of your computers’ network cards and enter which IP address to assign them. DD-WRT will automatically take care of the rest! If you have a different router, you can try following along using your router’s own admin page–the instructions should be somewhat similar.

Finding Your MAC Address

The only real work you’ll have to do is find the MAC address of each computer’s attached networking card. If you’re using wireless then you should find the MAC of your wireless card, and if you’re wired then use the Ethernet card.

Just go down to the icon in your system tray for your connection and click it. Mine is wireless.

Right-click on your current active connection and click on Status.

Click on the “Details…” button.

Your MAC address for this device is listed as “Physical Address.”

OS X users can check under their System Settings and click on Network. If you click on the various tabs for your connection, you should find a “Physical ID,” “Ethernet ID,” or “MAC Address.” Ubuntu users can type “ifconfig” in Terminal. You’ll see various network adapters, each displaying its own hardware address. Do this for all of the computers in your network that you need port forwarding for. The others will just get their IPs assigned automatically by DHCP.

DD-WRT and Static DHCP

Now that you have a list of MAC addresses for each of your computers, open up a browser tab and head over to your router’s DD-WRT interface. Click on Setup, and under Basic Setup, make sure DHCP is turned on.

Scroll down to “Network Address Server Settings (DHCP)” and make a note of the starting IP address and the maximum number of users. The addresses you configure should fall within this range. Here, my range of IPs would be –

Now, click on the Services tab up top.

Under the DHCP Server section, you can see that there’s a list of “Static Leases” click on the Add button to add a new one.

Enter the MAC address of each computer, give each one a name so you know which is which, and then assign them an IP address. You won’t be able to add the same IP address to two different MAC address, so make sure each MAC has a unique IP. If your version of DD-WRT also has a space to enter the “Client Lease Time,” a safe setting would 24 hours, or 1440 minutes.

That’s it! Be sure to click on both the Save button and the Apply Settings button, and wait for the changes to take effect. The settings should automatically change when each computer’s lease expires, though you can reconnect from each computer if you want the changes to take effect immediately.

Now, whether your computer loses its connect, the router gets power cycled, or the DHCP lease expires, each computer you entered into the list will stick to its assigned IP. Furthermore, you won’t have to manually configure static IPs on each machine! Port forwarding won’t have to be a pain ever again.

Does your router support DHCP reservations? Do you have a more clever use for this system? Share your thoughts in the comments!

assign static ip in dhcp

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Assigning a fixed IP address to a machine in a DHCP network

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 .

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.

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

Things that I don't understand:

On any Windows computer connected in DCHP, ipconfig /all shows something like:

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 which appeared for some business communications service, but I had no credentials to access it.

Alexis Wilke's user avatar

7 Answers 7

Determine the IP address that is assigned to your server and then go onto the DHCP and set a DHCP reservation for that server.

JohnA's user avatar

DHCP services differ across many possible implementations, and there are no ranges of IP that are traditionally reserved for static addresses; it depends what is configured in your environment. I'll assume we're looking at a typical home / SOHO setup since you mention your router is providing the DHCP service.

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?

I would say that is not best practice. Many consumer routers will not have the ability to exclude a single address from within the DHCP range of addresses for lease (known as a 'pool'). In addition, because DHCP is not aware that you have "fixed" the IP address at the server you run the risk of a conflict. You would normally either:

To expand on these options:

Reservation in DHCP

If your router allows reservations, then the first, DHCP reservation option effectively achieves what you have planned. Note the significant difference: address assignment is still managed by the DHCP service, not "fixed" on the server. The server still requests a DHCP address, it just gets the same one every time.

Static IP address

If you prefer to set a static address, you should check your router's (default) configuration to determine the block of addresses used for DHCP leases. You will normally be able to see the configuration as a first address and last address, or first address and a maximum number of clients. Once you know this, you can pick a static address for your server.

An example would be: the router is set to allow a maximum of 128 DHCP clients with a first DHCP IP address of Therefore a device could be assigned any address from up to and including Your router will use a static address outside this range (generally the first or last address .1 or .254) and you can now pick any other available address for your server.

It depends on the configuration of your DHCP service. Check the settings available to you for DHCP then either reserve an address in DHCP or pick a static address that is not used by DHCP - don't cross the streams.

Liam's user avatar

It's not a bad habit to divide your subnet to DHCP pool range and static ranges, but of course you can do what JohnA wrote - use reservation for your server, but first case is IMHO clearer, because you are not messing up your DHCP server with unused extra settings (it could be confusing then for another admins who are not aware of that the server is static). if using DHCP pool + static pool, then just don't forget to add your static server to DNS (create A/AAAA record for it).

Journeyman Geek's user avatar

I prefer to set my network devices, servers, printers, etc. that require a static IP address out of range of the DHCP pool. For example, xx.xx.xx.0 to xx.xx.xx.99 would be set aside for fixed IP assignments and xx.xx.xx.100 to xx.xx.xx.250 would be set as the DHCP pool.

user1780242's user avatar

In addition to the other answers I want to concentrate on the fact that your router configuration does not seem to fit the IP address configuration on your server.

Please have a look on the output of ipconfig /all:

IPv4 Address ........ 192.168.1.xx(prefered)

Default Gateway ........ (= IP of the router)

DHCP server ............

The clients in the network don't get the IP address from the router, but a different DHCP server in the network ( instead of You have to find this server and check it's configuration instead of the router's DHCP server config, which is seemingly only used for Wireless.

Qippix's user avatar

My router ( OpenWRT ) allows for static DHCP leases.

Static leases are used to assign fixed IP addresses and symbolic hostnames to DHCP clients.

So, you supply the MAC address of the server and it's desired IP address as a "static lease", and DHCP will always allocate the same IP. The client machine (the server in this case) requires no configuration changes and still picks up its IP address (the configured address) from DHCP.

spender's user avatar

Note that you can't assign a fixed IP addresses in 192.168 so that clients can "always access it" unless you also give each client a fixed IP address and subnet. Because if the clients use DHCP, then they get whatever subnect the DHCP server gives them, and if they use automatic addressing, then they won't be in a 192.168 subnet.

Once you realise that the system can't be easily perfected, you can see that your best options depend on what you are trying to do. Upnp is a common way of making devices visible. DNS is a common way of making devices visible. WINS is a common way of making devices visible. DHCP is a common way of making devices visible.

All of my printers have reservations: my printers aren't critical infrastructure, I want to be able to manage them, many of the clients use UPNP or mDNS for discovery anyway.

My gateway and DNS servers have fixed IP address in a reserved range: My DHCP server provides gateway and DNS addresses, and my DHCP server does not have the capacity to do dynamic discovery or DNS lookup.

None of my streaming devices have fixed or reserved IP values at all: if the network is so broken that DHCP and DNS aren't working, there is no way that the clients will be able to connect to fixed IP addresses anyway.

user165568's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged dhcp ip-address or ask your own question .

Hot Network Questions

assign static ip in dhcp

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Static and dynamic IP address configurations for DHCP

%t min read | by Damon Garn

Static and dynamic IP configurations for DHCP

IP address configuration is one of the most critical, if simple, settings on your network devices. Workstations, servers, routers, and other components must have properly assigned IP address settings to participate on the network.

This two-part article series covers static and dynamic IP address settings and the configuration of a DHCP server. This article (part one) defines network identities, contrasts static and dynamic configurations, and covers the commands needed to manage the settings. Part two covers the deployment of a DHCP server, DHCP scope configuration, and client-side management of dynamic IP addresses.

[ You might also enjoy:  The name game: Naming network interfaces in Linux ]

Three identities

Network nodes have three identities: Hostname, logical address, and physical address. These three addresses provide different types of connectivity and are used in various ways during network communication.

The three identities are:

Hostnames are configured when the OS is installed, and MAC addresses are hard-coded on NICs. Sysadmins typically configure IP address information on servers, workstations, portable systems, and network devices.

I’ll cover the two primary ways that IP address information is provided to the nodes: Static and dynamic configurations.

Static and dynamic configurations:

The standard settings are IP addresses, subnet masks, default gateways, and nameservers.

Static configuration

NetworkManager primarily handles network configuration. NetworkManager can be used in a GUI, TUI, or CLI environment.

The nmcli process to set a static IP configuration is to create a connection profile and then set the values desired. Red Hat has documentation here .

Here is an example of creating a network connection named home-network with an IP address of, a default gateway of, and a name server of

The GUI configuration can be accomplished by selecting the Manual button and then filling in the blanks with the appropriate information.

GUI Network Manager screen with static IP info

Recall that you can make no typographical errors when configuring IP addresses, and duplicate addresses will cause network connection problems.

Why static configurations?

Static IP addresses do not change unless the administrator actively reconfigures them. This is an important fact when it comes to servers because most client computers need to be able to find servers consistently.

For example, an NFS file server hosting department directories needs to keep the same IP address over time as configuration files such as a client computer’s /etc/fstab file may use the IP address for connectivity.

Other network nodes also may need an unchanging network identity. Appliance devices such as firewalls or proxies, print servers, name resolution servers, web servers, and virtually all other infrastructure devices need a consistent identity. Sysadmins will almost always configure these systems with static IP address information.

Tracking IPs

It is essential to track your statically assigned IP addresses. Depending on the size of your environment, this might be so simple as a text document or a spreadsheet, all the way up to specialized software that integrates with directory services and DHCP. I find it’s best to at least track IP address (and subnet mask), MAC address (not essential), hostname, role on the network (justifies why the devices have a static IP), and any additional notes.

spreadsheet tracking IP addresses, MAC addresses, hostnames, etc

Dynamic configurations

The devices that require a static IP configuration are a relatively small percentage of your network. Most network devices are end-user systems such as workstations, laptops, phones, tablets, and other transient devices. In addition, these systems do not usually host network services that need to be discoverable by other computers.

IP address configurations are unforgiving when it comes to duplicates and typos. In addition, static IP address settings are fairly time-consuming. Finally, IP address settings tend to be temporary, especially with the advent of portable devices like laptops, phones, and tablets. To save time and reduce the chances of a mistake, dynamic IP address allocation is preferable for these kinds of nodes.

Linux systems are configured as DHCP clients by using NetworkManager.

Here is an example of adding a network connection profile configured to lease an IP address from DHCP:

By not specifying an address NetworkManager assumes the DHCP client role.

Here is a screenshot of a dynamic IP address configuration from the GUI:

Network Manager GUI and static IP configuration

The dhclient command

The dhclient command is also used to manage dynamic IP address configurations. However, in RHEL 8, network configurations, including DHCP, are handled by NetworkManager. Older RHEL versions rely on dhclient , as do some other distributions.

The ip route command displays lease information.

The second article in this series goes over the dhclient command in more detail.

[ Free cheat sheet: Get a list of Linux utilities and commands for managing servers and networks . ]  

IP address settings are crucial to network communications. Values such as the IP address, subnet mask, default gateway, and nameservers can be manually managed, but sysadmins must be very careful not to make any mistakes. Static settings don’t change unless the administrator reconfigures them, so they are essential for servers whose services are made available across the network.

Dynamic IP configurations are far more convenient for systems that don’t host network services, such as end-user devices. Furthermore, many of these devices enter and leave the network regularly, and it would be very time-consuming to set IP values each time manually. Instead, a DHCP server is used to host a pool of available addresses that client systems can lease.

Understanding the difference between static and dynamic IP addresses is straightforward but essential for administrators. As a general rule, servers and network devices utilize static, unchanging IPs, while client devices rely on dynamically allocated IP configurations.

Check out these related articles on Enable Sysadmin

Leasing IP addresses

Damon Garn owns Cogspinner Coaction, LLC, a technical writing, editing, and IT project company based in Colorado Springs, CO. Damon authored many CompTIA Official Instructor and Student Guides (Linux+, Cloud+, Cloud Essentials+, Server+) and developed a broad library of interactive, scored labs. He regularly contributes to Enable Sysadmin, SearchNetworking, and CompTIA article repositories. Damon has 20 years of experience as a technical trainer covering Linux, Windows Server, and security content. He is a former sysadmin for US Figure Skating. He lives in Colorado Springs with his family and is a writer, musician, and amateur genealogist. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the red hat developer program., related content.

How to enter the world of Linux containers


Privacy Statement


  1. What is DHCP? It assigns addresses dynamically

    assign static ip in dhcp

  2. ASUS : Assign static IP address via DHCP

    assign static ip in dhcp

  3. Assign Static IP to a PC through DHCP: ZTE F660

    assign static ip in dhcp

  4. How to set router to assign static IP address automatically to Windows 10 • Pureinfotech

    assign static ip in dhcp

  5. Assign static IP address via DHCP on the TP-Link > BENISNOUS

    assign static ip in dhcp

  6. Assign Static IP Address to mobile

    assign static ip in dhcp


  1. How Client can request IP from DHCP server

  2. Setting client up to get IP address from DHCP server

  3. DHCP Server

  4. Giving IP automatic DHCP

  5. 006 Router as DHCP server

  6. How to Configure Static IP in server 2019


  1. How to Set Up a Static IP Address

    To set up a DHCP reservation, you need to know your IP address, which is easy enough to find out. You must then head to your router's configuration page —usually by typing its IP address in...

  2. How to Set Up Static DHCP So Your Computer’s IP Address Doesn

    Click on Setup, and under Basic Setup, make sure DHCP is turned on. Scroll down to “Network Address Server Settings (DHCP)” and make a note of the starting IP address and the maximum number of users. The addresses you configure should fall within this range. Here, my range of IPs would be –

  3. Assigning a fixed IP address to a machine in a DHCP network

    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. ).