• PRO Courses Guides New Tech Help Pro Expert Videos About wikiHow Pro Upgrade Sign In
  • EDIT Edit this Article
  • EXPLORE Tech Help Pro About Us Random Article Quizzes Request a New Article Community Dashboard This Or That Game Popular Categories Arts and Entertainment Artwork Books Movies Computers and Electronics Computers Phone Skills Technology Hacks Health Men's Health Mental Health Women's Health Relationships Dating Love Relationship Issues Hobbies and Crafts Crafts Drawing Games Education & Communication Communication Skills Personal Development Studying Personal Care and Style Fashion Hair Care Personal Hygiene Youth Personal Care School Stuff Dating All Categories Arts and Entertainment Finance and Business Home and Garden Relationship Quizzes Cars & Other Vehicles Food and Entertaining Personal Care and Style Sports and Fitness Computers and Electronics Health Pets and Animals Travel Education & Communication Hobbies and Crafts Philosophy and Religion Work World Family Life Holidays and Traditions Relationships Youth
  • Browse Articles
  • Learn Something New
  • Quizzes Hot
  • This Or That Game
  • Train Your Brain
  • Explore More
  • Support wikiHow
  • About wikiHow
  • Log in / Sign up
  • Computers and Electronics
  • Operating Systems

How to Assign an IP Address on a Linux Computer

Last Updated: April 11, 2024 Tested

Debian, Ubuntu, & Linux Mint

Red hat, centos, & fedora.

This article was co-authored by wikiHow staff writer, Jack Lloyd . Jack Lloyd is a Technology Writer and Editor for wikiHow. He has over two years of experience writing and editing technology-related articles. He is technology enthusiast and an English teacher. The wikiHow Tech Team also followed the article's instructions and verified that they work. This article has been viewed 731,531 times. Learn more...

This wikiHow teaches you how to assign a new IP address to your computer when using Linux. Doing so can prevent connection issues for the item in question.

Assign an IP Address to a Debian, Ubuntu, or Linux Mint Computer

No matter what version of Linux you're running, you'll need to open the Terminal and switch to root. In Debian, Ubuntu, and Linux Mint, use the "ipconfig" command to view your Internet items. Find the item you want to assign an IP address to, then type "sudo ipconfig [name] [ipaddress] netmask 255.255.255.0 up".

Step 1 Verify your Linux version.

  • Press Ctrl + Alt + T or Ctrl + Alt + F1 (if you're on a Mac, substitute the ⌘ Command key for Ctrl .
  • Click the text box at the top or bottom of the screen if possible.
  • Open the Menu window and find the "Terminal" application, then click on it.

Step 3 Switch to root.

  • A "root" account is the Linux equivalent of an Administrator account on a Windows or Mac computer.

Step 4 Bring up a list of your current Internet items.

  • The top item should be your current router or Ethernet connection. This item's name is "eth0" (Ethernet) or "wifi0" (Wi-Fi) in Linux.

Step 5 Find the item to which you want to assign an IP address.

  • In most cases, this is the "eth0" or "wifi0" item.

Step 6 Change the item's IP address.

  • To assign an IP of "192.168.2.100" to your ethernet connection ("eth0"), for example, you'd enter sudo ifconfig eth0 192.168.0.100 netmask 255.255.255.0 here.

Step 7 Assign a default gateway.

  • If you have a different DNS server address that you would rather use, enter that in the place of 8.8.8.8 .

Step 9 Check your item's new IP address.

  • 5 Find the network connection that you want to change. This will normally be the Ethernet or Wi-Fi connection, which has an IP address currently listed on the right side of the window.

Step 6 Switch to the network scripts directory.

  • For a network named "eno12345678", for example, you'd enter vi ifcfg-eno12345678 here.

Step 9 Edit the network's information.

  • BOOTPROTO - Change dhcp to none
  • Any IPV6 entry - Delete any IPV6 entries entirely by moving the cursor to the I on the left and pressing Del .
  • ONBOOT - Change no to yes

Step 10 Enter a new IP category.

  • For example: to use "192.168.2.23" as your IP address, you'd type in IPADDR=192.168.2.23 and press ↵ Enter .
  • Type in PREFIX=24 and press ↵ Enter . You can also enter NETMASK=255.255.255.0 here.
  • Type in GATEWAY=192.168.2.1 and press ↵ Enter . Substitute your preferred gateway address if different.

Step 12 Save and exit the file.

Expert Q&A

  • Some very specific Linux distributions will require you to go through a different process to assign an IP address. To see your specific distribution's specifications, check online. Thanks Helpful 0 Not Helpful 0

how to change computer ip address linux

  • Don't forget to switch back to the regular (non-root) user account when you're done. Thanks Helpful 1 Not Helpful 1

You Might Also Like

Set up a Network in Ubuntu

  • ↑ https://danielmiessler.com/study/set_ip/
  • ↑ https://www.youtube.com/watch?v=oQd5eG9BZXE&t=

About This Article

Jack Lloyd

  • Send fan mail to authors

Reader Success Stories

Buddy HaDagi

Buddy HaDagi

Jan 27, 2017

Is this article up to date?

how to change computer ip address linux

Dmitry Ugay

Oct 10, 2017

Am I a Narcissist or an Empath Quiz

Featured Articles

115 Cute, Creative, & Funny Ways to Say “Thank You” Over Text

Trending Articles

How to Answer “How’s It Going?” in Any Situation

Watch Articles

Make Homemade Liquid Dish Soap

  • Terms of Use
  • Privacy Policy
  • Do Not Sell or Share My Info
  • Not Selling Info

Keep up with tech in just 5 minutes a week!

How-To Geek

How to set a static ip address in ubuntu.

When static is the way forward.

Quick Links

What is a static ip address, setting a static ip in ubuntu, set a static ip in ubuntu with the gui, connection convenience, key takeaways.

After gathering your connection name, subnet mask, and default gateway, you can set a static IP address in the terminal using the nmcli command. Or, in the GNOME desktop, open your connection settings and click the + icon, then enter the info for your static IP address there.

Your home network relies on IP addresses to route data between devices, and sometimes on reconnecting to the network a device's address can change. Here's how to give an Ubuntu Linux computer a permanent IP address that survives reboots.

Everything on your network home network, whether it's using a wired connection or Wi-Fi, has an IP address . IP stands for Internet Protocol. An IP address is a sequence of four numbers separated by three dots. Each IP address that is unique within that network.

IP addresses act as numeric labels. Your router uses these labels to send data between the correct devices. Usually, your router assigns IP addresses. It knows which IP addresses are in use and which are free. When a new device connects to the network, it requests an IP address and the router allocates one of the unused IP addresses. This is called DHCP, or dynamic host configuration protocol .

When a device is restarted or powered off and on, it may receive its old IP address once more, or it might be allocated a new IP address. This is normal for DHCP and it doesn't affect the normal running of your network. But if you have a server or some other computer that you need to be able to reach by its IP address, you'll run into problems if its IP address doesn't survive power downs or reboots.

Pinning a specific IP address to a computer is called allocating a static IP address . A static IP address, as its name suggests, isn't dynamic and it doesn't change even if the computer is power-cycled .

Nmcli is the command-line network manager tool , and can be used to change your IP address, configure network devices, and --- relevant to our purposes --- set up a static IP in Ubuntu.

We're demonstrating this technique on Ubuntu 22.04 LTS, but it ought to work on any Linux distribution, including Ubuntu 23.04. The nmcli tool was released in 2004, so it should be present on just about any standard distribution.

Let's take a look at the network connections that already exist on the computer. We're using the connection command with the show argument.

nmcli connection show

This displays some information about each connection. We only have a single connection configured.

The output is wider than the terminal window. This is the information that we're shown.

  • Name : Our network connection is called "netplan-enp0s3."
  • UUID : The universally unique identifier Linux uses to reference this connection internally.
  • Type : This is an ethernet connection.
  • Device : This connection is using the "enp0s3" network interface. It's the only network card in this computer.

We can use the ip command to discover the IP address this computer is using.

In the output we can see the "enp0s3" entry, and its current IP address, 192.168.86.117. The "/24" is a shorthand way of saying that this network uses a 255.255.255.0 subnet mask . Take a note of this number, we'll need to use it later.

We need to choose the IP address we're going to set as our static IP address. Obviously, you can't use an IP address that is already in use by another device. One safe way to proceed is to use the current IP address assigned to the Ubuntu system. We know for certain that nothing else is using that IP address.

If we want to use a different IP address, try pinging it. We're going to test whether IP address 192.168.86.128 is in use. If everything else on your network uses DHCP and you get no response to the ping command, it should be safe to use.

ping 192.168.86.128

Even if another device had previously used that IP address, it'll be given a new IP address when it next boots up. Nothing responds to the ping requests, so we're clear to go ahead and configure 192.168.86.128 as our new static IP.

We also need to know the IP address of your default gateway , which will usually be your broadband router. We can find this using the ip command and the route option, which we can abbreviate to "r."

The entry that starts with "default" is the route to the default gateway. Its IP address is 192.168.86.1. Now we can start to issue commands to set up our static IP address.

The first command is a long one.

sudo nmcli con add con-name "static-ip" ifname enp0s3 type ethernet ip4 192.168.86.128/24 gw4 192.168.86.1

Taken in small chunks, it's not as bad as it looks. We're using sudo . The nmcli arguments are:

  • con : Short for "connection."
  • add : We're going to add a connection.
  • con-name "static-ip" : The name of our new connection will be "static-ip."
  • ifname enp0s3 : The connection will use network interface "enp0s3."
  • type ethernet : We're creating an ethernet connection.
  • ip4 192.168.86.128/24 : The IP address and subnet mask in classless inter-domain routing notation . This is where you need to use the number you took note of earlier.
  • gw4 192.168.86.1 : The IP address of the gateway we want this connection to use.

To make our connection a functioning connection, we need to provide a few more details. Our connection exists now, so we're not adding anything, we're modifying settings, so we use the mod argument. The setting we're changing is the IPv4 DNS settings. 8.8.8.8 is the IP address of Google's primary public DNS server , and 8.8.4.4 is Google's fallback DNS server.

Note that there is a "v" in "ipv4." In the previous command the syntax was "ip4" without a "v." The "v" needs to be used when you're modifying settings, but not when adding connections.

nmcli con mod "static-ip" ipv4.dns "8.8.8.8,8.8.4.4"

To make our IP address static, we need to change the method which the IP address obtains its value. The default is "auto" which is the setting for DHCP. We need to set it to "manual."

nmcli con mod "static-ip" ipv4.method manual

And now we can start or "bring up" our new connection.

nmcli con up "static-ip" ifname enp0s3

We didn't get any error messages which is great. Lets use nmcli to look at our connections once more.

nmcli con show

Here's the output:

Our static-ip connection is active and using device "enp0s3." The existing connection "netplan-enp0s3" is no longer associated with a physical network interface because we've pinched "enp0s3" from it.

Click the icons at the far-right end of the system bar to show the system menu, then click on the "Wired Connected" menu option. If you're using a wireless connection, instead click the name of your Wi-Fi network.

The available connections are displayed. A dot indicates which is in use. Click the "Wired Settings" or "Wi-Fi Settings" menu option. The details of the active connection are displayed.

If you followed our previous instructions the new connection will be the active connection. We can see our new "static-ip" connection has the IP address, default gateway, and DNS servers that we set for it.

To create a new connection using the "Settings" application, click the " + " icon on the "Networks" page, above the list of wired connections.

A dialog appears. We need to provide a name for our new static IP connection.

We're calling our new connection "static-2." Click the "IPv4" tab.

Select the "Manual" radio button, and complete the "Address", "Netmask", and "Gateway" fields. Also complete the DNS field, and then click the green "Apply" button. Note the comma between the DNS entries.

Our new connection is listed in the "Wired" connections pane.

You can swap between the available connections by clicking directly on their names.

If you want to modify a connection after you create it, click the cog icon. In this case, we'll enter the settings for the "static-ip" connection.

A dialog box opens. Click on the "IPv4" tab.

Because we set our new IP address to be static, the "Manual" radio button is selected. You could change this back to DHCP by selecting the "Automatic (DHCP)" radio button, and clicking the green "Apply" button.

Using the nmcli command or the GNOME desktop and apps, you can hop between network connections very easily and very quickly.

It's more convenient to have a selection of connection profiles and move between them as you need to, rather than to have one that you keep editing. If something goes horribly wrong with the connection you're editing or adding, you can always fall back on one of the existing connections.

What is smb.conf File and How to Use It?

smb conf file

How to Encrypt Files in Linux? [6 Best Methods]

how to encrypt files in linux 4 best methods featured image

4 Effective Ways to Delete Multiple Keys in Redis CLI

4 effective ways to delete keys in redis cli featured image

How to View Linux File Timestamps? [3 Easy Methods]

how to see the timestamps of a file in linux 3 easy methods featured image

How to Change IP Address Linux [3 Effective Methods]

how to change computer ip address linux

Reviewed by

Last updated: May 14, 2024

Expert verified

To change ip address in Linux, you can try these three methods:

  • Using the ifconfig Command: Change IP address through the command line.
  • Configuring IP Address via Network Manager: Change IP address using a graphical interface.
  • Using the ip Command: Change IP address with extensive network configuration capabilities.

Explore the guide below to learn different methods and best practices to change ip address Linux.

IP addresses are unique identifiers assigned to devices connected to a network, enabling data transfer and communication. You might need to change IP address in Linux for various reasons, such as safeguarding your privacy, accessing geo-restricted content, troubleshooting network issues, or even experimenting with different network configurations.

In this ultimate guide, I will explore three effective methods to change IP address Linux and four best practices to remember when changing the ip address. 

How to Change IP Address Linux?

To change IP address in Linux, you have options that suit your preferences. For advanced users and scripting, the ifconfig command provides command-line control. Network Manager offers a user-friendly graphical interface, while the ip command provides extensive network configuration capabilities.

1. Using the ifconfig Command

This method allows you to change your IP address through the command line, making it useful for advanced users and scripting purposes. Follow these steps to change your IP address using ifconfig:

  • Open a Terminal window.

opening terminal 10

  • Identify the network interface you want to modify by running the command: 
  • It will display a list of available network interfaces.

identify network interface you want to modify

  • Disable the network interface using: 
  • Replace the interface with the interface that you selected.

disabling network interface

  • Change Linux IP address using the command: 
  • This command will change the IP address.

changing ip address

  • Verify the changes by running ifconfig again.

verifying the changes

2. Configuring IP Address via Network Manager

Network Manager provides a user-friendly graphical interface for changing IP addresses, making it suitable for users who prefer a visual approach to network configuration. Here’s how you can change IP address in Linux using Network Manager’s graphical interface:

  • Open the Network Manager applet from the system tray or access it through the system settings.

opening system settings

  • Locate the network connection you want to modify and select it.

locating network to change ip address

  • Click on the IPv4 or IPv6 tab, depending on the type of address you wish to change.

choosing ip address type to change it

  • Choose the Manual option from the Method dropdown menu.

choosing manual method

  • Enter the desired IP address, subnet mask, gateway, and DNS servers, then click on the apply button.

entering desired ip address

  • It will set IP address Linux and the output will be:

changes are made

3. Using the ip Command

The ip command offers extensive network configuration capabilities, making it a powerful tool for advanced users who require fine-grained control over IP address changes. Follow these steps to change your IP address using the ip command:

  • Open a Terminal window and identify the network interface you wish to modify using the command: 
  • The command will show a list of network interfaces.

identifying network interface

  • Disable the network interface: 

Replace interface with interface name that you chose.

disable desired network interface

  • Change Linux ip address by executing the command: 
  • The command will change ip address on Linux.

changing ip address of desired interface

  • Enable the network interface: 
  • The changes will look like this:

enabling network interface

How to Permanently Change IP Linux?

Permanently changing your IP address in Linux is essential for managing network configurations, ensuring stable server connectivity, and meeting security protocols. Setting a static IP prevents issues like network conflicts and device unavailability, facilitating a reliable setup. Follow these steps to change your ip permanently:

Netplan is a network configuration utility introduced in Ubuntu 17.10 that uses YAML configuration files to manage network settings. It simplifies the configuration process and is used by default in Ubuntu versions post-17.10.

  • Open a terminal (Ctrl+Alt+T).
  • List Netplan configurations with:

listing netplan configuration file

  • Edit the Netplan Configuration. Choose an existing YAML file or create a new one:

This command opens an existing Netplan configuration file in the nano text editor. If the file does not exist, nano will start with a new file named 01-netcfg.yaml .

opening configuration file in nano editor

  • Modify or add the configuration to set a static IP. Here’s an example:

Replace enp0s3 with your network interface name and adjust the IP settings as necessary.

editing and saving network configuration file

  • Save the changes and apply them:

This command saves the changes to the system and applies the new network settings immediately.

applying the changes to netplan configuration

  • Check the new IP address:

This command displays the current network configuration for enp0s3, including the newly set static IP address.

verifying the changes

Best Practices for Changing IP Address

Changing IP addresses in Linux requires careful attention to ensure a smooth transition and avoid potential issues. Following these best practices when changing IP addresses in Linux helps maintain system security, minimize downtime, and ensure a smooth transition to the new IP configuration. Here are four best practices to follow:

1. 🔒 Ensure Proper Authorization and Permission

Before changing your IP address, it is crucial to ensure that you have the necessary authorization and permission to do so. Modifying network settings often requires administrative privileges.

Changing IP addresses without proper authorization can lead to network connectivity issues or violations of organizational policies. Always consult your network administrator or obtain the necessary permissions before proceeding to avoid potential complications or security breaches.

2. ⏰ Plan and Document Your Changes

Changing IP addresses should not be taken lightly. It is important to plan and document your changes to avoid confusion and ensure a smooth transition. Before making any modifications, create a clear plan outlining the steps and desired outcomes.

Documenting the changes helps maintain an organized process record, making troubleshooting easier if any issues arise. Documentation is also a valuable reference for future network management or IP address reconfiguration.

3. 💡 Verify Compatibility and Impact

Verify the compatibility and potential impact of changing your IP address, especially if your network is integrated with other systems or services. Determine whether the IP address change will affect other components such as DNS, routing, or network services. Assess potential compatibility issues with existing devices, software, or network configurations.

Identifying and addressing compatibility concerns beforehand can minimize disruptions and ensure a seamless transition to the new IP address without compromising other essential network functionalities.

4. 🔧 Test and Validate the New Configuration

Before implementing the new IP address configuration in a production environment, it is crucial to test and validate the changes thoroughly. Set up a test environment or use a sandbox network to simulate the configuration of the new IP address. Test network connectivity, services, and applications to ensure they function correctly with the new IP address.

By conducting thorough testing, you can identify and address any issues or conflicts before deploying the changes to the live network. This proactive approach helps mitigate potential downtime or disruptions and ensures a smooth transition to the new IP address.

Reflecting on the Process of Linux Change IP Address

I have provided you with various methods on how to change ip in Linux, including using the ifconfig command, modifying network configuration files, and utilizing the ip command. Alongside these methods, I have shared best practices to ensure a smooth and secure IP address change.

To deepen your knowledge, consider exploring related topics such as advanced network configuration , network security practices , or setting up a Virtual Private Network (VPN) for enhanced privacy and anonymity. Stay updated with the latest developments in Linux networking to ensure you stay ahead in managing IP addresses and optimizing your network connectivity.

Frequently Asked Questions

How do i revert to my original ip address after making changes.

If you wish to revert to your original IP address after making changes, simply follow the steps outlined in the respective method you used initially, but instead of entering a new IP address, use your initial IP configuration. For example, if you modified the IP address using the ifconfig command, open the Terminal and use sudo ifconfig interface original_ip_address netmask subnet_mask up . This will restore your original IP address and network settings.

Will changing the IP address affect other network settings?

Yes, changing the IP address can impact other network settings. DNS configuration is one of the critical network settings that can be affected. DNS (Domain Name System) translates domain names into IP addresses, allowing you to access websites using their domain names. When you change your IP address, it is important to ensure that the DNS settings are updated to reflect the new IP address, or else you may experience issues with domain name resolution.

Can changing the IP address help bypass geo-restrictions?

Yes, changing your IP address can be an effective method to bypass certain geo-restrictions. Changing your IP address, especially one associated with a different geographic location, can make it appear like you are accessing the internet from that particular region. This can help you bypass restrictions imposed by certain websites or online services that limit access based on geographical boundaries. By changing your IP address to one that allowed access, you can overcome these restrictions and gain access to content or services previously unavailable in your original location.

How can I automate the IP address change process in Linux?

To automate the IP address change process in Linux, you can utilize scripting and scheduling tools. You can automate the entire process by creating a script with the necessary commands to change the IP address. Save the script and grant it executable permissions. Then, you can use tools like cron , a time-based job scheduler, to schedule the execution of the script at specific intervals or during system startup. By configuring cron to run the script automatically, you eliminate the need for manual intervention, making the IP address change process in Linux seamless and automated.

how to change computer ip address linux

Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

how to change computer ip address linux

Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

Share this article

How to find ip address in linux command line [5 easy methods], 3 effective methods to select all text in vim/vi, leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

4 Easy Methods to List Only Directories in Linux 

4 easy methods to list only directories in linux featured image

How to Implement Docker Restart Policies? [4 Simple Restart Policies]

how to implement docker restart policies featured image

How to Run Linux Commands in Background [8 Effective Methods]

how to run a command in the background on linux effective methods featured image

10 Best Ways to Use ripgrep Command in Linux

best ways to use ripgrep command in linux featured image

How To Change IP Address Linux

Copy to Clipboard

  • How-To Guides
  • Tech Setup & Troubleshooting

how-to-change-ip-address-linux

Introduction

Changing the IP address in a Linux system is a valuable skill that can come in handy for a variety of reasons. Whether you want to access geographically restricted content, troubleshoot network issues, or boost security, being able to modify your IP address gives you more control over your network connection.

Linux, known for its flexibility and customization options, provides several methods to change the IP address. In this article, we will explore different approaches to altering the IP address in Linux and discuss their advantages and use cases.

From command-line interfaces (CLI) to graphical user interfaces (GUI), Linux offers diverse options to suit different user preferences and skill levels. We will cover methods using the CLI, network manager GUI, configuring static IP addresses, and obtaining dynamic IP addresses through DHCP.

Whether you are a beginner or an experienced Linux user, understanding how to change the IP address will prove invaluable in managing and troubleshooting your network connections. So let’s dive in and discover the various methods to change the IP address in Linux!

Why Change IP Address in Linux?

There are several compelling reasons why you might want to change your IP address in a Linux system. Let’s explore some of the most common scenarios:

  • Access Geographically Restricted Content: Many online platforms and streaming services restrict access to certain regions. By changing your IP address, you can bypass these restrictions and gain access to content that might otherwise be unavailable in your location.
  • Enhance Online Privacy and Security: Your IP address is a unique identifier that can be used to track your online activities. Changing your IP address can help protect your privacy and make it more difficult for others to trace your online presence and data.
  • Troubleshoot Network Issues: Changing the IP address can sometimes resolve network problems, such as connectivity issues or conflicts with other devices on the network. By assigning a new IP address, you can refresh your network connection and potentially resolve any underlying issues.
  • Prevent IP Address Blocking: In some cases, you may find yourself blocked from accessing certain websites or services due to your IP address being flagged or banned. Changing your IP address can help circumvent these restrictions and regain access to the blocked content.
  • Secure Remote Access: If you need to access your Linux system remotely, changing the IP address can add an extra layer of security. By regularly changing your IP address, you can make it more difficult for unauthorized individuals to gain access to your system.
  • Network Testing and Configuration: Changing IP addresses can also be beneficial for network testing and configuration purposes. It allows you to simulate different network setups, test connectivity under various conditions, and ensure that your network infrastructure is functioning as intended.

These are just a few examples of why you might want to change your IP address in Linux. By understanding the reasons behind IP address modifications, you can make informed decisions and leverage this capability to enhance your online experience and network management.

Different Methods to Change IP Address in Linux

Linux offers various methods to change the IP address, providing flexibility and options based on the user’s preference and technical expertise. Let’s explore the different approaches:

The CLI is a powerful tool for Linux users to change their IP address. By utilizing commands such as ifconfig and ip, users can easily modify their network settings directly from the terminal. This method is ideal for those who prefer a command-line interface and have knowledge of Linux networking commands.

Linux distributions that include a graphical user interface often provide a Network Manager tool for managing network settings. Through the Network Manager GUI, users can easily change their IP addresses by selecting the desired network connection, accessing its properties, and modifying the IP address settings. This method is suitable for users who prefer a visual interface and are comfortable navigating through system settings.

Another method to change the IP address in Linux is by configuring a static IP address. This involves manually assigning a specific IP address to the network interface. By configuring a static IP address, users can have a consistent and predictable IP address for their system. This is especially useful for servers or devices that require a fixed IP address for networking and remote access purposes.

DHCP (Dynamic Host Configuration Protocol) allows Linux systems to automatically obtain IP addresses from a DHCP server. By enabling DHCP, the Linux system will request and receive an IP address dynamically from the DHCP server whenever it connects to the network. This method is convenient for users who prefer automatic IP address assignment and don’t require a specific IP address for their system.

These are the different methods available for changing the IP address in Linux. Each method has its own advantages and use cases, so choose the one that best suits your needs and preferences. Whether you prefer the CLI, the Network Manager GUI, static IP configuration , or dynamic IP assignment through DHCP, Linux provides the flexibility to adapt to different networking requirements.

Method 1: Changing IP Address Using Command Line Interface (CLI)

The Command Line Interface (CLI) is a powerful tool for changing the IP address in Linux using various networking commands. Here’s how you can change the IP address using the CLI:

  • Open the terminal on your Linux system. You can usually find the terminal application in the Applications or System Tools menu.
  • Type the following command to check the current IP address configuration:
  • Identify the network interface you want to modify. Common interfaces include eth0 (Ethernet) or wlan0 (Wi-Fi).
  • Use the following command to change the IP address for the desired network interface:

Replace [interface-name] with the name of the network interface you identified in step 3. Replace [new-IP-address] with the new IP address you want to assign to the interface. Replace [netmask] with the appropriate netmask for your network.

For example, to change the IP address of the eth0 interface to 192.168.1.100 with a netmask of 255.255.255.0, you would use the following command:

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

  • Verify the changes by running the ifconfig command again. You should see the updated IP address configuration for the specified network interface.

Changing the IP address using the CLI provides a quick and efficient way to modify network settings in Linux. This method is particularly suitable for users who are comfortable working with the command line and prefer a more direct approach for network configuration.

Remember, the changes made using the CLI are temporary and will be reset after the system is restarted. To make the changes persistent, additional steps such as modifying configuration files may be required.

Now that you know how to change the IP address using the CLI, let’s move on to exploring other methods using the Network Manager GUI, static IP configuration, and DHCP in Linux.

Method 2: Changing IP Address Through Network Manager GUI

Linux distributions often come equipped with a graphical user interface (GUI) that includes a Network Manager tool, providing a user-friendly way to change the IP address. Follow these steps to modify your IP address using the Network Manager GUI:

  • Click on the Network Manager icon located on the system tray or taskbar. It is usually represented by an icon with two arrows forming a circle or a computer monitor symbol.
  • Select the network connection you want to modify. This could be a wired or wireless connection, depending on your system configuration.
  • Right-click on the selected connection and choose “Connection Information” or a similar option from the context menu.
  • A Network Manager window will open, displaying detailed information about the selected network connection.
  • Click on the “IPv4” or “IPv6” tab, depending on the IP version you want to modify.
  • From the drop-down menu, select the desired method for obtaining the IP address: Automatic (DHCP), Manual, or Shared with other computers.
  • If you choose the Manual option, you can enter the new IP address, subnet mask, gateway, and DNS servers manually.
  • Click “Apply” or “OK” to save the changes.
  • Once the changes are saved, the network connection will be updated with the new IP address.

The Network Manager GUI provides an intuitive interface for changing the IP address in Linux. It is especially useful for users who prefer a visual approach or find the command-line interface intimidating. By following these steps, you can easily modify your IP address and related network settings.

Keep in mind that the interface and options may vary slightly depending on the Linux distribution and desktop environment you are using. Nevertheless, the overall process for changing the IP address through the Network Manager GUI remains similar across different Linux systems.

Now that you are familiar with changing the IP address using the Network Manager GUI, let’s explore other methods, including configuring a static IP address and using DHCP to obtain a dynamic IP address in Linux.

Method 3: Configuring a Static IP Address in Linux

Configuring a static IP address in Linux involves manually assigning a specific IP address to your network interface. This can be useful in situations where you need a consistent and predictable IP address for your system, such as for servers or devices that require remote access. Follow these steps to configure a static IP address:

  • Open the terminal application on your Linux system.
  • Run the following command to open the network configuration file in a text editor:

sudo nano /etc/network/interfaces

Note: The above command assumes you are using a Debian-based distribution. For other distributions, the network configuration file may be located elsewhere or have a different name.

  • Locate the line that corresponds to the network interface you want to configure and modify. The line might look like “iface eth0 inet dhcp” or “iface ens33 inet dhcp” depending on your system configuration.
  • Change the line to the following format to configure a static IP address:

Replace [interface-name] with the name of the network interface you want to configure. Replace [desired-IP-address], [netmask], and [gateway-IP-address] with your desired IP address, netmask, and gateway IP address respectively.

For example, if you want to configure a static IP address for the eth0 interface with an IP address of 192.168.0.100, a netmask of 255.255.255.0, and a gateway of 192.168.0.1, the modified lines would look like this:

iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1

  • Save the changes and exit the text editor.
  • Restart the networking service to apply the new static IP configuration. You can do this by running the following command:

sudo systemctl restart networking

  • Verify the changes by running the ifconfig command or using the Network Manager GUI. The network interface should now be assigned the static IP address you configured.

By following these steps, you can easily configure a static IP address in Linux. This method ensures that your system always uses the same IP address, which is particularly useful for devices that require a stable and predictable network configuration.

Remember to adjust the network configuration file and interface name according to your Linux distribution and network setup.

Now that you understand how to configure a static IP address, let’s explore the final method: using DHCP to obtain a dynamic IP address in Linux.

Method 4: Using DHCP to Obtain a Dynamic IP Address

DHCP (Dynamic Host Configuration Protocol) allows Linux systems to automatically obtain IP addresses from a DHCP server. This method is suitable for users who prefer automatic IP address assignment and don’t require a specific IP address for their system. Follow these steps to use DHCP to obtain a dynamic IP address:

  • Open the network configuration file in a text editor. The location and filename may vary depending on your Linux distribution, but it is commonly found at “/etc/network/interfaces”.
  • Locate the line that corresponds to the network interface you want to configure.
  • Change the line to the following format to use DHCP:

iface [interface-name] inet dhcp

Replace [interface-name] with the name of the network interface you want to configure. For example, if you want to use DHCP for the eth0 interface, the modified line would look like this:

iface eth0 inet dhcp

  • Restart the networking service to apply the new configuration. You can do this by running the following command:
  • Your Linux system will now use DHCP to obtain a dynamic IP address. The DHCP server on the network will assign an IP address to your system automatically.
  • Verify the changes by running the ifconfig command or using the Network Manager GUI. The network interface should now be assigned a dynamic IP address.

Using DHCP to obtain a dynamic IP address is a straightforward method that allows for automatic IP address assignment. This approach is ideal for users who prefer ease of configuration and don’t require a specific IP address for their system.

With this method explored, you now have a comprehensive understanding of different ways to change the IP address in Linux. Whether you prefer using the command-line interface, the Network Manager GUI, configuring a static IP address, or relying on DHCP for dynamic IP assignment, Linux provides the flexibility to adapt to your networking requirements.

Frequently Asked Questions (FAQs)

Here are some frequently asked questions about changing IP addresses in Linux:

  • Can I change my IP address without restarting the system?

Yes, you can change your IP address without restarting the system. In most cases, modifying the network settings or restarting the networking service will apply the changes immediately without requiring a system reboot.

  • Will changing my IP address affect my internet connection?

Changing your IP address may temporarily interrupt your internet connection while the changes take effect. However, once the new IP address is assigned and the network is reconfigured, your internet connection should resume normally.

  • Can I assign multiple IP addresses to a single network interface?

Yes, you can assign multiple IP addresses to a single network interface in Linux. This is known as IP aliasing or multiple IP address configuration. It allows a single network interface to have multiple IP addresses, each serving different purposes or applications.

  • Can I revert back to my original IP address after changing it?

Yes, you can revert back to your original IP address by modifying the network configuration settings or restarting the system. Alternatively, if your network uses DHCP to assign IP addresses dynamically, you can simply disconnect and reconnect to the network to obtain your original IP address.

  • Are there any security considerations when changing the IP address?

Changing your IP address can provide some level of security by making it more challenging for potential attackers to target your system. However, it is important to remember that changing the IP address alone is not a comprehensive security measure. It is recommended to implement additional security measures, such as using firewalls and keeping your system up-to-date with patches and security fixes.

These are some common questions that arise when it comes to changing IP addresses in Linux. If you have further inquiries or encounter specific issues, it is advisable to consult relevant documentation or seek guidance from the Linux community.

Changing the IP address in Linux is a valuable skill that allows for better control over network connections and can address various needs such as accessing restricted content, troubleshooting network issues, and enhancing security. In this article, we explored different methods to change the IP address in Linux.

We started by discussing the benefits of changing the IP address, including accessing geographically restricted content, enhancing privacy and security, troubleshooting network issues, and more. Understanding these reasons can help users make informed decisions regarding their IP address modifications.

We then explored four different methods to change the IP address in Linux:

  • Method 1: Changing IP Address Using Command Line Interface (CLI): This method involves using networking commands in the terminal to modify the IP address directly. It is suitable for users who prefer the command line and have knowledge of Linux networking commands.
  • Method 2: Changing IP Address Through Network Manager GUI: This method utilizes the graphical user interface of the Network Manager tool to modify the IP address. It is user-friendly and ideal for those who prefer a visual approach.
  • Method 3: Configuring a Static IP Address in Linux: This method involves manually assigning a specific IP address to the network interface. It ensures a consistent and predictable IP address, making it useful for servers and devices that require remote access.
  • Method 4: Using DHCP to Obtain a Dynamic IP Address: This method allows the system to automatically obtain an IP address from a DHCP server, making it convenient for users who prefer automatic IP address assignment.

Each method has its own advantages and use cases, providing flexibility for different user preferences and networking requirements.

By mastering these methods, Linux users can effectively manage their network connections and make necessary IP address modifications when needed. Whether you are a beginner or an experienced Linux user, having the ability to change the IP address in Linux is a valuable skill that can enhance your overall network management experience.

Now, armed with this knowledge, you can confidently navigate the Linux environment and make necessary changes to your IP address as required. So go ahead, explore the different methods, and unlock the full potential of your Linux system!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

  • Crowdfunding
  • Cryptocurrency
  • Digital Banking
  • Digital Payments
  • Investments
  • Console Gaming
  • Mobile Gaming
  • VR/AR Gaming
  • Gadget Usage
  • Gaming Tips
  • Online Safety
  • Software Tutorials
  • Tech Setup & Troubleshooting
  • Buyer’s Guides
  • Comparative Analysis
  • Gadget Reviews
  • Service Reviews
  • Software Reviews
  • Mobile Devices
  • PCs & Laptops
  • Smart Home Gadgets
  • Content Creation Tools
  • Digital Photography
  • Video & Music Streaming
  • Online Security
  • Online Services
  • Web Hosting
  • WiFi & Ethernet
  • Browsers & Extensions
  • Communication Platforms
  • Operating Systems
  • Productivity Tools
  • AI & Machine Learning
  • Cybersecurity
  • Emerging Tech
  • IoT & Smart Devices
  • Virtual & Augmented Reality
  • Latest News
  • AI Developments
  • Fintech Updates
  • Gaming News
  • New Product Launches

Close Icon

  • What is Building Information Modelling

How to Use Email Blasts Marketing To Take Control of Your Market

Related post, how to extend c drive with unallocated space easily and quickly, how to update audio, graphics and wi-fi drivers on windows 10, related posts.

How To Configure Ip Address For Ethernet

How To Configure Ip Address For Ethernet

How To Find A Device IP Address

How To Find A Device IP Address

How To Find My Ip Address For Wifi

How To Find My Ip Address For Wifi

How To Assign IP Address

How To Assign IP Address

How To Setup A Linux Server For Remote Accessing IoT Devices

How To Setup A Linux Server For Remote Accessing IoT Devices

How To Change The IP Address On My Computer

How To Change The IP Address On My Computer

How To Find Default Gateway IP Address

How To Find Default Gateway IP Address

How To Renew IP Address

How To Renew IP Address

Recent stories.

What is Building Information Modelling?

What is Building Information Modelling?

How to Use Email Blasts Marketing To Take Control of Your Market

Learn To Convert Scanned Documents Into Editable Text With OCR

Top Mini Split Air Conditioner For Summer

Top Mini Split Air Conditioner For Summer

Comfortable and Luxurious Family Life | Zero Gravity Massage Chair

Comfortable and Luxurious Family Life | Zero Gravity Massage Chair

Fintechs and Traditional Banks: Navigating the Future of Financial Services

Fintechs and Traditional Banks: Navigating the Future of Financial Services

AI Writing: How It’s Changing the Way We Create Content

AI Writing: How It’s Changing the Way We Create Content

How to Find the Best Midjourney Alternative in 2024: A Guide to AI Anime Generators

How to Find the Best Midjourney Alternative in 2024: A Guide to AI Anime Generators

Robots.net

  • Privacy Overview
  • Strictly Necessary Cookies

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Manual Network Configuration in Linux and How to Set a Static IP Address

Last updated: March 18, 2024

how to change computer ip address linux

  • Administration

1. Introduction

Many Linux distributions come with a network manager. In theory, it should help during the networking setup. Yet, we might not always want to install or use managers when setting up an interface. Moreover, a network manager is often just a convenient abstraction or interface to the configuration files of a Linux distribution.

In this tutorial, we look at standard low-level files and tools to configure our IP address settings . We start off by briefly discussing dynamic and static addresses. After picking static IP network configuration as an example, we look at a universal way to perform it under Linux. Next, we explore network managers in detail. Finally, we show our main example in action on multiple Linux distributions.

For brevity, we only use IPv4 instead of IPv6 and static instead of dynamic addresses, but most concepts apply to all variants.

We tested the code in this tutorial on Debian 12 (Bookworm), CentOS Stream 9, Slackware 15.0, Gentoo 2.8, and ArchLinux Rolling (2022.10.01). It should work in most POSIX-compliant environments.

2. Dynamic and Static IP Address

When using a static IP, the operating system (OS) knows that we have two requirements for a given interface:

  • a specific IP address
  • full control over the address assignment

Since the Dynamic Host Configuration Protocol (DHCP) can take the Media Access Control (MAC) address into account when assigning the network-layer address, we might still automatically receive the same IP on each connection with that protocol. Moreover, the client can usually specify a preference.

However, whether we get the same IP address with DHCP might depend on many factors, some of which are external :

  • DHCP server IP reservation
  • same DHCP server
  • unchanged DHCP server configuration
  • same network interface card (NIC) or MAC address

Thus, we give up control of our network-layer address, which may become inconvenient when it’s our sole means to identify a system. For example, switching environments can lead to a new IP. If we don’t have remotely-resolvable hostnames or domain names, we’d need this new IP when using access protocols like SSH. Further, a name (type) on one network could be unrecognizable on another.

On the other hand, a static IP ensures we always assign the same address . Of course, this comes with its own problems:

  • manual settings might not comply with a given environment
  • might have to change configuration depending on the network
  • can lead to IP address conflicts, especially on smaller networks

Still, for stationary machines and the proper administration, a static address is usually more of a convenience than a burden . So, we use that as our example configuration.

3. Static IP on Linux

While there are many managers, graphical user interface (GUI) front-ends, and command-line interface (CLI) utilities for network settings, many boil down to the ip command, which supersedes ifconfig .

Let’s use ip to acquire and set our NIC configuration.

3.1. Current Settings

First, we check our current setup:

Here, we have an IPv4 ( inet ) address of 192.168.6.2 with its associated 192.168.6.255 broadcast and several specifiers. Of the latter, dynamic means the system uses DHCP to set up the connection . Let’s confirm this:

Above, we use grep to case-insensitively filter for dhcp in the system log from the last boot as returned by journalctl . Consequently, we see the setup of our eth1 interface with the address 192.168.6.2 .

3.2. Consider DHCP

In most recent Linux distributions, disabling DHCP comes down to controlling a daemon for the server ( dhcpd ) or client ( dhcpcd ):

However, there are several pitfalls:

  • we might not need to disable DHCP at all if it’s properly configured
  • the daemon name and control mechanisms can vary
  • on older systems, DHCP client calls can instead be in other services
  • custom solutions can provide and force DHCP depending on the Linux distribution

Because of this, how and whether we turn DHCP off depends on the system and our needs.

3.3. Temporary Static IP via ip

Now, let’s use ip to set a static IP on eth1 :

After flushing all addresses and routes from eth1 , we add a new static address and gateway. Next, we verify the settings by confirming that dynamic is no longer present in the interface characteristics. However, a system reboot now would wipe our network setup and restore the IP to what DHCP provides .

3.4. Permanent Static IP via ip

To make the settings we applied remain the same between reboots, we can run a script on startup, which includes the ip lines above, along with any other related commands. Naturally, the exact way depends on the Linux distribution.

4. Network Managers

Using a manager can be critical for complex setups. Yet, even a one-interface machine can benefit from the features network managers provide:

  • seamlessly detect networks
  • automatically configure connections
  • maintain and switch between configuration profiles
  • support multiple protocols, wireless and wired

Critically, network managers are feature-rich abstractions to the network configuration files of a given system . While there are many Linux network managers like Connman , netctl , and wicd , three are ubiquitous:

  • System V (SysV) network(ing) services
  • systemd ‘s systemd-networkd
  • NetworkManager

Since most Linux distributions migrated to systemd , the first of these is now mostly deprecated, although still widely supported. Importantly, SysV network(ing) service configuration files provide the original framework commonly used by other network management solutions .

4.1. Identify Network Managers

Before doing any network configuration on a Linux system, we should identify and disable unused network managers. Thus, it’s usually a good idea to start by checking for any related services:

In this case, we use grep to search for the keyword network in the list of services. While not foolproof, this is a good first step. Consequently, we see NetworkManager is active and running .

4.2. Control Network Managers

We can simply use systemctl to detect and toggle most service-based network managers. For example, we can easily replace one manager with another where available:

Notably, the *-wait-online and other secondary daemons that each solution offers are also part of the packages. While the enable and disable lines are optional, running conflicting services or configurations of any kind is considered bad practice and can lead to severe issues and system instability , especially regarding networking.

Of course, with services of this kind, any setup should be easier to configure and maintain. Adding to that, most managers have a GUI, terminal user interface (TUI), or at least a flexible CLI. Unlike ip , settings from network management tools can persist between reboots.

Now, we move to the most persistent, albeit in part, distribution-specific solutions.

5. Static IP on Debian Distributions

Let’s check the default structure of networking configuration files in Debian derivatives such as Kali , Knoppix , Ubuntu , Raspberry Pi OS , and Tails :

Here, the tree command shows the /etc/network/*.d directories for scripts that run before ( pre ), after ( post ), or while an interface ( if ) goes up or down . Next to them, the /etc/network/interfaces file contains the main network interface configuration, sourcing any files in the /etc/network/interfaces.d .

5.1. Add Interface Configuration

By default, to set a static IP on eth1 under Debian-based systems, we add a block to /etc/network/interfaces and remove any other configuration related to eth1 :

Let’s break down the meaning of this block:

  • auto eth1 enables automatic configuration for this interface during boot
  • iface eth1 inet static sets eth1 as an IPv4 interface with a static address
  • address , netmask , and gateway assign the respective addresses and network
  • dns-nameservers , while not strictly necessary, sets the DNS servers to use

Of course, we can add more options like pre-up /etc/network/if-pre-up.d/secure.sh , which utilizes a script in the if-pre-up.d directory from earlier. Now, we’re ready to apply our configuration.

5.2. Restart Networking or Interface

At this point, we just need to restart networking via SysV with /etc/init.d/networking (deprecated, not recommended), systemd , our network management tool, or directly for changes to take effect , depending on the system version:

Basically, the last command uses the legacy ifupdown package to only toggle the particular interface.

However, NetworkManager can also handle the native Debian network setup files . Importantly, the method of choice depends more on the version of the system and less on our preferences.

5.3. Confirm Setup

Finally, we can verify the new settings:

Here, we see our changes are in effect via ip .

6. Static IP in RedHat and Other RPM Distributions

Again, we start by briefly looking at the network setup files in RedHat , SUSE , openSUSE , Fedora , CentOS , Oracle Linux , and other RPM-based Linux versions:

By utilizing the -P flag of tree , we can filter only network-related items in the /etc/sysconfig directory. In particular, /etc/sysconfig/network contains global options for all interfaces, while /etc/sysconfig/network-scripts/ifcfg-IFNAME files are responsible for configuring interface IFNAME .

However, since version 9 of RHEL, CentOS, Fedora, and other RPM-based distributions, ifcfg configuration files have been deprecated in favor of so-called keyfiles . This is also indicated by /etc/sysconfig/network-scripts-readme-ifcfg-rh.txt file:

Notably, keyfiles require the NetworkManager to function correctly.

6.1. network-scripts and NetworkManager

The SysV-based network-scripts package contains tools and scripts for different functions:

  • /etc/init.d/network script to stop, start, and restart network components
  • ifup* , ifdown* , and other /etc/sysconfig/network-scripts directory scripts
  • ifup and ifdown native tools for interface state toggling
  • usernetctl native command for general network configuration

In the case of RedHat and other related distributions, their newer versions have deprecated network-scripts in favor of NetworkManager .

To that end, some tools and scripts are either not available or have become wrappers for nmcli command lines. Consequently, for recent versions of RPM-based distributions, it’s usually best to leave NetworkManager installed, enabled, and started .

As an alternative, we might still be able to install the network-scripts package in its place, but that’s not recommended . If we do go that route, we must stop and disable NetworkManager via systemctl stop NetworkManager NetworkManager-wait-online, and systemctl disable NetworkManager NetworkManager-wait-online .

All of the above means that, while the interface settings files have mostly remained unchanged, their default processing has.

6.2. Create Interface Configuration File

After considering the network setup mechanisms, to configure eth1 with a static IP on RPM distributions, we can simply add the necessary options in a deprecated /etc/sysconfig/network-scripts/ifcfg-eth1 file :

As before, let’s check what the options mean:

  • DEVICE=eth1 ensures we have the correct interface name
  • BOOTPROTO is dhcp for DHCP, but our static configuration doesn’t require any protocol, so we use none
  • ONBOOT=yes , similar to Debian’s auto , indicates the interface should be activated on boot
  • IPADDR , NETMASK , GATEWAY , and BROADCAST are all set to their respective values for our static address
  • DNS1 and DNS2 optionally set DNS servers
  • USERCTL=no prevents non-superusers to control the interface
  • NM_CONTROLLED=no stops NetworkManager from managing the interface

Of course, there are many other settings .

Alternatively, we can use the NetworkManager keyfiles instead . Let’s see an equivalent of the above in the new format:

Further, as indicated in /etc/sysconfig/network-scripts-readme-ifcfg-rh.txt , we can migrate all connections from the deprecated ifcfg format to the new keyfile format:

Notably, many keyfiles fields are the same in ifcfg files, while others are similar.

In addition, having to use NetworkManager for keyfiles means nmcli can perform our configuration directly :

This provides the added benefit of syntax checking.

6.3. Restart Networking or Interface

Naturally, the changes are applied once we restart the networking .

There are two main options for that:

  • with systemd
  • directly via network-scripts with /etc/rc.d/init.d/network (deprecated, not recommended)

By default, we’d use nmcli or the NetworkManager service:

Alternatively, we can employ nmcli and keyfiles to just manage the specific interface:

If we have them disabled, we can use basic tooling:

Once again, the last command only restarts eth1 . Also, the method of choice depends on the version of the system and our needs.

6.4. Confirm Setup

Now, we can confirm eth1 has the correct settings:

Here, we see that our interface has a static IP address.

7. Static IP in Slackware Distributions

In Slackware and its related distributions like Slax and Absolute Linux , the system startup goes through the original /etc/rc.d network file framework:

  • /etc/rc.d/rc.inet1
  • /etc/rc.d/rc.inet1.conf
  • /etc/rc.d/rc.inet2

Of these, /etc/rc.d/rc.inet1 ensures we have a network, while /etc/rc.d/rc.inet1.conf sets the properties of our interfaces .

7.1. Disable Network Managers

Indeed, recent Slackware versions often come with NetworkManager by default . Still, external network management solutions can interfere with our manual settings or add more on top of them. Because of this, we stop and disable NetworkManager and any other similar services:

At this point, we can move on with the internal network setup mechanism.

7.2. Modify Interface Configuration

Basically, to configure a static IP address for eth1 on Slackware-based distributions, we can simply replace or add options for that interface in /etc/rc.d/rc.inet1.conf :

Notably, the matching numbers ( 0 ) within square brackets indicate settings for the same interface . Also, unlike other methods, there are no options for DNS servers, as Slackware uses only /etc/resolv.conf by default. Of course, we don’t set values for DHCP options.

7.3. Restart Networking

In Slackware-based Linux versions, the built-in networking restart mechanism is the /etc/rc.d/rc.inet1 script:

Now, we can confirm our new settings:

Conveniently, Slackware-based distributions also include the netconfig tool . It provides an interactive way to configure most network settings.

8. Static IP in Gentoo Distributions

Because Gentoo and its family are commonly source-based and highly flexible, we can perform their initialization process with many init systems.

By default, it’s the OpenRC init system, very similar to Slackware’s. Further, Gentoo uses Netifrc as its default integrated network configuration framework :

  • /etc/conf.d/net for general interface setup (usually created by an administrator)
  • /etc/init.d/net.lo and /etc/init.d/net.* scripts to control interfaces

Because of this, interface setup means editing /etc/conf.d/net and creating the related service script for that interface . Of course, keeping with the general philosophy of Gentoo, we can remove or ignore the netifrc package in favor of external managers.

8.1. Add Interface Configuration

By default, to set a static IP on eth1 on Gentoo-based systems, we modify /etc/conf.d/net with our settings :

Here, options refer to the interface name with a suffix. The configuration is similar to the options of ip .

Next, to control the interface, we have to create a respectively-named script by making a symbolic link with ln to /etc/init.d/net.lo :

In case /etc/init.d/net.lo is missing, we can acquire it via emerge :

Thus, we restored /etc/init.d/net.lo .

8.2. Restart the Interface

At this point, we are ready to start or restart our interface service net.eth1 with the new configuration:

Usually, the warning can safely be ignored.

To apply the settings on each restart, we add the script via OpenRC’s rc-update :

Further, we can do the same via systemctl where available:

Similar to Slackware’s netconfig , Gentoo includes the net-setup script for interactive network configuration.

9. Static IP in ArchLinux Distributions

Since ArchLinux is built from scratch, its family, including Manjaro and others , usually doesn’t provide its own network configuration framework. Instead, they integrate and leverage the framework of systemd-networkd by default:

This is more or less in contrast with Gentoo. Essentially, we can set a static IP in ArchLinux via systemd-networkd by creating a /etc/systemd/network/eth1.network file :

Now, we just disable DHCP and restart systemd-networkd :

At this point, we should have the correct static IP on eth1 .

10. Summary

In this article, we looked at network configuration under many different Linux distributions, with the main example of setting a static IP address.

In conclusion, while the way we configure our network setup can vary widely between Linux versions, there are also universal ways to perform it.

ServerLog Header Logo

How to Change IP address in Linux

This post will discuss a step by step procedure of changing, adding and removing IPv4 and IPv6 address in RedHat and Debian based Linux distributions. As most of the server lacks Graphical User Interface only command line methods are configured here. We’ve used “nano” command line editing tools as “root” user. Use your suitable command line editor and prefix “sudo” to commands if you are not “root” but have “sudo” right to edit configuration file, alter and restart network interfaces. 

Difficulty: Easy           Time Required: Less than 5 minutes

Step 1: Identifying the network interface device

“ifconfig” display all available network interfaces. By default it’s installed, but if not, it must be installed from “base” repository using the following command

CentOS or RHEL

Debian and Ubuntu

Following is a sample output of ifconfig from CentOS 7.2 

ifconfig output from CentOS 7

In above configuration currently two network interface devices are present. ”eth0” and ”lo”. The interface “lo” stand for loop back device and act as interface for “localhost” that is t communicate within the device itself. So the primary interface device is “eth0” here. In your case this may be venet0 or anything else . 

Step 2: Changing IP address for desired interface. This can be achieved in two different way viz. using shell command or editing configuration file.

Problem with this method is those added or deleted IP addresses are not permanent in system and get deleted whenever the network interface is restarted or the system is rebooted

Editing Configuration file : A static IP address must be permanently added by editing configuration file. IP address added hence never get deleted on network restart or system reboot. This methods differ from RedHat to Debian based system and both are discussed bellow

ifcfg-eth0 file sample

  • DEVICE= Device Name, i.e. eth0 here
  • NM_CONTROLLED= The device is controlled by Network Manager or not. Keep it yes, else restarting network may not apply changes made on the file
  • BOOTPROTO= Options are “dhcp”, “static”. “dhcp” indicated IP address will be auto assigned to the device from ISP’s DHCP server. “static” means manually added static IP address
  • IPADDR=  This is the persistent static IPv4 address of your system. Change it with your desired IP address  to change the IPv4 of your system. Warning: Using an IP address that doesn’t assigned to you by your ISP will break network connectivity.
  • ONBOOT= “yes” indicate the device will start on system startup, “no” will do the reverse.
  • GATEWAY= IPv4 address of your ISP’s Gateway router (Provided by ISP)
  • IPV6INIT=”yes” indicates the Linux kernel will allow IPv6 connectivity for that device. “no” will break IPv6 connectivity for that device.
  • IPV6ADDR=””2001:470:1f06:1302::2/64″ indicates the present IPv6 address of the system. Change it with new IPV6 address.
  • IPV6_AUTOCONF=”no” indicates IPv6 Gateway will not be auto-configured by system. (I may be wrong here)
  • IPV6_DEFAULTGW=”fe80::1″ indicates the IPv6 address of your ISP’s gateway router.
  • IPV6_FAILURE_FATAL=”no” indicates if the system is unable to assign that IPv6 address to your device network will continue with IPv4 connectivity. Option “yes” will break network connectivity of the device “eth0” here in case of an IPv6 failure.
  • IPV6ADDR_SECONDARIES=”2a02:c207:2009:5972::200/64 2a02:c207:2009:5972::2001/64″ This define multiple extra IPv6 address in the system. Addresses are to be separated by space. And the entire value must be quoted . This is not mandatory for any other values in the configuration file. For outgoing connection system will use the last IPv6 address mentioned in this field, unless otherwise specified by outgoing traffic sending applications configuration file.

Now restart network using the following command to effct the modified configuration file.

ifaces configuration in debian

  • auto venet0:0 indicate name of the device, here “venet0:0”

Now restart network using the following command to make the change effect

Step 3: Testing the configuration: Use ping and ping6 to check newly added IPv4 and IPv6 address

If all configurations are correct you will get like following figure

ping and ping6 test for newly added IPv4 and IPv6

For any confusion or wrong explanation please leave a comment or email to admin at “admin”@”serverlog.net” or write author directly to “authorname”@”serverlog.net”. ServerLog welcome all to write here. For more please mail to Serverlog Admin. Thank you for reading us.

Visits: 583

  • What is a Daemon Process in RedHAT
  • How to Synchronize IIT Bombay gpo with Gmail

You May Also Like

Internet not working Cartoon Picture

Why Internet Connection is not Working 30 Reasons Explained

Restart rooted android device without power button steps image

How to restart Android phone without pressing power button (root required)

how to change computer ip address linux

How to rent Zoomcar PEDL cycle in IIT Bombay (with pictures)

Leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

Tecmint: Linux Howtos, Tutorials & Guides

How to Set Static IP Address and Configure Network in Linux

If you are a Linux system administrator, time will come when you will need to configure networking on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to setup a static IP address (at least in most cases).

Read Also: How to Set or Change System Hostname in Linux </p

This article is meant to show you how to configure static IP address on most frequently used Linux distributions.

For the purpose of this tutorial, we will use the following Internet Protocol version 4 (IPv4) details:

Configure Static IP Address in RHEL/CentOS/Fedora:

To configure static IP address in  RHEL / CentOS / Fedora , you will need to edit:

Where in the above "ifcfg-eth0" answers to your network interface eth0 . If your interface is named “ eth1" then the file that you will need to edit is "ifcfg-eth1" .

Let’s start with the first file:

Open that file and set:

Note : Make sure to open the file corresponding to your network interface. You can find your network interface name with ifconfig -a command .

In that file make the following changes:

You will only need to edit the settings for:

  • DNS1 and DNS2

Other settings should have already been predefined.

Next edit resolve.conf file by opening it with a text editor such as nano or vi :

Once you have made your changes restart the networking with:

Set Static IP Address in Debian / Ubuntu

To setup static IP address in Debian / Ubuntu , open the following file:

You may see a line looking like this:

Change it so it looks like this:

Save the file and then edit /etc/resolv.conf like this:

Restart the networking on your system with:

Your static IP address has been configured.

Conclusion:

You now know how to configure a static IP address on a Linux distro. If you have any questions or comments, please do not hesitate to submit them in the comment section below.

Previous article:

Next article:

Photo of author

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Related Posts

Send Mail From Linux Terminal

Mutt – A Command Line Email Client to Send Mails from Terminal

dpkg Command Examples

15 Useful ‘dpkg’ Commands for Debian/Ubuntu Users

Advance Commands for Linux Experts

Sysadmins & DevOps: 20 Must-Know Advanced Linux Commands

Unmount USB Drive in Linux

How to Safely Eject a USB Drive in Linux

Make File and Directory Undeletable in Linux

How to Make File and Directory Undeletable, Even By Root in Linux

Understanding Different Linux Shell Commands

5 Different Types of Shell Commands and Their Usage in Linux

34 Comments

There isn’t an “eth0” on my server because it is connected by WIFI only.

@Thuemaychuaonet,

If your server is connected only via WiFi, the network interface will likely have a different name, such as ` wlan0 ` or something similar, depending on your system and its configuration.

The steps to set a static IP address and configure the network are similar, but you’ll need to use the correct interface name for your WiFi connection.

You can find the name of your WiFi interface by running the ` ip a` command in the terminal. Once you have the correct interface name, you can follow the same process to configure your network settings.

The time will come when you will need to configure networking on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to set up a static IP address (at least in most cases).

Terrible – and my ‘ linux distro ‘ isn’t the same as yours, there’s no ‘ /etc/sysconfig/ ‘ folder.

In Ubuntu 20.04 there is no interfaces file they switch to netplan . If you can update this article to include the new change it will help a lot.

thanks Raouf

Well, this isn’t correct. Just trashed my Linux mint distro

Is it public Static IP? or can I use to access data from other networks?

Failed to restart network.service: Unit network.service not found.

I’m asking a question on a fairly old thread, but just in case, is it possible to do this on a WIFI network?

For example, when using the first command (# nano /etc/network/interfaces ) in Ubuntu, the result I see is:

There isn’t an “ eth0 ” on my server because it is connected by WIFI only. Will it still work using another option?

Yes it will work I think so, just change the settings in the interfaces file as explained in this article.

I set the static IP in ifcfg-eth0, added HWADDR and UUID, but on reboot system does not associate the IP to eth0.

This is VM. Any idea why its happening and steps to troubleshoot.

I think you need to make sure that you select “ manual ” and the correct IP address, subnet mask, and gateway and save the configuration as explained in the article. Also, I personally would select a new and different IP address, so that you can really check if it has been saved by opening the terminal and typing:

after a restart.

If i set ip address as static am not able to ping google.com why and also packages are not installed.

Please give me reply as soon as possible.

@Rajeshkar,

Please add the DNS Name servers in your /etc/resolv.conf file..

@Ravi Saive thanks for your reply , yes i did /etc.resolv.conf also but getting the same problem

@Rajesekar,

The file is /etc/resolv.conf , in this file add your DNS name servers for example.

When I enter the /etc/resolv.conf file, what is it supposed to look like? And when you say “edit” do you mean delete what’s there and write what you’ve provided, or just add new lines?

Hello Marin, Thank you very much for this article. It was a major help in my class project. This is my first time using a vm and it is an awesome learning experience. I’m really glad I ran into this article, it was well written and easy to follow.

Just wanted to say a million thank you’s for this well-written, comprehensive and easily-understood article! Awesome stuff! A real lifesaver too, as I had to quickly configure a static IP for myself to get access to remote computing. Thank you! :-D

A question from a linux newbie. Does this instruction apply for both ubuntu running on my desktop PC as well as debian linux on an embedded board?

Yes, the instructions will works on any Debian/Ubuntu based distribution without any issues..have you tried on your embedded board? does these instructions worked? let us know.

Hi Ravi, thanks for your reply.

Default the folder /etc/sysconfig does not exist on my embedded system. Of Course i could create it as well as the files mentioned, but it would be out of the context of this instructions.

Thanks, Rob

I found here very good stuff! You are doing an excellent job and I like your site! Thanks!

Thanks for finding this site very useful and thanks for appreciating our work, Keep visiting for more such useful articles…

Great job, I was I actually looking for an article like this one. So thank you so very much. Keep up the good work.

Thanks for appreciating and finding this article useful, keep connected to Tecmint for such wonderful articles…:)

What if I have 2 NICs on my server one for LAN & one for WAN and I want to set one of them (WAN) as default gateway? How to configure this server as gateway and as a router.

The easiest way to add default gateway using route command as shown:

Don’t forget to replace the gateway IP address and interface-name in the above command.

One can also use following command to setup static IP on eth0 interface for example. # ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up # route add default gw 192.168.0.1 # service network restart

Thanks for the tip, but I think setting IP address directly from the commandline using ifconfig and route will only allow you to set temporarily, once you reboot, these settings disappears. So, the best option to set static IP address permanently in network configuration files only….

wipe on reboot, so that best option is to set permannetly

Hello Ravi, What is difference between the service “NetworkManager” and “network”

@Augustine,

This article will help you to understand the difference between and NetworkManager and Network: http://askubuntu.com/questions/1786/what-is-the-difference-between-network-manager-and-ifconfig-ifup-etc

Why do we need to specify DNS in both ifcfg-eth0 and resolvlf.conf?

Hello Augustine,

Actually if you have added the DNS servers in the ifcfig-eth0 file the DNS servers will be automatically added to /etc/resolv.conf. You can skip defining the DNS servers in the ifcfig-eth0 file, but then you will need to have them set in /etc/resolv.conf manually. It’s a good practice to make sure that the DNS servers are specified correctly in both files, this is why the article says to set them in both files.

Got Something to Say? Join the Discussion... Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Save my name, email, and website in this browser for the next time I comment.

  • Generative AI
  • Office Suites
  • Collaboration Software
  • Productivity Software
  • Augmented Reality
  • Emerging Technology
  • Remote Work
  • Artificial Intelligence
  • Operating Systems
  • IT Leadership
  • IT Management
  • IT Operations
  • Cloud Computing
  • Computers and Peripherals
  • Data Center
  • Enterprise Applications
  • Vendors and Providers
  • Enterprise Buyer’s Guides
  • United States
  • Netherlands
  • United Kingdom
  • New Zealand
  • Newsletters
  • Foundry Careers
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Copyright Notice
  • Member Preferences
  • About AdChoices
  • E-commerce Affiliate Relationships
  • Your California Privacy Rights

Our Network

  • Network World

sandra_henrystocker

Changing IP addresses on Linux systems

ITworld.com –

Changing the IP address on a Linux system involves both changing the IP address using the ifconfig command and modifying the files that will make your change permanent. The process is very similar to the process you would follow on a Solaris system, except that a different set of files must be modified. The proper steps to take also depend on the particular Linux distribution you are using. Debian systems, for example, use different files to store network configuration than do RedHat systems.

For starters, we use the ifconfig command to modify the active IP address. A command like this makes the change:

The ifconfig -a command will list the current settings as well as confirm that your network device is (or is not) eth0.

If the system needs to have its IP address changed, it may be joining a different subnet. If so, it will need to have its default route switched as well. Be careful when changing default routes not to break the connection that you are using to make the changes. Either make this change via a console connection or otherwise ensure that your connection to the system is not broken before you have completed your work.

The files you need to modify to make the IP address change permanent include the /etc/hosts file and the file in the /etc/sysconfig/network-scripts directory that sets up the parameters for the particular network interface. Typically, it is the /etc/sysconfig/network-scripts/ifcfg-eth0 file that needs to be modified. This file contains information that describes the network interface, including the IP address, netmask and MAC address. This file also indicates whether the IP address is static or assigned by DHCP. Here’s an example of the file when a static IP address is used:

If you do not have an /etc/sysconfig directory, your network configuration parameters might be stored instead in a file named /etc/network/interfaces — as it is on Debian, Ubuntu and related distributions. That file will have a similar look to what is shown in the example below.

The script below could be used to both detect the files to be modified and then make the required changes. Notice that it expects the old and new IP addresses along with an optional new default route. The script does no checking of the arguments, so they must be added in the correct order.

This script will not move you to a static address if you are currently obtaining your IP address through DHCP.

Related content

Microsoft’s team copilot aims to help manage meetings, group chats, windows recall lets you rewind actions on a pc, windows 11 insider previews: what’s in the latest build, adobe express enterprise is where iwork could boldly go, from our editors straight to your inbox.

sandra_henrystocker

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.

More from this author

30 years as a sysadmin, ack what’s using up all my disk space, laas (linux as a service): what to expect when you build a linux server in the cloud, review: the gnu make book, most popular authors.

how to change computer ip address linux

Show me more

Adobe lightroom gets first firefly feature — generative remove.

Image

Microsoft launches AI-powered Copilot+ PCs

Image

What happens when genAI vendors kill off their best sources?

Image

Why are people still bad at video calls?

Image

Will new AI tools create a better Siri or voice assistant?

Image

Is AI crushing creativity, or creating mediocrity?

Image

IMAGES

  1. How to Change IP Address in Linux

    how to change computer ip address linux

  2. How to configure IP address in Linux

    how to change computer ip address linux

  3. Set IP Address in Linux

    how to change computer ip address linux

  4. How to Change IP Address in Linux

    how to change computer ip address linux

  5. How To Change Your IP Address In Linux

    how to change computer ip address linux

  6. How To Change IP Address on Linux

    how to change computer ip address linux

VIDEO

  1. How to Set A Static IP Address on Linux

  2. HOW TO CHANGE IP ADDRESS IN KALI LINUX USING TORGHOST

  3. Linux

  4. Find Computer Name from IP address #shorts #viral #shortvideo

  5. Change IP Address/ MAC Address & More..

  6. Cara Setting IP Address Linux Debian 8

COMMENTS

  1. How to Change IP Address in Linux

    The ip command is available on most Linux distributions. For setting an IP address, use it like this: ip addr add [ip_address] dev [interface] For example, add an IP address to the eth1 interface as: sudo ip addr add 192.168.56.21/24 dev eth1. You now have two IP addresses: one from the old configuration and one from the new command:

  2. How To Change IP Address on Linux

    To change your IP address on Linux, use the "ifconfig" command followed by the name of your network interface and the new IP address to be changed on your computer. To assign the subnet mask, you can either add a "netmask" clause followed by the subnet mask or use the CIDR notation directly.

  3. 3 Ways to change ip address in Linux

    Open the terminal application. List the current IP addresses for all network interfaces with command ifconfig -a. Take the network interface down with command: ifconfig <interface> down. Change the IP address with command ifconfig <interface> <ip address> <netmask>. Press Enter to run the command.

  4. How to Assign an IP Address on a Linux Computer (with Pictures)

    No matter what version of Linux you're running, you'll need to open the Terminal and switch to root. In Debian, Ubuntu, and Linux Mint, use the "ipconfig" command to view your Internet items. Find the item you want to assign an IP address to, then type "sudo ipconfig [name] [ipaddress] netmask 255.255.255. up".

  5. How to Change Your IP Address From the Command Line in Linux

    To get started, type. ifconfig. at the terminal prompt, and then hit Enter. This command lists all network interfaces on the system, so take note of the name of the interface for which you want to change the IP address. To change the settings, you also use the ifconfig command, this time with a few additional parameters.

  6. How to Use the ip Command on Linux

    The ip command has replaced the older ifconfig command in modern versions of Linux. The ip command allows you to configure IP addresses, network interfaces, and routing rules on the fly without rebooting. Run "ip addr" in the Terminal to get your PC's local IP address. You can configure IP addresses, network interfaces, and routing rules on the ...

  7. How to Set a Static IP Address in Ubuntu

    Set a Static IP in Ubuntu with the GUI. Click the icons at the far-right end of the system bar to show the system menu, then click on the "Wired Connected" menu option. If you're using a wireless connection, instead click the name of your Wi-Fi network. The available connections are displayed.

  8. How to Change IP Address Linux [3 Effective Methods]

    To change IP address in Linux, you have options that suit your preferences. For advanced users and scripting, the ifconfig command provides command-line control. Network Manager offers a user-friendly graphical interface, while the ip command provides extensive network configuration capabilities. 1. Using the ifconfig Command. This method ...

  9. How To Change IP Address Linux

    Replace [interface-name] with the name of the network interface you identified in step 3. Replace [new-IP-address] with the new IP address you want to assign to the interface. Replace [netmask] with the appropriate netmask for your network. Verify the changes by running the ifconfig command again.

  10. Linux change ip address

    Task: Change IP address. You can change ip address using ifconfig command itself. To set IP address 192.168.1.5, enter command: # ifconfig eth0 192.168.1.5 netmask 255.255.255. up. # ifconfig eth0. To make permanent changes to IP address you need to edit configuration file according to your Linux distribution.

  11. Manual Network Configuration in Linux and How to Set a Static IP Address

    a specific IP address; full control over the address assignment; Since the Dynamic Host Configuration Protocol (DHCP) can take the Media Access Control (MAC) address into account when assigning the network-layer address, we might still automatically receive the same IP on each connection with that protocol.

  12. Ubuntu Change IP

    To change IP address select Wired or wireless connection and click on properties button: Click on OK > Close to save the changes. ... Ubuntu Linux Change Hostname (computer name) How to change root password in Ubuntu Linux; How to change theme in Ubuntu 16.04/17.10;

  13. How to Configure Static IP Address on Ubuntu 20.04

    Depending on the interface you want to modify, click either on the Network or Wi-Fi tab. To open the interface settings, click on the cog icon next to the interface name. In "IPV4" Method" tab, select "Manual" and enter your static IP address, Netmask and Gateway. Once done, click on the "Apply" button.

  14. How to Change IP Address on Linux (Terminal Commands)

    Tutorial shows you, how to change IP address on Linux using terminal commands (set a static IP in Linux), Set IP address, Default Gateway and DNS server manu...

  15. How to Change IP address in Linux

    Step 2:Changing IP address for desired interface. This can be achieved in two different way viz. using shell command or editing configuration file. Using Shell Command: This is rather easy method for adding and deleting IP address. Different command line tools like "ifconfig", "ip addr" may be used. This commands are mostly operating ...

  16. Linux ip Command with Examples

    For example, to bring the interface eth0 online, you would type:. ip link set eth0 up. And to bring if offline. ip link set eth0 down Displaying and Altering the Routing Table #. To assign, remove, and display the kernel routing table use the route object. The most commonly used commands when working with the routes objects are: list, add, and del. Display routing table #

  17. How to Set Static IP Address and Configure Network in Linux

    If you are a Linux system administrator, time will come when you will need to configure networking on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to setup a static IP address (at least in most cases). Read Also: How to Set or Change System Hostname in Linux</p

  18. Change IP address on Ubuntu Server

    You have two options when configuring the IP address on your Ubuntu Server, and that is either a static IP address or DHCP. A static IP address allows you to manually select your IP address by configuring it on the Linux system, whereas DHCP relies on the router or DHCP server to lease you an IP address - either a reserved one or the next available one that is currently free, depending on ...

  19. How to Update Ubuntu IP and Hostname via Bash

    To execute the script, run the below command to invoke the script with bash in your terminal. sudo bash ~/host_deploy.sh. The script prompts you to enter a new hostname and IP address information and reminds you to reboot the host for the changes to take effect.

  20. Changing IP addresses on Linux systems

    Changing the IP address on a Linux system involves both changing the IP address using the ifconfig command and modifying the files that will make your change permanent. The process is very similar ...

  21. How to Change the IP Address on Debian 12

    What are the Methods to Change the IP Address on Debian 12. Method 1: Change IP Address Using the ifconfig Command. Method 2: Change IP Address Using the ip address Command. Method 3: Change IP Address Using the nmtui Tool. Method 4: Change IP Address Using the nmcli. Method 5: Change IP Address Using the GUI Method.

  22. How to Find/Get your IP Address in Linux

    192.168../16. You can determine your system private IP address by querying the network stack with commands such as ip, ifconfig or hostname. In Linux, the standard tool for displaying and configuring network interfaces is ip . To display a list of all network interfaces and the associated IP address type the following command:

  23. How to set the IP address from C in linux

    The "correct" way to do it is to spawn a copy of the iproute2 "ip" program (in /sbin/ip ) with relevant parameters. the ioctl interface is generally obsolescent and doesn't allow you to configure all parameters (for example, un-named IP aliases).