IPTABLES的NAT表的作用:

发布时间 2023-11-11 19:47:25作者: 往事已成昨天

架构图如下:

 

[root@gitlab ~]# iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -j SNAT --to-source 192.168.3.110
[root@gitlab ~]# sysctl -p
[root@gitlab ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
[root@gitlab ~]# vi /etc/sysctl.conf                     ##进行内核转发
[root@gitlab ~]# sysctl -p   
net.ipv4.ip_forward = 1