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

Important files in the etc directory

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

Share

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

Summary of important files under the etc directory 1) Network card configuration file path information: / etc/sysconfig/network-scripts/ifcfg-eth0 file function description: configure network card address information (IP address mask address gateway address DNS address information) File details: TYPE=Ethernet-specify network type Ethernet type BOOTPROTO=none-obtain IP address mode none Static (manual address configuration) dhcp (automatic address acquisition) DEFROUTE=yes-do you want to activate the default? Routing? (network knowledge) NAME=eth0-Network card name information logic name DEVICE=eth0-Network card name information device name # represents to invalidate a message first UUID=226f4037-72f4-4c0e-b72a-442145f64d81-eth0 network card device number ONBOOT=yes-whether to activate and open the network card IPADDR=10. 0.0.200PREFIX=24GATEWAY=10.0.0.254DNS=223.5.5.5 quickly change the IP address: sed-I's address 10.0.0.200room10.0.0.201roomg'/ etc/sysconfig/network-scripts/ifcfg-eth0 file configuration takes effect: restart network service method 1: use systemctllife Make the enterprise environment do not recommend systemctl restart network method 2: use service command enterprise environment does not recommend service network restart method 3: use ifxx command Specify the network card to restart ifdown eth0 & & ifup eth0 enterprise environment configuration method 4: how to modify the network card name information using nmcli https://my.oschina.net/u/3754919/blog/1811361:

The first course: modify the name information in the network card file

Vi ifcfg-ens33

NAME=eth0

DEVICE=eth0

The second course: renaming the file name of the network card

Mv ifcfg-ens33 ifcfg-eth0

The third course: let the system kernel load the name modification information of the network card

Vi / etc/default/grub

GRUB_CMDLINE_LINUX= "xxx net.ifnames=0 biosdevname=0 xxx"

The fourth course: loading and modifying configuration information

Grub2-mkconfig-o / boot/grub2/grub.cfg

The fifth course: restart the operating system

Reboot

2) Domain name service profile

File path information: / etc/resolv.conf

Description of the function of the file: whether you can access the name or domain name information

File content information:

Vi / etc/resolv.conf

Nameserver 223.5.5.5 (DNS server address)

PS: DNS server function: to resolve the domain name (gun bureau) to IP address (dispatch office)

223.5.5.5 Aliyun Company *

114.114.114.114 Telecom Company

8.8.8.8 Google

How the configuration works: effective immediately

3) Local domain name resolution profile:

File path information: / etc/hosts

File function description: implement local name resolution (used to access different servers) for website testing

Web Server-Network-Database Server 192.173.16.122 db01

-Network-Storage Server 187.169.45.231 date01

-Network-Monitoring Server 177.187.56.93 zabbix01

4) start up and run the command file automatically:

File path information: ect/rc.local file function description: let the system start, automatically run command information

Demand: 1. Make an initial backup of important data 2. The system starts up and automatically clears the recycle bin data 3. Realize automatic mount of stored data

What is a script file: simplify complex work and make repetitive work efficient

5) system environment variable alias function settings file

File path information: / etc/profile

File function description: you can set environment variables and set alias function

​ variable?

How to set the ​ variable: X (variable) = 10 (variable value) oldboy=10 oldboy=oldboy69

How to use the ​ variable: $X $oldboy

​ environment variable?

​ 1) Environment variables are composed of uppercase letters

​ 2) Environment variables are all set by default.

​ 3) Environmental variables are variables with special functions.

​ $PATH-enables system users to run commands directly

​ command execution logic:

​ 1) user input command-- > system loads PATH environment variable $PATH

​ / usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin saves binaries directory

​ 2) find the file that executes the command in the specified environment variable directory

Find the command file in the path of ​ cat environment variables-> execute the command function

Command not found in ​ environment variable path-> error message command cannot find file does not exist

​ 4) after the environment variable is set, it affects all users

​ ​ environment setting method:

​ is effective temporarily:

​ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp

The ​ is permanent:

​ vi / etc/profile

​ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp

​ permanent configuration takes effect:

​ method 1: reconnect the host

​ method 2: load the configuration in the profile file with the command

​ source / etc/profile or. / etc/profil

6) system runlevel file

File path information: / etc/inittab

Document function description: define which software programs are opened automatically after the system starts

System running level: 7 levels

Centos6

0-system shutdown level init 0

1-system single user level is used to crack system password root rescue and recover system data

No network service

2-the system multi-user level has no network multi-user level.

3-system multi-user level has network multi-user level * *

4-unused level

5-system graphical level

6-system restart level init 6

Setting method:

Temporary settings:

Init level number

Runlevel view current runlevel

Permanent settings:

Vi / etc/inittab

Xx:5:xxx

7) system login prompt information

​ file path information: / etc/motd

Function description of ​ file: display prompt message after logging in to the system

​ 8) File path information: / etc/issue.net

Function description of ​ file: display prompt information before logging in to the system

9) system hostname configuration file path information: / etc/hostname file function description: modify hostname system name modification: temporary modification: hostname web01 permanent modification:

Vi / etc/hostname

Web01

Hostnamectl set-hostname backup

10) the system mounts files automatically

File path information: / etc/fstab

File function description: realize automatic mounting of storage device

File configuration Information:

UUID=2276c35c-a7d0-476b-9ca3-b2cd1bdae20b / xfs defaults 0 0

UUID=2673b61b-1b44-449a-b75a-e8b74bdce018 / boot xfs defaults 0 0

UUID=c067a535-f7bd-420f-9f5f-d88765e3f13f swap swap defaults 0 0

① ② ③ ④ ⑤ ⑥

Learn about fatab file configuration: man fstab

1) Mount storage device information representation UUID file information / dev/sda3

2) Mount point directory information / mount point

3) File system type xfs default centos7 file system

4) Mount parameter information determines whether data ro rw can be stored in the storage device.

5) whether to make a disk backup or not will affect the disk storage efficiency. The disk utilization will reduce the data recovery 0 function and the 1 function is not enabled.

6) whether to check the disk affects the disk storage efficiency fsck

​ file configuration takes effect: restart the operating system

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