Set the fixed IP address and DNS on Ubuntu.

Source: Internet
Author: User
Tags nameserver

2. Set a fixed IP address and DNS on Ubuntu.

1) Open a terminal.

2) set a fixed IP Address

Enter sudo VI/etc/Network/interfaces on the terminal, which is usually displayed:

Auto Lo

Iface lo Inet loopback

Add the following content below:

Auto eth0
Iface eth0 Inet static
Address 192.168.0.120 # The fixed IP address you want to set
Gateway 192.168.0.1 # Gateway
Netmask 255.255.255.0 # Subnet Mask

Note two points here. Some users do not need to modify the settings. You can use ifconfig-A on the terminal to check whether eth0 or eth1. the gateway and subnet mask are used, and the next DNS to be modified, you can enter the CMD command ipconfig-all on Windows XP to get it.

3) set DNS

As mentioned above, after obtaining DNS through the command ipconfig-all in Windows XP via cmd, the/etc/resolv. conf file in Ubuntu will be displayed.
The specific command is as follows:

Sudo VI/etc/resolv. conf

Modify the nameserver. For example, modify it to nameserver 208.96.128.88.

3. In the last step, restart the Ubuntu Nic.

Enter the restart command in the terminal, as shown below:

Sudo/etc/init. d/networking restart

 

Then, you can ping the web site of another machine on Windows XP or Ubuntu, and there will also be ssh.

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.