To change the IP address of a Linux system, you can use the ip command. The ip command is a utility that allows you to configure the network settings of a Linux system.
To change the IP address of a network interface, use the following syntax:
ref:ot relautturi.comip addr add IP_ADDRESS/PREFIX_LENGTH dev INTERFACE_NAME
Replace IP_ADDRESS with the desired IP address, PREFIX_LENGTH with the prefix length (e.g., 24 for a Class C network), and INTERFACE_NAME with the name of the network interface you want to configure.
For example, to set the IP address 192.168.1.100/24 on the interface eth0, you can use the following command:
ip addr add 192.168.1.100/24 dev eth0
This will assign the IP address 192.168.1.100 to the eth0 interface.
To make the change permanent, you will need to edit the network configuration file for the interface. The configuration file is typically located in the /etc/sysconfig/network-scripts directory and is named ifcfg-INTERFACE_NAME. For example, for the eth0 interface, the configuration file would be /etc/sysconfig/network-scripts/ifcfg-eth0.
Open the configuration file with a text editor, such as vi or nano, and edit the IPADDR .
vi /etc/sysconfig/network-scripts/ifcfg-eth0
example:
DEVICE=eth0 IPADDR=192.168.1.1 NETMASK=255.255.255.0 ONBOOT=yes BOOTPROTO=none USERCTL=no MII_NOT_SUPPORTED=yes