How to set a static IP address in a Linux system

Source: Internet
Author: User

This article is mainly about setting up a static IP address method in a Linux system.

Tools/Materials
    • redhat6.4 x64

Method/Step
  1. Input in Terminal: Vi/etc/sysconfig/network-scripts/ifcfg-eth0

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

  3. When you are finished editing, save the exit.

  4. Restart the Network service. Service network restart or/etc/init.d/network restart

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

  6. Summary:

    ---Modify the IP address---

    Immediate effect:

    # ifconfig eth0 192.168.1.155 netmask 255.255.255.0

    Restart takes effect:

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

    ---Modify the default gateway---

    Immediate effect:

    # route add default GW 192.168.1.1

    Restart takes effect:

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

    ---modify DNS---

    Modify/etc/resolv.conf

    Immediate effect after modification, restart is also valid

    ---Modify the host name---

    Immediate effect:

    # hostname Test1

    Restart takes effect:

    Modify/etc/sysconfig/network

How to set a static IP address in a Linux system

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.