ubuntu16.0.4 setting a fixed IP address and DNS

Source: Internet
Author: User
Tags nameserver

Because the company's computer every time the power-on reset assigned IP address is different, which leads to a lot of inconvenient things, so simply lock a fixed IP address, the following is the steps I lock the IP address:

1. Set the IP address

Vi/etc/network/interfaces

Add the following content:

# The Primary network interface

# ENP2S0 is your computer's network card, do not know what kind of network card, you can use the command ifconfig view
Auto Enp2s0
Iface Enp2s0 inet Static

# 192.168.2.83 is the IP address you want to fix
Address 192.168.2.83

# subnets and gateways can be viewed through route-n
Netmask 255.255.255.0
Gateway 192.168.2.1

2. Set up DNS

Vi/etc/resolvconf/resolv.conf.d/base
NameServer 114.114.114.114
NameServer 8.8.8.8

3. Refresh the configuration file

Resolvconf-u

4. Restart the Network Service

/etc/init.d/networking restart

5. Then restart the shutdown:

Using the Ifconfig command, you can see that the IP address is fixed.

ubuntu16.0.4 setting a fixed IP address and DNS

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.