How to modify IP address under Linux system

Source: Internet
Author: User

Linux to modify the IP address is usually used to modify the ifconfig, but this modification is very troublesome, the following small series to introduce the use of the command to change the IP address method, together to learn under it.

Method/Step

1, use the root user login into Linux, open in the terminal

2, in the terminal input: Vi/etc/sysconfig/network-scripts/ifcfg-eth0

3, after carriage,

Start editing, fill in the IP address, subnet mask, gateway, DNS, and so on. The "information in the red box" is necessary.

4, after editing, save exit

Restart Network Services

Service network restart or/etc/init.d/network restart

Then ping the gateway and ping the extranet for testing. Can ping to indicate that the network is normal

5, Detailed summary:

---Modify the IP address---

Immediate effect:

# ifconfig eth0 192.168.1.155 netmask 255.255.255.0

Reboot effective:

Modify Vi/etc/sysconfig/network-scripts/ifcfg-eth0

---Modify the default gateway---

Immediate effect:

# route add default GW 192.168.1.1

Reboot effective:

Modify Vi/etc/sysconfig/network-scripts/ifcfg-eth0

---modify DNS---

Modify Vi/etc/resolv.conf

Immediately after the change, restart is also effective

---Modify the host name---

Immediate effect:

# hostname Test1

Reboot effective:

Modify Vi/etc/sysconfig/network

End

Attention matters

Not familiar with practice more than a few times

The above is the use of Linux under the command to easily modify the IP address method Introduction, hope to help everyone!

Above is the Linux to modify the IP address method introduced, if you need to modify the IP address, installation of the steps described above can easily complete IP changes, you have learned?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.