Set the IP address, gateway, and DNS in the Ubuntu command line.

Source: Internet
Author: User
Tags nameserver
: System: UbuntuServer11.10IP address: 192.168.21.168 subnet mask: 255.255.255.0 Gateway: 192.168.21.2DNS: 8.8.8.88.8.4.4 operation: 1. Set IP address, Gateway nano/ Note:
The system is Ubuntu Server 11.10.
IP Address: 192.168.21.168
Subnet Mask: 255.255.255.0
Gateway: 192.168.21.2
DNS: 8.8.8.8
8.8.4.4
Operation:
1. Set IP addresses and gateways
Nano/etc/network/interfaces/etc/network/interfacesbak # back up the original configuration file
Nano/etc/network/interfaces # edit the NIC configuration file
Auto lo
Iface lo inet loopback
Auto eth0 # automatically connect to the network at startup
Iface eth0 inet static # static indicates using a fixed ip address, and dhcp indicates using a dynamic ip Address
Address 192.168.21.168 # Set the IP address
Netmask 255.255.255.0 # Set the subnet mask
Gateway 192.168.21.2 # Set gateway
Ctrl + o # Save Configuration
Ctrl + x # exit
2. Set dns
Cp/etc/resolv. conf/etc/resolv. confbak # back up the original dns configuration file
Nano/etc/resolv. conf # edit the configuration file and add the following content
Nameserver 8.8.8.8 # Set preferred dns
Nameserver 8.8.4.4 # Set backup dns
Ctrl + o # Save Configuration
Ctrl + x # exit
System O & M www.osyunwei.com reminder: qihang01 original content©All rights reserved. For more information, see the source and original link.
3. Restart the network
/Etc/init. d/networking restart # restart the network
Now, the IP address, gateway, and DNS configurations are complete, and the system is ready to access the Internet.
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.