一、概要
1. 环境
Rocky Linux 9.1
CentOS 7.9
二、配置
1. sysctl服务
(1) 检查状态
systemctl status sysctl
(2) 开启
sudo systemctl start sysctl sudo systemctl enable sysctl
2. 操作IP转发
(1) 查看状态
sysctl net.ipv4.ip_forward
输出net.ipv4.ip_forward = 0,0代表关闭,1代表开启。
(2) 开启IP转发
sudo sysctl -w net.ipv4.ip_forward=1
(3) 关闭IP转发
sysctl -w net.ipv4.ip_forward=0
(4) 应用配置
sudo sysctl -p
三、参考
1. 官方
2. 其他
https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux
标签:sysctl,IP,sudo,---,RHEL,ip,forward,ipv4 From: https://www.cnblogs.com/eagle6688/p/17498920.html