TCP/IP Configuration  «Prev  Next»

Lesson 8 Changing your IP address
Objective Use ifconfig command to change IP address

Change machine's IP address in Unix

For administrators managing servers running Ubuntu Linux 20.04, the `ip` command from the `iproute2` suite is the modern, authoritative tool for changing the IP address of network interfaces. The `ip` command offers a comprehensive set of functionalities to manage network interfaces, routes, and more, effectively replacing older tools like `ifconfig`. To change the IP address of a network interface on a server running Ubuntu 20.04, an administrator would use the `ip addr` subcommand followed by `add` to assign a new IP address and `del` to remove the old one, if necessary. The process typically involves these steps:
  1. Remove the Existing IP Address (if replacing an existing configuration):
    ip addr del <Current-IP-Address>/<Netmask> dev <Interface-Name>
    

    For example, to remove the IP address `192.168.1.100` with a netmask of 24 (equivalent to 255.255.255.0) from the `eth0` interface, the command would be:
    ip addr del 192.168.1.100/24 dev eth0
    
  2. Assign the New IP Address:
    ip addr add <New-IP-Address>/<Netmask> dev <Interface-Name>
    

    To assign a new IP address, say `192.168.1.200` with a netmask of 24, to the `eth0` interface, the command would be:
    ip addr add 192.168.1.200/24 dev eth0
    

It's important to ensure that the new IP address does not conflict with existing devices on the network to avoid IP address duplication issues. Additionally, after changing the IP address, the administrator may need to update the server's DNS settings and ensure that any relevant firewall rules are adjusted to accommodate the new IP configuration. The `ip` command is favored for its direct control and immediate effect, making it suitable for both temporary changes and scripting. For permanent changes that persist across reboots, administrators should also update the network configuration files in `/etc/netplan` on Ubuntu 20.04, applying the changes with `netplan apply`. This approach ensures that network configurations are both immediately effective and durable, providing a robust solution for managing network settings on Ubuntu Linux servers.

Changing the IP Address on an RS6000 Running AIX Using `ifconfig`

The IBM RS/6000, often just called the RISC System/6000, is a family of RISC-based UNIX servers, workstations, and supercomputers. AIX (Advanced Interactive eXecutive) is the UNIX-based operating system that runs on these systems. One of the foundational tasks that administrators might need to perform on an AIX-based system is changing the IP address. Here's how you can achieve this using the `ifconfig` command:
  1. Prerequisites:
    • Root Access: Ensure that you have root privileges. The changes to the network interface configuration require superuser rights.
    • Backup Current Configuration: Before making changes, it's prudent to back up the existing network configuration.
  2. Procedure:
    • Check Current Configuration: First, to review the current IP configuration, use:
      	ifconfig -a
      	
  3. Change IP Address: Suppose the network interface you wish to change is `en0` and you want to change its IP address to `192.168.1.100`. Use the following command:
    	ifconfig en0 192.168.1.100 netmask 255.255.255.0 up
    	
    Here:
    • en0: The name of the network interface.
    • 192.168.1.100: The new IP address.
    • 255.255.255.0: The netmask for the IP address.
  4. Update the System Configuration: The `ifconfig` command change is temporary. To make it permanent, you need to update the ODM database, which is a configuration database in AIX. Modify the `/etc/hosts` file to reflect the new IP address:
    echo "192.168.1.100    my_hostname" >> /etc/hosts
    
  5. Restart the Network Service: After making the changes, restart the network service to ensure they take effect:
    refresh -s inetd
    
  6. Validation: After making the changes, you should validate that they have been applied correctly:
    • Ping Test: Use the `ping` command to check the network connectivity:
      		ping 192.168.1.100
      		
  7. Review New Configuration: Re-run the `ifconfig -a` command to verify the new settings.

Changing the IP address on an RS6000 running AIX using the `ifconfig` command requires both immediate changes and updates to the system's configuration to ensure permanence. Always exercise caution when modifying network configurations, ensuring you have backups and that the new IP address doesn't conflict with other devices in the network.


Use the ifconfig command to change a machine's IP address
The IP address of a system is set during the boot process.
Buried in the initialization scripts are the necessary ifconfig commands.
These commands are properly written based on the initial system configuration, created when the system is installed.
You can use the ifconfig command to assign an address to a network interface and to configure or display the current network interface configuration information. The ifconfig command must be used at system startup to define the network address of each interface present on a machine. After system startup, it can also be used to redefine an interface's address and its other operating parameters. The network interface configuration is held on the running system and must be reset at each system restart. Changing the IP address of an already running system is not always straightforward. On AIX and Linux, graphical tools make this fairly straightforward:
(AIX)
host# smit mktcpip

(Linux)
host# control-panel

Solaris

On Solaris, the IP address is obtained indirectly. Suppose the interface on the machine is named hme0. Solaris has a file named /etc/hostname.hme0, which contains the name of the machine, as referenced in /etc/hosts. The command in the startup script uses the following procedure:
  1. Extract the contents of /etc/hostname.hme0 (a machine name).
  2. Call ifconfig with that machine's name (which is converted to an IP address using /etc/hosts).
To change the machine's IP address, you must change the IP address assigned to your machine by name in the /etc/hosts file. (Of course, you need to reboot for this change to take effect.)

Ping Program

All you need to know is that the ping program is a basic troubleshooting tool used to test physical connectivity between two hosts. In its simplest form, the ping command takes the form:
Ping is covered in more detail later in this course.
host$ ping machine_name
host$ ping ip_address

SEMrush Software 8 SEMrush Banner 8