Configure static IP and DNS in Ubuntu

Source: Internet
Author: User
If you have the opportunity to build your own Ubuntu server in your local area network, it will inevitably involve modifying its ip address and changing the ip address to facilitate future access. Next, let's talk about how to set such an ip address. 1. Open/etc/network/interfaces2. comment out ifaceeth0inetdhcp3. Add. Please note that modify ifaceeth0inetstaticaddress192.16 according to your actual situation.

If you have the opportunity to build your own Ubuntu server in your local area network, it will inevitably involve modifying its ip address and changing the ip address to facilitate future access.

The following describes how to set such an ip address,

1. Open/etc/network/interfaces

2. Comment out iface eth0 inet dhcp

3. Add, please note, according to your actual situation to modify

Iface eth0 inet static

Address 192.168.1.201

Netmask 255.255.255.0

Gateway 192.168.1.1

4. Restart eth0 instead of adding sudo to the root account.

Ifconfig eth0 down

Ifconfig eth0 up

5. Restart the NIC

/Etc/init. d/networking restart

Now the network configuration is complete. However, in subsequent use, the dns server may not be found,

So how do I set up a static dns server?

If you modify/etc/resolv. conf, the modification will expire after the machine is restarted and will be overwritten by the default configuration.

A persistent approach is,

1. Add the/etc/resolvconf/resolv. conf. d/tail file.

2. Add nameserver. I recommend two, 8.8.8.8 8.4.43. restart dns resolution,/etc/init. d/resolvconf restart

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.