Ubuntu Server 12.04 static IP compact Configuration

Source: Internet
Author: User
Tags compact nameserver

PS: I haven't used Ubuntu for a long time, just installed an Ubuntu Server 12.04 test. Ubuntu Network settings are not the same as the Redhat system, the configuration of IP when found with the previous Ubuntu desktop version is also different, recorded as follows:

1. Configure static IP address:

# vim/etc/network/interfaces

The original content has the following 4 lines:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

The above indicates that DHCP is used to assign IP by default and is modified as follows:


auto lo
iface lo inet loopback

# The Primary network interface
Auto Eth0
#iface eth0 inet DHCP

iface eth0 inet static
address 192.168.80.129
netmask 255.255.255.0
gateway 192.168.80.2

Save exit.
Note: You only need to set address (IP address), netmask (subnet mask), Gateway (gateways) These three items ok,network and broadcast are not writable.

2. Manually set up the DNS server:

# vim/etc/resolv.conf

Add the following (all Linux distributions are generic):

NameServer 192.168.80.2
NameServer 8.8.8.8

Save exit.

Note: After restarting Ubuntu, it is not possible to surf the internet again, 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:

# Vim/etc/resolvconf/resolv.conf.d/base
NameServer 192.168.80.2
NameServer 8.8.8.8

3. Restart the networking service to make it effective:

#/etc/init.d/networking Restart

This allows the network configuration to be permanently active.

Ubuntu Server 12.04 static IP compact 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.