| Lesson 8 || Changing your IP address |
| Objective || Use ifconfig command to change IP address |
Change a machine's IP address in Unix
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
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:
host# smit mktcpip
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:
- Extract the contents of /etc/hostname.hme0 (a machine name).
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.)
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