Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux (07): network profile-- ifcfg-*

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. Network card configuration: ifcfg-*

There are many files in/etc/sysconfig/network-scripts/directory, most of which are script files, but there is a class of files beginning with ifcfg for network card configuration files (interface config), all files beginning with ifcfg will be loaded and read when starting network services, but the specific file name ifcfg-XX can be named arbitrarily.

Name: Network card name: eth0

TYPE=Ethernet: Mode: Ethernet

DEVICE=eth0: NIC interface name, must be the same as a certain NIC name under/sys/class/net/directory

BOOTPROTO: Enable Address Protocol

static: : static protocol

bootp: protocol

dhcp: protocol

none: Do not use Boot Address Protocol

PEERDNS

yes:

When set to yes, the DNS set by this file overrides/etc/resolv.conf,

If DHCP is enabled, the default is yes, so dhcp dns will also override/etc/resolv.conf

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPv6INIT: whether to implement IPv6

Yes: Support IPv6

No: IPv6 is not supported

UUID: Unique identifier

HWADDR: MAC address. Only one of them needs to be set, and the settings cannot conflict with each other at the same time.

ONBOOT: whether the system is automatically loaded at startup

yes: Activate this network interface when the system starts

no: The network interface is not activated when the system is started

IPADDR: IP address

NETMASK: subnet mask

GATEWAY: Gateway address

BROADCAST: Broadcast address

PEERDNS: Whether DNS is specified. If DHCP is used, the default is yes.

yes: if DNS settings, 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/etc/resolv.conf.

NM_CONTROLLED: Whether the network interface is controlled by the Network Manager. Changes take effect immediately after saving, no need to restart. After being trapped several times, it is generally recommended to set it to no.

Yes: Controlled by Network Manager

No: Not controlled by Network Manager

USERCTL: User Rights Control

yes: Non-root users are allowed to control this network interface

no: Non-root users do not run interfaces that control this network

II. Examples

Examples found online:

cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE="eth0"IPV6INIT="no"BOOTPROTO="dhcp"ONBOOT=yesTYPE="Ethernet"DEFROUTE="yes"PEERDNS="yes"PEERROUTES="yes"IPV4_FAILURE_FATAL="no"NAME="System eth0"DNS1=114.114.114.114DNS2=8.8.8.8DNS3=114.114.115.115

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report