Static IP configuration in Ubuntu server

Source: Internet
Author: User
Tags nameserver
(1) Modify IP

Configuration file/etc/network/interfaces

Add the following statement:
Auto Eth0
Iface eth0 inet Static
Address 192.168.2.86 #IP地址
netmask 255.255.255.0 #子网掩码
Gateway 192.168.2.1 #网关

(2) Modify DNS

Configuration file/etc/resolv.conf

Add the following statement:
NameServer 192.168.2.1 #希望修改成的DNS

NameServer 8.8.8.8

Here is a bit of a problem, is to restart Ubuntu after the discovery and can not surf the internet, the problem is/etc/resolv.conf. Once restarted, the DNS for this file configuration is automatically modified to the default value. So you need to permanently modify DNS. Here's how:

Open/etc/resolvconf/resolv.conf.d/base

Join:

NameServer 192.168.2.1

NameServer 8.8.8.8

(3) The last step of Ubuntu server (not required).

Add this command to restart the network configuration in the rc.local:
sudo/etc/init.d/networking restart

Static IP configuration in Ubuntu server

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.