[Go]ubuntu Network configuration author: Yudar

Source: Internet
Author: User

Check network configuration command: Ifconfig

One, through configuration file configuration
Novice didn't how to use Ubuntu, so go a lot of detours, online find a lot of methods, mostly did not help me, so put their own configuration method write.

Ubuntu connected to two Nic, eth0 for the external network of the eth1 for the Intranet (VPC features, and host direct communication must be set up intranet)

Eth0 on IP for automatic acquisition

Manual setup on eth1 (which is also required by VPC itself)

Configuration process:

1. Open Ubuntu/etc/network/interfaces file. The default content is as follows:

Auto Lo
Iface Lo inet Loopback

2, eth0 to obtain the IP automatically, so do not need to configure. Insert the IP information of the eth1 to set the IP manually, after editing the content as follows, the front auto eth1, let the network card boot automatically mount.:

Auto Lo
Iface Lo inet Loopback
Auto Eth1
Iface eth1 inet Static
Address 192.168.0.101
Netmask 255.255.255.0
Network 192.168.0.0
Broadcask 192.168.0.255
Gateway 192.168.0.2

 Hwaddress ether [your_mac_address] Let the network configuration help top up to a physical Mac NIC.

3, write finished save, and then open the terminal run the following command, restart the network card can:

$/etc/init.d/networking Restart


You can also restart the network card for the new configuration to take effect, with the advantage of not affecting other network interfaces:

$ sudo ifdown eth0

$ sudo ifup eth0

4. If the network adapter is configured as DHCP, instead:
Auto Eth0
Iface eth0 inet DHCP

You can also get the address by typing the following command directly below the command line
sudo dhclient eth0

Ubuntu Server 14.04 sets IP and DNS settings IP:

Vim/etc/network/interfaces

The following will be included:

Auto Eth0
Iface eth0 inet DHCP

Modified to:

Auto Eth0
#iface eth0 inet DHCP
Iface eth0 inet Static
Address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
Gateway xxx.xxx.xxx.xxx

Hwaddress ether [your_mac_address] Let the network configuration help top up to a physical Mac NIC.

Set the xxx.xxx.xxx to the information you want to be personalized, which
auto eth0#开机自动连接网络
iface eth0 inet static# static indicates use of a fixed IP, dhcp stating that using dynamic IP
addressIs the native IP address
netmaskSubnet mask
gatewayGateway

If you use nano editing,
Ctrl+o #保存配置
Ctrl+x #退出

Set up DNS

The DNS information of the Linux system is saved in/etc/resolv.conf, but in Ubuntu you will find hints with the following text when you open this file with vim

DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN

So can not directly personality this file, this content may be overwritten

In Ubuntu the DNS information is placed in the/etc/resolvconf/resolv.conf.d/directory

In general, this directory has base and head two folders

Vim/etc/resolvconf/resolv.conf.d/base

NameServer 8.8.8.8
NameServer 114.114.114.114

Save after execution

Resolvconf-u

Use the following command to make the network settings effective

Service Networking Restart
sudo/etc/init.d/networking restart

[Go]ubuntu Network configuration author: Yudar

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.