In Linux, IP addresses are classified into "Dynamic IP" and "static IP". Dynamic IP addresses are automatically cleared when the machine restarts, while static IP addresses are always bound.
Static IP settings:Create a file ifcfg-eth0: 1 in/etc/sysconfig/network-scripts or by using a GUI tool with the following content:
Device = eth0: 1
Ipaddr = 139.24.214.82 # static IP Address
Netmask = 255.255.255.0
Onboot = Yes
How to Set Dynamic IP addresses:
/Sbin/ifconfig eth0: 1 139.24.214.22 netmask 255.255.255.0 # change to service IP Address
/Sbin/ifconfig eth0: 2 127.0.0.1 netmask resume 255.254.0 # restore to 127.0.0.1
Note: In the preceding command, eth0: 2 should be eth0: 1. Set it according to the above method and execute ifconfig,
[Root @ centosnetwork-Scripts] # ifconfig
Eth0 link encap: Ethernet hwaddr 00: 15: F2: 1f: A2: Ea
Inet ADDR: 10.130.16.141 bcast: 10.130.16.255 mask: 255.255.255.0
Inet6 ADDR: fe80: 215: f2ff: fe1f: a2ea/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 1892 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 901 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 188740 (184.3 kib) TX Bytes: 131190 (128.1 kib)
Interrupt: 193 base address: 0x6000
Eth0: 1 link encap: Ethernet hwaddr 00: 15: F2: 1f: A2: Ea
Inet ADDR: 10.130.16.131 bcast: 10.130.16.255 mask: 255.255.255.0
Up broadcast running Multicast MTU: 1500 Metric: 1
Interrupt: 193 base address: 0x6000
Lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Inet6 ADDR: 1/128 scope: Host
Up loopback running MTU: 16436 Metric: 1
RX packets: 1520 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1520 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 2634807 (2.5 MIB) TX Bytes: 2634807 (2.5 MIB)