ubuntu-Network Configuration

Source: Internet
Author: User
Tags nameserver nslookup command
ubuntu-Network Configuration

Check network configuration command: Ifconfig

One, through configuration file configuration
Novice not how to use Ubuntu, so took a lot of detours, online find a lot of ways, most of them did not help me, so put their own configuration method to write.
Environment: VPC2007SP1, Ubuntu9.04
Ubuntu has two network cards, eth0 for the extranet eth1 for the intranet (VPC characteristics, and host direct communication must be a group of intranet)

Eth0 IP for automatic acquisition

Eth1 for manual setting (again VPC own request)

Configuration process:

1, open the Ubuntu/etc/network/interfaces file. The default content is as follows:

Auto Lo
Iface Lo inet Loopback

2, eth0 for automatic access to IP, so do not need to configure. Insert to manually set IP eth1 IP information, after editing the content below, the front of 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 to run the following command, restart the network card can:

$/etc/init.d/networking Restart


You can also restart the NIC 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 card is configured by DHCP, it will be changed to:
Auto Eth0
Iface eth0 inet DHCP

You can also enter the following command directly at the command line to get the address
sudo dhclient eth0

5, configure the address of the DNS server, you can 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

The changes to "resolv.conf" are immediately effective. You can use the nslookup command for DNS server queries to verify the "resolv.conf" configuration file.

How to view DNS

$ less/etc/resolv.conf

&NBSP
Two, use the command to set the Ubuntu IP address
 
1. Verify that connectivity is possible, ping the gateway using ping command
 
is always real when it starts unreachable
&NBSP
2. Set IP
 
sudo ifconfig eth0 192.168.0.190 netmask 255.255.255.0
 
So if I set the network card eth0 P Address and subnet mask
 
3. Set Gateway sudo route add default GW 192.168.0.1
 
4 Ping gateway can ping the
 
5. Set up DNS modify/etc/resolv.conf, in which add
 
nameserver DNS address 1
 
nameserver DNS address 2
 
End Yes.
 
After this setting, it seems that the IP will change again the next time you boot up.

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.