[步骤] Linux 重启后网卡上没有 IP 地址的处理方法

步骤一:在硬件管理页面检查物理网卡是否联通

记录需要使用的网络端口的网卡机器码 (MAC) 地址

(步骤略)


注意:
1) 只有物理机才需要完成这步
2) 当物理机 1 个网络模块上有 2 个网络端口时,要特别注意 2 个网络端口各自的网卡机器码 (MAC) 地址,例如:戴尔服务器网络端口的网卡机器码 (MAC) 地址在页面的最下方

步骤二:在系统中查看对应的网卡是否联通

2.1 使用 IP 命令查看对应的网卡是否联通

# ip a s

或者:

# ip address show

(补充:当出现 ”UP“ 字样时代表网卡已经启动)

(注意:nmcli device show 命令不能确认此时网卡是否联通)

2.2 使用 ethtool 命令查看对应的网卡是否联通

# ethtool eth0

(注意:nmcli device show 命令不能确认此时网卡是否联通)

步骤三:尝试配置临时 IP 地址和临时网关 (只有当确认网卡是联通的时候才进行以下操作)

3.1 尝试配置临时 IP 地址

# ifconfig eth0 192.168.0.2/24

或者:

# ip a add 192.168.0.2/24 dev eth0

(补充:这里以给 eth0 网卡添加临时 IP 地址 192.168.0.2/24 为例)

(注意:只有当确认网卡是联通的时候才进行此操作)

3.2 尝试配置临时网关

# route add default gw 192.168.0.1

或者:

# ip route add default via 192.168.0.1

(注意:只有当确认网卡是联通的时候才进行此操作)

3.3 查看配置的临时 IP 地址和临时网关

3.3.1 查看配置的临时 IP 地址
# ip a s
3.3.2 查看配置的临时网关
# route -n

[步骤] Linux 命令的监控 (audit 版)

正文:

步骤一:添加监控命令的 audit 规则

1.1 添加监控命令的 audit 规则的格式

-w <command> -p x -k <search_key>


补充:
1) 这里的 <command> 是要监控的命令
2) 这里的 <search_key> 是个标识,用于简化在 audit 日志里搜索此命令

1.2 添加监控命令的 audit 规则的案例

-w /usr/bin/rm -p x -k rm_command


补充:这里以
1) 监控 /usr/bin/rm 命令
2) 标识是 rm_command 为例

步骤二:让刚刚添加的规则生效

2.1 合并新添加的 audit 规则

# augenrules

2.2 重启 auditd 服务

# service auditd restart

步骤三:查看新添加的规则

# auditctl -l

步骤四:查看某个表示的 audit 日志

# ausearch -k rm_command

(补充:这里以查看标识为 rm_command 的 audit 日志为例)

参考文献:

https://access.redhat.com/solutions/3401281

[STEP] Limitation of the amount of the file which can be opened by Linux program

Step One: In system level, set the limitation of the amount of the files which can be opened by the user who running the Linux Program

# vi /etc/security/limites.conf

Add these lines:

......
rmt  -       nofile  1024
rmt  -       nproc   1024

(Add: Setting the rmt user can open 8192 files and 8192 processes in this Linux as an example here)

Step Two: In program level, check the setting of the amount of the files which can be opened by Linux program

# /bin/systemctl show 'rmt-server-mirror.service' | sort
......
LimitNOFILE=524288
......

(Add: The amount of opening the file by program rmt-server-mirror.service is limited at 8096 as an example here)