Linux-set the IP address of ubuntu

Source: Internet
Author: User
Tags nameserver

Put the Ubuntu IP address in/etc/Network/interfaces, and put the DNS settings in/etc/resolv. conf.

 

Set static IP addresses

1. Backup/etc/Network/interfaces: sudo CP/etc/Network/interfaces. Backup

2. edit/etc/Network/interfaces: sudo VI/etc/Network/interfaces and replace the following content with the line related to eth0:Auto eth0 <br/> iface eth0 Inet static <br/> address 192.168.3.90 <br/> gateway 192.168.3.1 <br/> netmask 255.255.255.0 

3. Restart the network: sudo/etc/init. d/networking restart

 

Set a dynamic IP Address

1. Backup/etc/Network/interfaces: sudo CP/etc/Network/interfaces. Backup

2. edit/etc/Network/interfaces: sudo VI/etc/Network/interfaces and replace the following content with the line related to eth0:Auto eth0 <br/> iface eth0 Inet DHCP 

3. Restart the network: sudo/etc/init. d/networking restart

4. You can use dhclient to refresh the IP Address: sudo dhclient eth0

 

 

 

Set DNS

1. Backup/etc/resolv. conf: sudo CP/etc/resolv. CONF/etc/resolv. conf. Backup

2. edit/etc/resolv. conf: sudo VI/etc/resolv. conf and replace the original content:Domain weili.com <br/> Search weili.com <br/> nameserver 10.3.1.1 <br/> nameserver 10.3.1.14 

3. Restart the network: sudo/etc/init. d/networking restart

 

Set Host Name

1. Use hostname to view the current host name: sudo hostname

2. Use hostname to modify the current host name: sudo hostname newname

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.