How to configure IP address in Ubuntu system introduction

Source: Internet
Author: User
Tags nameserver

There are two ways to configure IP:

1. Direct Configuration via command

sudo ifconfig eth0 IP address netmask Subnet mask--Configure IP ground

sudo route add default GW gateway------------

vi/etc/resolv.conf configuration file Add nameserver dns----Configure DNS

Sudo/etc/init.d/networking restart-----------Restart NIC configuration
However, the method can only be modified temporarily, when the server restarts, the configuration information is lost, the second way to modify the configuration file directly, the configuration information is not lost after restarting the server;

2, directly modify the configuration file

Ubuntu system configuration file on:/etc/network/interfaces
Edit configuration file: sudo vi/etc/network/interfaces
Replace the line with the following line for eth0:
# The Primary network interface
Auto Eth0
Iface eth0 inet Static
Address IP addresses
Gateway Gateways
netmask Subnet Mask
#network 192.168.2.0
#broadcast 192.168.2.255

Fill in all information such as address,netmask,network,broadcast and gateways according to your situation:
Sudo/etc/init.d/networking restart--Restart the NIC to make the configuration effective

After configuring the IP address, you need to configure DNS, as follows;

sudo vi//etc/resolv.conf
Search chotim.com
NameServer DNS server address
Sudo/etc/init.d/networking restart--Restart the network card service can

How to configure IP address in Ubuntu system introduction

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.