Set static IP

Source: Internet
Author: User
the network parameters of Ubuntu are saved in the file/etc/network/interfaces, and the default settings use DHCP, as follows:

# The Primary network interface

Auto Eth0

Iface eth0 inet DHCP

Here's how to set up a static IP:

(1) Edit/etc/network/interfaces

1.1) block the DHCP line

# The Primary network interface

Auto Eth0

#iface eth0 inet DHCP

1.2) Add parameters related to static IP

# The Primary network interface

Iface eth0 inet Static

Address 192.168.0.10

Netmask 255.255.255.0

Gateway 192.168.0.1

(2) Edit/etc/resolv.conf, set DNS

NameServer 202.96.134.133

NameServer 202.106.0.20

(3) Perform the following two commands to enable the new settings

$sudo Ifdown eth0

$sudo ifup eth0

Set static IP

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.