[步骤] dnsmasq 的搭建 (DNS 服务)

步骤一:安装 dnsmasq

# yum install dnsmasq

步骤二:添加 DNS 配置

# vi /etc/dnsmasq.d/address.conf

创建以下内容:

all-servers
server=1.1.1.1
server=8.8.8.8

server=/cn/114.114.114.114

address=/test-gateway.com/192.168.100.1


补充:
1) 这里的 all-servers 代表同时解析下面所有的 DNS 记录
2) 这里的 server=1.1.1.1 和 server=8.8.8.8 代表上游 DNS 服务器使用 1.1.1.1 和 8.8.8.8
3) 这里的 server=/cn/114.114.114.114 代表以 cn 结尾的域名上游 DNS 使用 114.114.114.114
4) 这里的 address=/test-gateway.com/192.168.100.1 代表 test-gateway.com 域名指向 IP 地址 192.168.100.1

步骤三:重启 dnsmasq 服务

3.1 重启 dnsmasq 服务

# systemctl restart dnsmasq.service 

3.2 查看 dnsmasq 服务状态

# systemctl status dnsmasq.service
● dnsmasq.service - DNS caching server.
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2025-08-14 00:00:35 CST; 7s ago
 Main PID: 10412 (dnsmasq)
    Tasks: 1 (limit: 5781)
   Memory: 704.0K
   CGroup: /system.slice/dnsmasq.service
           └─10412 /usr/sbin/dnsmasq -k

Aug 14 00:00:35 tool1 dnsmasq[10412]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 DHCP>
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 114.114.114.114#53 for domain cn
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 8.8.8.8#53
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 1.1.1.1#53
Aug 14 00:00:35 tool1 dnsmasq[10412]: reading /etc/resolv.conf
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 114.114.114.114#53 for domain cn
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 8.8.8.8#53
Aug 14 00:00:35 tool1 dnsmasq[10412]: using nameserver 1.1.1.1#53
Aug 14 00:00:35 tool1 dnsmasq[10412]: ignoring nameserver 192.168.100.11 - local interface
Aug 14 00:00:35 tool1 dnsmasq[10412]: read /etc/hosts - 2 addresses 

步骤四:使用配置好的 dnsmasq 服务

# vi /etc/resolv.conf

将全部内容修改如下:

nameserver 192.168.100.11

(补充:这里的 192.168.100.11 指的是刚刚搭建 dnsmasq 服务的服务器的 IP 地址)

步骤五:测试 dnsmasq 服务

5.1 测试 DNS 正向解析

# nslookup test-gateway.com
Server:		192.168.100.11
Address:	192.168.100.11#53

Name:	test-gateway.com
Address: 192.168.100.1

(补充:这里以正向解析刚刚配置的域名 test-gateway.com 为例)

5.2 测试 DNS 反向解析

# arp 192.168.100.1
Address                  HWtype  HWaddress           Flags Mask            Iface
_gateway                 ether   52:54:00:ef:3a:4d   C                     eth0

(补充:这里以反向解析刚刚配置的 IP 地址 192.168.100.1 为例)

[DEBUG] Red Hat Satellite resolve remove repository error ‘Unable to find content with the ID XXX’

Error Code:

Katello::Errors::CandlepinError: Unable to find content with the ID XXX

Solution One: Add Relevant Licenses

Solution One Step One: Make sure which repository is marked as Orphaned

Access Satellite Web –> Content –> Sync Status –> Find the Orphaned repository

Solution One Step Two: Add Relevant Licenses

(Omit Steps)

Solution Two: Remove Orphaned Repositories

Solution Two Step One: Make sure which repository is marked as Orphaned

Access Satellite Web –> Content –> Sync Status –> Find the Orphaned repository

Solution Two Step Two: Remove Orphaned Repositories

Access Satellite Web –> Content –> Red Hat Repositories –> Remove Orphaned Repositories

Solution Two Step Three: Resume Removing Orphaned Repositories Task Status (If Removing Orphaned Repositories Task is Stuck)

3.1 Access the concerned task

Access Satellite Web –> Monitor –> Tasks –> Search for the concerned task

3.2 Check both the Run and Finalize tabs for the sub-task

Click on the DynFlow Console button and check both the Run and Finalize tabs for the sub-task

3.3 Skip the ERROR sub-task

(Omit Steps)

(Add: usually it’s the Actions::Candlepin::Environment::SetContent one )

3.4 Resume Removing Orphaned Repositories Task Status

(Omit Steps)

Reference:

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

[步骤] auditd 日志传送到远端的日志搜集服务器的设置 (auditd 版) (RHEL 版)

正文:

步骤一:在服务端上配置搜集 auditd 日志的设置

1.1 设置搜集 auditd 日志时使用的端口

(只在服务端上执行以下步骤)

# vi /etc/audit/auditd.conf

将部分内容修改如下:

......
tcp_listen_port = 1000 
......

(补充:这里以设置 TCP 端口号 1000 作为搜集 auditd 日志时使用的端口为例)

1.2 在 SELinux 上给 auditd 搜集日志时使用的端口打上 auditd SELinux 标签

(只在服务端上执行以下步骤)

# semanage port -a -t audit_port_t -p tcp 1000

(补充:这里以给 TCP 端口号 1000 打上 auditd 的 SELinux 标签为例)

1.3 让刚刚设置的配置文件生效

(只在服务端上执行以下步骤)

# service auditd restart

步骤二:在客户端将 auditd 日志传送到远端的日志搜集服务器

2.1 安装 audispd-plugins 组件 (只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上操作)

(只在客户端上执行以下步骤)

# dnf install audispd-plugins

(注意:只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上进行此操作)

2.2 将 auditd 日志传送到远端的日志搜集服务器

2.2.1 设置 auditd 日志要发送到的目标 IP 地址和目标端口

(只在客户端上执行以下步骤)

如果是 RHEL 7 和 RHEL 7 之前的版本 RHEL:

# vim /etc/audisp/plugins.d/syslog.conf

将部分内容修改如下:

......
remote_server = 192.168.0.1
......
port = 1000
......

(补充:这里以将 audit 日志发送到 IP 地址是 192.168.0.1 端口是 1000 的远端日志搜集服务器的为例)


如果是 RHEL 8 和 RHEL 8 之后版本的 RHEL:

# vim /etc/audit/plugins.d/syslog.conf

将部分内容修改如下:

......
remote_server = 192.168.0.1
......
port = 1000
......

(补充:这里以将 audit 日志发送到 IP 地址是 192.168.0.1 端口是 1000 的远端日志搜集服务器的为例)

2.2.2 设置 auditd 日志发送到远端日志搜集服务器的其它信息

(只在客户端上执行以下步骤)

如果是 RHEL 7 和 RHEL 7 之前的版本 RHEL:

# vim /etc/audisp/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
direction = out
path = /sbin/audisp-remote
type = always
#args =
format = string
......

如果是 RHEL 8 和 RHEL 8 之后版本的 RHEL:

# vim /etc/audit/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
direction = out
path = /sbin/audisp-remote
type = always
#args =
format = string
......

2.3 让刚刚修改的 auditd 配置文件生效

(只在客户端上执行以下步骤)

# service auditd restart

步骤三:检测 auditd 日志是否传送到了远端的日志搜集服务器

3.1 在本地生成 auditd 日志用于检测

(只在客户端上执行以下步骤)

# auditctl -m "This is a test auditd message from client"

(补充:这里以在 auditd 日志里写入 1 条内容是 “This is a test auditd message from client” 的日志为例)

3.2 在远端的日志搜集服务器检测是否收到 auditd 日志

(只在服务端上执行以下步骤)

(步骤略)

参考文献:

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

[步骤] auditd 日志传送到远端的日志搜集服务器的设置 (rsyslog 版) (RHEL 版)

正文:

步骤一:将 auditd 日志转换为系统日志

1.1 安装 audispd-plugins 组件 (只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上操作)

# dnf install audispd-plugins

(注意:只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上进行此操作)

1.2 将 auditd 日志转换为系统日志

如果是 RHEL 7 和 RHEL 7 之前的版本 RHEL:

# vim /etc/audisp/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
......
args = LOG_INFO LOG_LOCAL3
......

(补充:这里以将 auditd 日志转换成系统的 local3 日志为例)


如果是 RHEL 8 和 RHEL 8 之后版本的 RHEL:

# vim /etc/audit/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
......
args = LOG_INFO LOG_LOCAL3
......

(补充:这里以将 auditd 日志转换成系统的 local3 日志为例)

步骤二:将系统日志中的 auditd 日志传送到远端的日志搜集服务器

# vi /etc/rsyslog.conf

添加以下内容:

......
local3.info        @remotesyslog.com
local3.info        stop

(补充:这里以将 local3 日志传送到远端的日志搜集服务器 remotesyslog.com 为例)

步骤三:让刚刚修改的 auditd 配置文件生效

如果是 RHEL 6 和 RHEL 6 之前的版本 RHEL:

# service rsyslog restart
# service auditd restart

如果是 RHEL 7 和 RHEL 7 之后版本的 RHEL:

# systemctl restart rsyslog
# service auditd restart

步骤四:检测 auditd 日志是否传送到了远端的日志搜集服务器

4.1 在本地生成 auditd 日志用于检测

# auditctl -m "This is a test auditd message from client"

(补充:这里以在 auditd 日志里写入 1 条内容是 “This is a test auditd message from client” 的日志为例)

4.2 查看本地的系统日志

# tail -f /var/log/messages
...... auditd[......]: ......

(补充:此时可以看到 /var/log/messages 系统日志里有和 auditd 相关的日志)

4.3 在远端的日志搜集服务器检测是否收到 auditd 日志

(步骤略)

参考文献:

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