Configure the network environment in Linux

Source: Internet
Author: User
In Linux, there are three main methods to configure the network environment in linux: (1) Use setup to enter the configuration environment to configure the network; (2) use ifconfig to configure the network (3) the following describes how to directly modify the underlying network configuration file: Method 1: configure the network through setup...
In Linux, there are three main methods to configure the network environment in linux: (1) Use setup to enter the configuration environment to configure the network; (2) use ifconfig to configure the network (3) the following describes how to directly modify the underlying network configuration file: Method 1: configure the network through setup (1) log on as a root user, and then run the setup command to enter menuconfig, as shown in 1.

(2) Select network configuration, as shown in figure 2.

Then you can configure the IP address. if you select the above use dynamic IP configuration system, the system will automatically allocate the IP address, which is not selected here. Www.2cto.com (3) for the configuration to take effect. execute the command:/etc/rc. d/init. d/network restart note that permanent changes take effect after being restarted. Method 2: configure the network through ifconfig
The network configuration with ifconfig takes effect immediately, but this configuration is temporary. after the next restart, the IP address will be restored to the original settings. the specific configuration method is as follows: ifconfig eth0 xxx. xxx. xxx. the xxx command configures ifconfig eth0 network xxxx for the network. xxx. xxx. how to set the subnet mask using the xxx Command 3: modifying the underlying configuration file is the most fundamental modification method. In fact, other methods are implemented by indirectly modifying it (1) run the command: vi/etc/sysconfig/network-scripts/ifcfg-eth0 in this file can modify IP, subnet mask, broadcast address, default gateway, after opening 3 shown

DEVICE indicates the name of the network. if ifconfig is used to configure the network, the parameters following the network must be changed to the corresponding parameters. For example, if DEVICE = chen is used, ifconfig will be changed to ifconfig chen x. x. x. xONBOOT indicates whether to start the network. If yes, it indicates that when the server is started, several other parameters of the server are IP address, mask, and Gateway. (2) restart the network to make it take effect for www.2cto.com/etc/rc. d/init. d/network restart is the above three methods for setting the network in linux. If you select use dynamic IP configuration in, 4 shows

When you look at the file in method 3

The IP address, mask, and Gateway are not configured here. dhcp indicates that the IP address is automatically obtained. it will automatically check the IP addresses that are not used in the Lan and assign the computer an unused IP address, to prevent IP conflicts in the network, there is no substantial difference between the first method and the third method. you only need to note that the second method is temporary modification. Author: Chen Qingting
Related Article

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.