LINUX Set fixed IP internet access method __linux

Source: Internet
Author: User
Tags get ip

As a result of development, the need to connect the development machine frequently, but if not set static IP address, each reboot or disconnect the network connection, IP address will change, need to set a fixed IP address, down is how to set the fixed IP method

Default configuration

Input command: VIM/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP2S0 (here/ifcfg-enp2s0 each person's name suffix is not the same, the prefix is/IFCFG-ENP)

If Vim is not installed, enter the command: Yum install vim encounters the option input y return to install successfully


Here's how to set up a fixed IP

First step:

Under Root, enter the command: ifconfig

If the prompt cannot find the ifconfig command, enter Yum upgrade and yum install Net-tools


After entering Ifconfig, remember the 2 IP addresses labeled below

Enter the command at this time: vim/etc/sysconfig/network-scripts/ifcfg-enp2s0

Insert Tag content: Insert command: In reading mode, click "I" into edit mode, it's OK

Bootproto represents the way to get IP ("DHCP" = dynamic Get/"static" = Set static IP)

IPADDR represents a static IP address (the address is a inet 192.168.0.138 acquired before Ifconfig)

The netmask represents the subnet mask (the address is netmask 255.255.255.0 acquired before Ifconfig)

Gateway represents gateways (because your IP is 192.168.0 network segment, so use 192.168.0.1, note: You are the IP address of the top three is what network segment in the back add a 1 on the line)

DNS1 is DNS (need You know your network DNS, generally in the router management background has configuration, you can not set DNS)

The last is to save the reboot for the configuration to take effect

Enter command: ": Wq" means to save and exit

Input command: Reboot, reboot

Source: http://blog.csdn.net/w18600281813/article/details/50977688

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.