Linux_centos How to set IP address, how to modify the IP address of Linux

Source: Internet
Author: User
Tags get ip

for many friends who have just come into contact with Linux, how to set the IP address of the Linux system, as the first step, the following small series of CentOS system as an example, to show you how to set the IP address of the CentOS , how do I modify the Linux system IP address?


    • Linux systems, CentOS

View IP AddressLogin to connect to the CentOS system, enter ifconfig to view IP address information for the current local computer, such as


Temporarily set IP addressFor example, the above query IP is 1.117, enter ifconfig eth0 (default is the first network card) followed by IP address, netmask and gateway, if not set, use the default mask


Checking the IP again becomes the new IP address.

Note that this method is modified only temporarily, restarting the NIC or server and restoring


Set \ Modify IP Address

If you want to make the IP address permanent, you need to edit the NIC configuration file

Use the VI editor settings, such as Vi/etc/sysconfig/network-scripts/ifcfg-eth0


describe the document; Device=eth0 NIC corresponding device alias, such as Ifcfg-eth0 first NIC Bootproto=static

How the NIC obtains the IP address,

Static IP Address

DHCP (get IP via DHCP protocol)

bootip IP address obtained via BOOTP protocol  BROADCAST=192.168.0.255           subnet broadcast address   HWADDR =00:50:56:8e:47:ee          Network card Physical address   ipaddr =12.168.1.117               network card IP address

ipv6init =no                       whether IPV6 is enabled ipv6_ AUTOCONF =no netmask=255.255.255.0             network card corresponding to netmask  NETWORK=192.168.1.0               Network Address of the NIC  ONBOOT=yes                        whether this network interface is set when the system starts, and when set to Yes, activates the device when the system starts. The default setting is Yes

As for the following type and UUID this does not have to worry about, the type of the network card


2. Using the VI editor, pressInsert key Insertion, enter edit mode


3. Move the cursor to the IPADDR Settings section and change to the IP address you want to set.

As in this example, change to 1.118. Press the ESC key.

Enter Colon: Wq Save exit

Will prompt "/etc/sysconfig/network-scripts/ifcfg-eth0" 14L, 302C written


4.  set up, the network service restart, such as 2 commands can be    service network restart


5. View IP again you will find that you have changed to a new IP address   1.118

Graphical interface operation

Besides

You can manipulate it in the graphical interface. Edit the network card settings, or use the Netconfig command to enter the graphical interface settings


After setting, if IP is required to take effect. Also need to restart the network service, or restart the computer

Precautions
    • Ifconfig Modify the password is temporary, restart the network card service or server and then restore. The above methods are valid for other Linux distributions



Linux_centos How to set IP address, how to modify the IP address of Linux

Related Article

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.