Linux Network detailed configuration (take CentOS6.7 as an example)

Source: Internet
Author: User
Tags get ip

First, the Linux server's default network card configuration file under/etc/sysconfig/network-scripts/, the general is the Ifcfg-eth0,eth0 to indicate a network card, eth1 represents the second, and so on.

The detailed steps are as follows (with):

1. Reach the network-scripts/directory

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/82/7D/wKioL1dW5vKxmE7sAABx1k7C8GQ353.jpg-wh_500x0-wm_3 -wmp_4-s_3651634873.jpg "style=" Float:none; "title=" 8.jpg "alt=" Wkiol1dw5vkxme7saabx1k7c8gq353.jpg-wh_50 "/>

2. Modify the network card IP, with Vi/etc/sysconfig/network-scripts/ifcfg-eth0 if it is a dynamic DHCP get IP, then configure as the first figure, if it is statically set IP, configuration such as 2.

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/82/7F/wKiom1dW5evCLwBtAABhZlkSYZ4395.jpg-wh_500x0-wm_3 -wmp_4-s_3692624921.jpg "style=" Float:none; "title=" 9.jpg "alt=" Wkiom1dw5evclwbtaabhzlksyz4395.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/82/7F/wKiom1dW5evT3ZiZAABUJpOn3uo508.jpg-wh_500x0-wm_3 -wmp_4-s_3618258439.jpg "style=" Float:none; "title=" 10.jpg "alt=" Wkiom1dw5evt3zizaabujpon3uo508.jpg-wh_50 "/>

& Network Interface parameters: Device= "eth0" #物理设备名

onboot= "Yes" #重启网卡是否激活设备

bootproto= "Static"/"DHCP" #静态分配/DHCP protocol

Type= "Ethernet" #网卡类型

ipaddr=192.168.33.10 #ip地址

netmask=255.255.255.0 #子网掩码

gateway= "192.168.33.1 #网关地址

3. NIC configuration, restart the network card, command:/etc/init.d/network Restart or service network restart can be.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/7D/wKioL1dW5vPhWkaEAABZFAkae6k232.jpg-wh_500x0-wm_3 -wmp_4-s_1099894225.jpg "style=" Float:none; "title=" 11.jpg "alt=" Wkiol1dw5vphwkaeaabzfakae6k232.jpg-wh_50 "/>

Network card configuration is complete, then IP but can not surf the Internet, ping www.baidu.com  display unknown. This is because you have not configured the Dns,dns configuration directory in/etc/resolv.conf, with the VI editor to open the editor to add a nameserver 8.8.8.8 (8.8.8.8 is An IP Address Is the IP address ).

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/82/7F/wKiom1dW5eyBnhEQAABFGiNdjKk853.jpg-wh_500x0-wm_3 -wmp_4-s_1379855445.jpg "style=" Float:none; "title=" 12.jpg "alt=" Wkiom1dw5eybnheqaabfgindjkk853.jpg-wh_50 "/>

To the end of the configuration here, you can experiment with the ping www.baidu.com found to pass. Check the IP configuration with Ifonfig.

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/7E/wKioL1dW7YSQJCslAACEyr085-Y327.jpg-wh_500x0-wm_3 -wmp_4-s_1879745800.jpg "title=" 13.jpg "alt=" Wkiol1dw7ysqjcslaaceyr085-y327.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/82/7E/wKioL1dW7dWBPMI_AADScVWTEa8485.jpg-wh_500x0-wm_3 -wmp_4-s_2091111361.jpg "title=" 14.jpg "alt=" Wkiol1dw7dwbpmi_aadscvwtea8485.jpg-wh_50 "/>

Second, another simple method (the use of the Redhat series, including CentOS)

Specific steps such as:

1. Type the Setup command and enter, as shown below, select Network configuration under the arrow keys.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/7E/wKioL1dW7mCBkZKFAAB8-4s_C_Q398.jpg-wh_500x0-wm_3 -wmp_4-s_3346030240.jpg "style=" Float:none; "title=" 2.jpg "alt=" Wkiol1dw7mcbkzkfaab8-4s_c_q398.jpg-wh_50 "/>

2. Enter, continue operation, the configuration of Dervice and DNS appears.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/7E/wKioL1dW7mCh1r6SAABmJBuISqw596.jpg-wh_500x0-wm_3 -wmp_4-s_3058501575.jpg "style=" Float:none; "title=" 3.jpg "alt=" Wkiol1dw7mch1r6saabmjbuisqw596.jpg-wh_50 "/>

3. Enter the IP address, mask, and gateway.

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/7E/wKioL1dW7mGQ4jc4AAB0cl66Clk552.jpg-wh_500x0-wm_3 -wmp_4-s_2485710099.jpg "style=" Float:none; "title=" 4.jpg "alt=" Wkiol1dw7mgq4jc4aab0cl66clk552.jpg-wh_50 "/>

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/82/7F/wKiom1dW7Vmy09IOAAB53EDyMBw355.jpg-wh_500x0-wm_3 -wmp_4-s_134956212.jpg "title=" 4.2.jpg "style=" Float:none; alt= "Wkiom1dw7vmy09ioaab53edymbw355.jpg-wh_50"/>

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/7F/wKiom1dW7VnAMT9SAAB2CCsx_ek023.jpg-wh_500x0-wm_3 -wmp_4-s_2038746967.jpg "style=" Float:none; "title=" 5.jpg "alt=" Wkiom1dw7vnamt9saab2ccsx_ek023.jpg-wh_50 "/>

4. Enter the DNS option, enter 8.8.8.8 (no change, please delete 192.168.59.2, change to 8.8.8.8)

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/7E/wKioL1dW7mKDyQG2AABx3HXwM5Y484.jpg-wh_500x0-wm_3 -wmp_4-s_126969137.jpg "style=" Float:none; "title=" 6.jpg "alt=" Wkiol1dw7mkdyqg2aabx3hxwm5y484.jpg-wh_50 "/>

OK, get it done, the same thing. Restart the NIC service. will be able to surf the internet, personally think this is more simple, easy to operate a little, thank you.




Linux Network detailed configuration (take CentOS6.7 as an example)

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.