Ubuntu Linux static IP network configuration

Source: Internet
Author: User

Based on Ubuntu 14.04 LTS Server.

Recently like KDE, but Ubuntu's default desktop is based on unity, uninstall is very troublesome, simply loaded directly from the server version, what software they need to add what software, the whole world has become refreshing.

Text interface In addition to network configuration is not very intuitive, others are OK, for learning pure command line operation is very helpful.

First look at the network card of the current system:

sudo iconfig

For example, I have a network interface named EM1 in addition to the loopback network Lo, and the following will configure the network for it.

1. Edit the/etc/network/interfaces file:

sudo vim/etc/network/interfacesauto em1iface em1 inet Static
Address Ip_addr_here
Gateway Gateway_here
Netmask Netmask_here
Dns-nameservers nameservers_1 nameserver_2 ...

  

2. Restart the network or system

sudo /etc/init.d/sudo reboot

With regard to DNS settings, there are many tutorials on the web that are misleading!

Setting up a DNS server by modifying the/etc/resolv.conf file is only temporary, and modifying the file does specify a DNS server, but once the system restarts, the content set in the file will be overwritten!

/etc/resolv.conf's comments explain very clearly that the fields that the user adds in/etc/resolv.conf are overwritten, overwriting the/etc/network/interfaces file with "Dns-nameservers" field lists the DNS server addresses. It is therefore preferable to set the "Dns-nameservers" field in the/etc/network/interfaces file to set DNS instead of modifying the/etc/resolv.conf file. This allows the system to correctly parse the domain name even if it is restarted.

Ubuntu Linux static IP network configuration

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.