Ubuntu Network Configuration

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

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

5. Configure the address of the DNS server to use up to 3 DNS servers

$ sudo vi/etc/resolv.conf

NameServer 202.96.134.133
NameServer 202.96.128.68
NameServer 202.96.128.166

Changes to the "resolv.conf" are effective immediately. You can use the nslookup command to perform a DNS server query to verify the "resolv.conf" configuration file.

How to view DNS

$ less/etc/resolv.conf


Second, use the command to set the IP address of Ubuntu

1. Check if connectivity is possible, ping the gateway using the ping command

The beginning is always real unreachable

2. Set IP

sudo ifconfig eth0 192.168.0.190 netmask 255.255.255.0

This sets the IP address and subnet mask of the NIC Eth0

3. Set the gateway sudo route add default GW 192.168.0.1

4. Ping the gateway to ping through

5. Set the DNS modification/etc/resolv.conf in which to add

NameServer DNS Address 1

NameServer DNS Address 2

Complete.

Once this is set up, the next time it appears, the IP will change.

Ubuntu Network Configuration

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.