How to configure IP addresses in Ubuntu

Source: Internet
Author: User
After receiving a client's server, the Ubuntu system was found to have been started. at that time, I was a little depressed and thought that I had not configured the ubuntu system. the client was still there, and I felt a little nervous, as a result, I began to search for various methods for configuration on the Internet, and finally configured the IP address and connected the client for mounting and debugging. now I will share with you the configuration method;

After receiving a client's server, the Ubuntu system was found to have been started. at that time, I was a little depressed and thought that I had not configured the ubuntu system. the client was still there, and I felt a little nervous, as a result, I began to search for various methods for configuration on the Internet, and finally configured the IP address and connected the client for mounting and debugging. now I will share with you the configuration method;

There are two IP address configuration methods:

1,Directly configure using commands

Sudo ifconfig eth0 IP address netmask subnet mask ------ configure IP address location

Sudo route add default gw gateway ------------ add default route

Vi/etc/resolv. conf configuration file add nameserver DNS ---- configure DNS

Sudo/etc/init. d/networking restart ----------- restart Nic configuration
However, the configuration information can only be temporarily modified. after the server is restarted, the configuration information is lost. in the second method, the configuration file is directly modified. after the server is restarted, the configuration information is not lost;

2,Directly modify the configuration file

The Ubuntu system configuration file is at:/etc/network/interfaces
Edit the configuration file: sudo vi/etc/network/interfaces
Replace eth0 with the following rows:
# The primary network interface
Auto eth0
Iface eth0 inet static
Address IP address
Gateway
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 take effect.

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 Nic service.

Related Article

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.