Linux manually configure IP address methods

Source: Internet
Author: User

Manually configure a static IP address

That is, manually configuring IP addresses, subnet masks, gateways, and DNS.

The Setup method is as follows:

vi /etc/sysconfig/network-scripts/ifcfg-eth0编辑本地网卡的配置文件

See whether the following are the same as given below.

ONBOOT=yesBOOTPROTO=noneIPADDR=192.168.1.66NETMASK=255.255.255.0GATEWAY=192.168.1.1DNS1=192.168.1.1

The second entry indicates that the DHCP service is not used, and if the static IP address is configured manually, the value of Bootproto can be none or static.

The third item indicates that the IP address is set.

The fourth item represents setting the subnet mask.

The fifth item indicates setting up the gateway.

The sixth item is to set the preferred DNS server, in fact, DNS has its own configuration file/etc/resolv.conf, where DNS is set to write it to the DNS configuration file/etc/resolv.conf.

Then, execute the following command to restart the network service.

Note: in the case of Linux for virtual machines, using "Manually configure static IP addresses", you must set the network connection mode for this virtual machine's network adapter (that is, the NIC) to bridge mode.

Regardless, whether it is "automatically get dynamic IP address" or "Manually configure static IP address", can be configured to configure the IP address of Linux, and is permanently in effect. And, as long as your home has an extranet, your Linux can also connect to the extranet. But I prefer to use "Get dynamic IP address automatically" because it is more convenient.

Summary: modify the network card configuration file This method is very effective, almost no limitations, it is strongly recommended.

Linux manually configure IP address methods

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.