The fastest way to change your IP address in Linux
The method depends on whether your system uses NetworkManager (most modern desktop Linux distributions) or direct configuration files (servers and minimal installs). On a desktop, you can change your IP through the graphical settings menu in under a minute. On a server or command-line system, you edit the network configuration file and restart the service. Both approaches accomplish the same thing: they tell your network interface to use a different IP address instead of the one it has now.
Before you change anything, know whether you want a static IP (one that stays the same after reboot) or a temporary change that reverts when you restart. Most people need static, especially on servers. Temporary changes are useful for testing.
Key Takeaways
- Desktop systems with NetworkManager can change IP through Settings > Network > Wired or WiFi, then toggle off DHCP and enter a new static address.
- Server systems typically require editing /etc/netplan/ configuration files on Ubuntu 18.04 and newer, or /etc/network/interfaces on older Debian-based systems.
- After editing configuration files, you must restart the network service with sudo systemctl restart networking or reboot the system.
- A temporary IP change using sudo ip addr add takes effect when ready but disappears after reboot unless you also update the configuration file.
- Always verify the change worked by running ip addr show or ifconfig to confirm your new IP is active.
Changing IP on a desktop with NetworkManager
If you use Ubuntu, Fedora, Linux Mint, or most other desktop distributions, you have NetworkManager running. Click the network icon in your system tray (top-right corner on most desktops). Select "Wired Settings" or "WiFi Settings" depending on your connection type.
Find the network you are connected to and click the gear icon or "Settings" button next to it. Look for the IPv4 section. By default it shows "Automatic (DHCP)" — click that dropdown and select "Manual". Enter your new IP address in the "Address" field, your subnet mask in the "Netmask" field (usually 255.255.255.0 for a home network), and your gateway IP in the "Gateway" field (usually your router's IP, often 192.168.1.1). Click "explore" and the change takes effect when ready.
To verify it worked, open a terminal and type ip addr show. You should see your new IP address listed under your network interface.
Changing IP on Ubuntu 18.04 and newer using Netplan
Ubuntu 18.04 and newer use Netplan instead of the older network configuration system. Open a terminal and navigate to the Netplan configuration directory: cd /etc/netplan/. List the files with ls — you will see a file named something like 01-netcfg.yaml or 00-installer-config.yaml.
Open the file with a text editor using sudo nano 01-netcfg.yaml (replace the filename with what you found). Look for the section under your network interface name (usually eth0 or enp0s3). If it shows dhcp4: true, change it to dhcp4: false and add your static IP details below it. The format should look like this:
network: version: 2 ethernets: eth0: dhcp4: false addresses: [192.168.1.50/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4]
Replace 192.168.1.50 with your desired IP, 192.168.1.1 with your gateway (usually your router), and the nameservers with your DNS servers (Google's are 8.8.8.8 and 8.8.4.4, or use your ISP's). Save the file (Ctrl+O, then Enter, then Ctrl+X in nano). explore the changes with sudo netplan explore. Verify with ip addr show.
Changing IP on older Debian and Ubuntu systems
If you are on Ubuntu 16.04 or earlier, or a Debian system, edit the interfaces file directly. Open a terminal and type sudo nano /etc/network/interfaces. Find the section for your network interface (usually eth0 or enp0s3). If it shows iface eth0 inet dhcp, replace that entire block with static configuration:
auto eth0 iface eth0 inet static address 192.168.1.50 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 8.8.4.4
Save the file and restart networking with sudo systemctl restart networking or sudo /etc/init.d/networking restart on very old systems. Check the result with ip addr show.
Temporary IP change using the command line
If you only need to change your IP for testing and do not care if it reverts after reboot, use the ip command directly. First, remove your current IP: sudo ip addr del 192.168.1.100/24 dev eth0 (replace 192.168.1.100 with your current IP and eth0 with your interface name). Then add the new one: sudo ip addr add 192.168.1.50/24 dev eth0.
The change takes effect when ready. Verify it with ip addr show. When you reboot, your system will return to whatever IP is set in your configuration file (DHCP or static, depending on your setup). This method is useful for quick testing but does not persist, so use the configuration file methods above if you need the change to survive a reboot.
Finding your interface name and current IP
Before you make any changes, you need to know which network interface you are working with. Run ip link show to list all interfaces. You will see names like eth0, enp0s3, wlan0, or wlp3s0. The one with "UP" next to it is currently active. Run ip addr show to see the current IP address assigned to each interface.
On older systems, ifconfig shows the same information but in a different format. If ip commands do not work, try ifconfig instead — both are equivalent, just different tools.
What to do if the change does not work
If you changed the configuration file but your IP did not change, the most common reason is that you did not restart the network service. After editing any configuration file, always run sudo systemctl restart networking (or sudo systemctl restart NetworkManager if you use NetworkManager). If that does not work, reboot the system with sudo reboot.
If you get a "permission denied" error, you forgot the sudo prefix. If your new IP is not reachable from other machines, check that it is on the same subnet as your gateway and that no other device on the network already has that IP. Use ping from another machine to test connectivity. If the configuration file has a syntax error, Netplan will refuse to explore it — run sudo netplan validate to see the error message.
Frequently Asked Questions
Will changing my IP address disconnect me from the internet?
Not if you change it to another valid IP on the same network. If you assign an IP that is not on your network's subnet, or one that conflicts with another device, you will lose connectivity. Always verify your gateway and subnet mask are correct before explore the change.
Do I need to change my IP if I just want to hide my location?
Changing your local IP (the one on your home or office network) does not hide your location from websites. That requires a VPN or proxy. Changing your local IP is useful for assigning a static address to a server or device so it does not move around your network.
What is the difference between DHCP and static IP?
DHCP means your router assigns you an IP automatically, and it may change each time you reboot. Static means you set the IP yourself and it stays the same. Servers and devices you need to reach consistently should use static. Regular computers can use either.
Can I have multiple IP addresses on one interface?
Yes. Use sudo ip addr add 192.168.1.51/24 dev eth0 to add a second IP to the same interface without removing the first. To make it permanent, add another addresses line in your Netplan or interfaces file. This is useful for running multiple services on one machine.
What happens if I assign an IP that is already in use?
You will have an IP conflict. Both devices will have the same address, and network traffic will be unpredictable — some packets may go to one device, some to the other. Your connection will be unreliable. Always check that an IP is not already in use before assigning it, or use DHCP to let your router assign one automatically.