About Setting static IP addresses in Ubuntu

Source: Internet
Author: User
I have installed Ubuntuserver before. Because ubuntuserver does not have a graphical interface, you must use the vi editor to edit the/etc/network/interfaces file for static IP configuration. However, the setting is unsuccessful, I don't know why, and I have also searched online materials. They are all set up. After Continuous experiments, the configuration is successfully completed, leaving logs for future reference: Use vi and enter the command (in order not to enter sudo, I directly switch to the root account): sudosu

I have installed Ubuntu server before. Because ubuntu server does not have a graphical interface, you must use the vi editor to edit the/etc/network/interfaces file When configuring the static IP address. However, the setting fails, I don't know why, and I have also searched online materials. They are all set up.

After Continuous experiments, the configuration is successfully completed, leaving logs for future reference:

Use vi and enter the command (to avoid entering sudo, I will directly switch to the root account ):

Sudo su
Vi/etc/network/interfaces
The content of the configured file is (marked in red as the added content ):
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).

# The loopback network interface
Auto lo
Iface lo inet loopback

# The primary network interface
Auto eth0
# Iface eth0 inet dhcp
Iface eth0 inet static
Address 192.168.0.6
Netmask 255.255.255.0
Gateway 192.168.0.1

Note that after the configuration is complete, restart the network:

/Etc/init. d/networking restart
If it is not a root account, add sudo.

I set a static IP address yesterday. When I turned on my computer again today, I found that the server could not be connected to the Internet. I wondered if I didn't set DNS, use the vi editor to open/etc/resolv. conf:

Vi/etc/resolv. conf
Add DNS:

Search mydomain.com
Nameserver 61.139.39.73
Nameserver 61.139.2.69

After the configuration is complete, restart the network:

/Etc/init. d/networking restart
Solve the problem!

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

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.