[Go]linux network configuration (config/etc/sysconfig/network-scripts/ifcfg-ethx)

Source: Internet
Author: User

Background

The software needs to be installed on the server, and it must be connected to a public network like a MAVEN agent.
First configured the gateway, found that the public network can be accessed through IP, in the configuration of DNS can access the public network through the domain name

Instance

Configure how Linux can surf the web

/etc/sysconfig/network-scripts/ifcfg-eth0  

Configuring or modifying gateways and DNS in a configuration file

DNS1=8.8.8.8  GATEWAY=192.168.1.1 

Restart the NIC

service network restart
Detailed

For network management in Linux systems, we often use powerful ifconfig commands.

However, the Ifconfig command configures the network card information, after the network card restarts after the machine restarts, the configuration does not exist. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file. There is a very important member in the configuration file:/etc/sysconfig/network-scripts/ifcfg-ethx (Note: Echx refers to the device name, such as eth0, etc.).

The network information in the Ifcfg-ethx file configuration is still in effect after the reboot, which is very useful in network management, and now I ifcfg-ethx the IPV4 network configuration method for a simple description of the file.

Open commands and information according to the file Ifcfg-eth0 as follows:

[[Email protected] ~]# Vi/etc/sysconfig/network-scripts/ifcfg-eth0 Device=eth0#网卡设备名称 Onboot=yes#启动时是否激活 Yes | No bootproto=Static#协议类型 DHCP BOOTP none ipaddr=192.168.1.90  #网络IP地址 netmask=255.255.255.0  #网络子网地址 gateway=192.168.1.1  #网关地址 broadCAST= 192.168.1.255  #广播地址 hwaddr=00:0C: 29:fe:1a:09  #网卡MAC地址 type=ethernet  #网卡类型为以太网       

Note: You will need to re-import the file after you modify the file Ifcfg-ethx to take effect, the following commands:

[[email protected]~]# /etc/init.d/network reload   #命令有start | restart | stop | reload

[Go]linux network configuration (config/etc/sysconfig/network-scripts/ifcfg-ethx)

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.