Linux network Interface configuration file Ifcfg-eth0 parsing

Source: Internet
Author: User

This article transferred from: http://blog.csdn.net/jmyue/article/details/17288467

Configuring the network on Windows is easy and has a graphical interface to manipulate. In Linux, the network is often configured with commands to modify files, so you need to know not only which files to configure, but also the capabilities of each configuration parameter in the file. In Linux such as Redhat/fedora, the network configuration file is generally/etc/sysconfig/network-scripts/ifcfg-eth0, while in SLEs 10 it is/etc/sysconfig/network/ Ifcfg-eth-id-xx:xx:xx:xx:xx:xx (followed by the MAC address of the network interface); In SLEs 11, it is/etc/sysconfig/network/ifcfg-eth0.

In a computer system, you can have multiple network interfaces, corresponding to multiple network interface configuration files, in the/etc/sysconfig/network-scripts/directory, sequentially numbered files are ifcfg-eth0,ifcfg-eth1, ..., Ifcfg-eth<x>. Commonly used is Ifcfg-eth0, which represents the first network interface configuration file.

Ifcfg-eth0 Example:

[plain] view plaincopy 
  1. Type=ethernet
  2. Device=eth0
  3. Bootproto=none
  4. Onboot=yes
  5. ipaddr=10.0.1.27
  6. netmask=255.255.255.0
  7. gateway=10.0.1.1
  8. broadcast=10.10.1.255
  9. hwaddr=00:0c:29:13:5d:74
  10. Peerdns=yes
  11. dns1=10.0.1.41
  12. Userctl=no
  13. Nm_controlled=no
  14. Ipv6init=yes
  15. Ipv6addr=fd55:faaf:e1ab:1b0d:10:14:24:106/64

1. Configuration parameter Description

Note: These parameter values are case-insensitive, do not differentiate between single and double quotes, and can even be used without quotation marks.

Type: Configure the file interface types. There are various network configuration files in the/etc/sysconfig/network-scripts/directory, such as Ethernet, IPSec, etc., and the network interface type is Ethernet.

DEVICE: Network Interface Name

Bootproto: System start Address protocol

None: Do not use the start Address protocol

BOOTP:BOOTP protocol

DHCP:DHCP Dynamic Address protocol

Static Address protocol

Onboot: Whether the system is activated at startup

Yes: The network interface is activated at system startup

No: The network interface is not activated at system startup

Ipaddr:ip Address

NETMASK: Subnet Mask

Gateway: Gateways Address

Broadcast: Broadcast address

Hwaddr/macaddr:mac address. You only need to set one of them, and you cannot set them to conflict with each other.

Peerdns: Specifies whether DNS is specified. If you use the DHCP protocol, the default is yes.

Yes: If DNS is set, modify DNS in/etc/resolv.conf

No: Do not modify DNS in/etc/resolv.conf

Dns{1, 2}:dns address. When Peerdns is yes, it is written to the/etc/resolv.conf.

Nm_controlled: Whether the network interface is controlled by the networking manager. Changes take effect immediately after saving, without restarting. By its pit a few times, the proposal is generally set to No.

Yes: controlled by network manager

No: not controlled by network manager

USERCTL: User Rights control

Yes: Non-root user allows control of the network interface

No: Non-root user does not run control of the network interface

Ipv6init: Whether to execute IPV6

Yes: Support IPV6

No: IPV6 not supported

Ipv6addr:ipv6 Address/Prefix length

2. Configuration takes effect

Modify the network configuration, the simplest is to use the ifconfig command, without restarting, immediately effective. The knowledge about Ifconfig is detailed in the blog post "Linux commands-setting or viewing network configuration command Ifconfig". The network configured by Ifconfig is only currently temporarily active, and expires when the computer restarts. To make the network configuration permanent, you need to modify the network interface configuration file under/etc/sysconfig/network-scripts/. However, these files are modified and are not immediately effective. There are two ways to make the network configuration of a modified file effective:

1) Execute the Service network restart command and restart the Web service (recommended)

2) Restart the computer

Reference

Network Interfaces in "Red Hat Enterprise Linux 4:reference Guide"

The above is the original content, one for personal note:

A ifcfg-eth0 file configuration content that can be run properly:

Device=eth0                              //Appliance name Bootproto=none//                    Start Boot protocol onboot=yes//                             boot load ipaddr=192.168.1.200              //IP address                              if none, Manually add netmask=255.255.255.0          //netmask; subnet mask          If none, add broadcast=192.168.1.255      //gateway=192.168.1.1              manually If the gateway            is not available, manually add type=ethernetprefix=24dns1=192.168.1.1                    //DNS, if the bridge is configured with no DNS, the inernet cannot be connected. If none, add it manually. Defroute=yesipv4_failure_fatal=yesipv6init=noname= "System eth0" Uuid=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03last_ connect=1437140517

If the bridge is configured with no DNS, the inernet cannot be connected.

Linux network Interface configuration file Ifcfg-eth0 parsing

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.