Ubuntu-Network Configuration

Source: Internet
Author: User
Tags nslookup command
Ubuntu-Network Configuration

Ubuntu-Network Configuration

 
Check the network configuration command: ifconfig

1. Configure through the configuration file
New users have never used Ubuntu, so they have taken a lot of detours. They have found many ways on the Internet, but most of them have not helped me. Therefore, they have written their own configuration methods.
Environment: vpc2007sp1, ubuntu9.04
Two NICs are connected to Ubuntu, and eth1 with eth0 as the Internet is Intranet (the VPC features that an intranet must be set for direct communication with the host)

The IP address on eth0 is automatically obtained.

Manually set for eth1 (required by the VPC itself)

Configuration process:

1. Open the/etc/Network/interfaces file of ubuntu. The default content is as follows:

Auto Lo
Iface lo Inet loopback

2. If eth0 is set to automatically obtain the IP address, you do not need to configure it. Insert the IP address of eth1 for which you want to manually set the IP address. The edited content is as follows .:

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. After writing and saving, open the terminal and run the following command to restart the NIC:

$/Etc/init. d/networking restart


You can also restart the NIC to make the new configuration take effect. The advantage is that it does not affect other network interfaces:

$ Sudo ifdown eth0

$ Sudo IFUP eth0

4. If the NIC is configured using DHCP, change:
auto eth0
iface eth0 Inet DHCP
You can also directly enter the following command on the command line to obtain the address
sudo dhclient eth0

5. Configure the DNS server address, up to three DNS servers can be used
$ sudo VI/etc/resolv. conf
nameserver 202.96.134.133
nameserver 202.96.128.68
nameserver 202.96.128.166
on "resolv. conf "changes take effect immediately. You can use the NSLookup command to query the DNS server to verify the "resolv. conf" configuration file.
how to view DNS
$ less/etc/resolv. conf

 
2. Use commands to set the IP address of ubuntu
 
1. to check whether the connection is available, ping the gateway using the ping command.
 
At the beginning, it is always true That unreachable
 
2. Set IP
 
Sudo ifconfig eth0 192.168.0.190 netmask 255.255.255.0
 
In this case, the IP address and subnet mask of the eth0 NIC are set.
 
3. Set the gateway sudo route add default GW 192.168.0.1
 
4. You can ping the gateway.
 
5. Set DNS modification/etc/resolv. conf and add
 
Nameserver DNS address 1
 
Nameserver DNS address 2
 
Complete.
 
After this setting, it seems that the IP address will change again at next boot.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/yufangbo/archive/2009/07/03/4319940.aspx

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.