Ubuntu10.10 Configuration Network _linux

Source: Internet
Author: User

For a while it really confused the network configuration of Ubuntu, resistant to the heart to carefully search the Internet, a little experience, summed up.
First of all, the general configuration process, and then to examine some of the situation.
One, the configuration is roughly divided into three categories: through configuration file configuration, through the command configuration, through the Graphical Network connection menu configuration.
Main file:/etc/network/interfaces, here are some configuration of IP, gateway, mask, etc./etc/resolv.conf this file to save information about DNS
Main command: sudo/etc/init.d/networking Restart restart the network to disable configuration file configuration, sudo route add default GW <IP address, set the gateway.
Second, the configuration method
1, through the command configuration
If you just want to modify the IP address temporarily, you can choose this method. It will be lost when you restart the network.
1 sudo ifconfig eth0 <ip address > netmask < subnet mask > up
Eth0 is the NIC. The last up means to open the network card, you can not add.
2 sudo route add default GW < Gateway Ip>
Setting up Gateways
3 Set DNS, this must go to config file modification, same as the second kind
4) Configure the host name
Command: Sudo/bin/hostname < host name >
However, when the system starts, the name of the host is read from the/etc/hostname.

2, through the configuration file configuration
1 Configure IP Gateway: sudo gedit/etc/network/interfaces inside add
of DHCP:

Copy Code code as follows:

Auto Lo

Iface Lo inet Loopback

Auto Eth0

Iface eth0 inet DHCP

Static IP:
Copy Code code as follows:

Auto Lo
Iface Lo inet Loopback
#上面的是回环
#网卡eth0的配置
Auto Eth0
#staic Static IP
Iface eth0 inet Static
Address 192.168.1.5
Netmask 255.255.255.0
Gateway 192.168.1.1
#network 192.168.3.0
#broadcast 192.168.3.255
#后面两条是网络号和广播号, this can be computed by other information, so there is no need to set

You can also configure a second IP (virtual IP)
Copy Code code as follows:

Auto Eth0:1
Iface eth0:1 inet Static
Address 192.168.1.60
Netmask 255.255.255.0
#network x.x.x.x
#broadcast x.x.x.x
Gateway x.x.x.x

2) Configure Dns:sudo gedit/etc/resolv.conf
Copy Code code as follows:

NameServer 202.107.117.11

3 host Name: sudo gedit/etc/hostname enter the hostname. There is a host name by default, so this is not required.
4) Restart Network: sudo/etc/init.d/networking restart
You can also reboot the network card:
sudo ifconfig eth0 down
sudo ifconfig eth0 up
Restarting the NIC has no effect on the other NIC, more recommended.
3, through the Graphical Network connection menu configuration
This is also called Network Manager in the system-preferences, and it can be configured by using the network Management applet in the upper right corner panel.
This is a bit of a problem: it has a common configuration file with the second method, so it can cause conflicts and be aware of it when used.
Instead, both methods are configured, sudo/etc/init.d/networking Restart enables the configuration of the second method, and clicking the Auto eth0 in the network Management applet on the desktop Panel enables the third 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.