Manual network settings in Linux

Source: Internet
Author: User
Tags nameserver
Set the IP address. You can directly edit the/etc/Network/interfaces file, and write the fixed IP address as follows:

Auto lo eth0

Iface lo Inet loopback

Iface eth0 Inet static
Address 192.168.2.2
Netmask 255.255.255.0
Broadcast 192.168.2.255
Gateway 192.168.2.1

Set the address and gateway. The last section in DHCP is as follows:

Auto eth0
Iface eth0 Inet DHCP

After this file is changed, restart the network:

/Etc/init. d/networking restart

Generally, the ifconfig and route commands can be used to temporarily set IP addresses and gateways:

Ifconfig-A displays network settings
Ifconfig eth0 Inet down first disable eth0
Ifconfig eth0 Inet up 192.168.1.2/
Netmask 255.255.255.0 broadcast 192.168.1.255 is a row. Set IP addresses
Route add default GW 192.168.1.1 eth0 set Gateway
If the route del default GW 192.168.1.1 gateway is incorrect, you can delete it. After setting it, you can use route to check

Set the DNS and directly write/etc/resolv. conf. It is okay to write a few more files, but I don't know if it will be used. The following two are opendns, which is good, especially for users of China Telecom and China Telecom.

Domain
Nameserver 208.67.222.222
Nameserver 208.67.220.220

There are also host names:

Hostname display Host Name
Set Host Name

I don't know whether this setting will write data to the file. You can directly edit/etc/hostname, which contains only this name.

The new vro can set the port so that it is better to use the plug-in.

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.