我已经创建了 centos stream 9,我打算让这个 linux 机器充当路由器,这个 linux 机器有 2 个网卡,一个连接到 wan,另一个连接到 lan,我按照下面的步骤操作,但是第二个网卡无法与其他客户端计算机共享互联网,如能得到任何帮助我将不胜感激
ens224 facing wan
ens192 facing lan
cat /etc/sysctl_d/ip_forward.conf
net.ipv4.ip_forward = 1
firewall-cmd --permanent --direct --passthrough ipv4 -t nat -I POSTROUTING -o ens224 -j MASQUERADE -s 192.168.1.0/24
firewall-cmd --change-interface=ens224 --zone=external --permanent
firewall-cmd --set-default-zone=internal
firewall-cmd --complete-reload
systemctl restart network && systemctl restart firewalld
- 防火墙命令--list-all--zone=external
external (active)
target: default
icmp-block-inversion: no
interfaces: ens224
sources:
services: ssh
ports:
protocols:
forward: yes
masquerade: yes
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@CentOSHome ~]# firewall-cmd --list-all --zone=internal
internal (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: cockpit dhcpv6-client mdns samba-client ssh
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@CentOSHome ~]#