• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Web Hosting Resource Kit

Web Hosting, Web Hosting Reviews & Virtualization

  • Contact
  • About Us
  • Privacy Policy

This post may contain affiliate links. If you use these links to buy something we may earn a commission. Thanks.

Linux Tutorial: How to change the IP ADDRESS on a Linux machine

June 2, 2007 By Christoph Puetz Leave a Comment

  • Tweet
  • Sumo
  • Tweet

Linux Tutorial: How to change the IP ADDRESS on a Linux machine

Sometimes you run into situations where you need to change the IP addresses on a Linux server. If you are a “Windows” or “GUI” person, you might feel lost when you have to change the IP address of a Linux machine from the command line. But no worries, the actual process of changing the IP address is not that hard. Here is how it works:

Login to your server (preferrably via console or SSH) and switch to the root user

Now open the network configuration file. For this example we will use the default NIC (eth0).

#root: vi /etc/sysconfig/network-scripts/ifcfg-eth0

Your screen output will look like this

Now modify the configuration by using the “i” command to insert information. When you are done updating the file, hit “ESC” and save the settings with “:w” and exit out with “:x”. The file has now been modified, but the changes have not been loaded yet. Next we want to change the host name and the default gateway of the machine. From the root prompt type the following:

#root: vi /etc/sysconfig/network

The screen output will look like this:

Now modify the configuration by using the “i” command to insert your new hostname and gateway information. When you are done updating the file, hit “ESC” and save the settings with “:w” and exit out with “:x”. And again – the network configuration file has now been modified, but the changes have not been loaded yet.

The best way to have the changes take effect is to reboot the server if that is possible. If you are connecting remotely you want to make preparations to be able to connect again to the server. Make sure that the network switch supports the assigned IP address and gateway as otherwise your connection will fail. Send the server for a reboot with the following command:

#root: reboot

A second option is to restart the networking component, but sometimes a reboot is the better option when changing the IP address of a Linux server. On the command prompt type the following:

#root: service network restart

If all went well the server comes back with the new ip address and host name that you assigned.

Need a Cheap Web Host? Check out my list of affordable web hosting companies and the reviews I have written.

Related posts:

  1. Linux Runlevels
  2. Apache HTTP Web server configuration Tutorial
  3. How to change File Permissions from the command line?
  4. How to check the disk space on a Linux server?
  5. Apache Webserver – A quick tutorial for new Admins
  6. Automating Tasks in Linux using Cron
  7. How to check the port speed and duplex setting (Linux)?

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Categories

  • Business Management
  • Editors Column
  • Hosting Customers
  • Interviews & PR
  • Marketing/Advertising
  • Online Marketing/SEO
  • VMWare
  • Web Host Startup
  • Web Hosting
  • Web Hosting Reviews

Pages

  • About Us
  • Contact
  • Disclosure Policy
  • Privacy Policy
  • Sitemap
  • Terms of Service
  • Welcome to Web Hosting Resource Kit

Copyright Webhostingresourcekit.com© 2022 · Log in