Ubuntu server IP and DNS settings

Source: Internet
Author: User

After ubuntu is installed, the first thing is to connect to the Internet, change the source, and perform the update operation, but the prerequisite is that the ip address and dns must be configured.
Next we will record the configuration process and use it as a backup so that it is not necessary.
 
1. Configure the ip address
The network configuration information of ubuntu is stored in/etc/network/interfaces,
 
 
 
Operation:
 
Sudo vim/etc/network/interfaces
 
Vim is a text editing software similar to edit under DOS. Similar to the previous software vi usage
 
If you configure Dynamic ip retrieval, add the following content to the above file: (Note: the server usually does not need dynamic ip addresses)
Auto eth0
Iface eth0 inet dhcp
 
If static IP is configured, add the following content:
Auto eth0
Iface eth0 inet static
Address 192.168.1.201
Netmask 255.255.255.0
Gateway 192.168.1.1
 
If the configuration takes effect, restart the NIC:
Ifconfig eth0 down
Ifconfig eth0 up
 

 
Run the ifconfig command to check whether the ip address is configured successfully.
 

Otherwise, restart the network service.
/Etc/init. d/networking restart
 
2. Configure the dns server
The dns server information of ubuntu is stored in/etc/resolv. conf,
Add the dns server address, for example, 202.112.125.53.
Nameserver 202.112.125.53
Summary:
You only need to follow the above steps to complete the configuration, and then you can access the internet. If not, restart the machine and try again.

Author Dai Liming

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.