SNAT配置网卡网关服务器配置双网卡具体命令cd /etc/sysconfig/network-scriptscp ifcfg-eth0 ifcfg-eth1ip add //查看网卡信息 复制 eth1 MAC地址vim ifcfg-eth1进行修改service network restart...
SNAT

配置网卡
网关服务器
配置双网卡
具体命令
cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth1
ip add //查看网卡信息 复制 eth1 MAC地址
vim ifcfg-eth1
进行修改

service network restart
vim /etc/sysctl.conf
修改
net.ipv4.ip_forward = 0 为 1
sysctl -p //更新其配置
配置IP tables规则
iptables -t nat -A POSTOUTING -s 192.168.1.0/24 -o eth1 -j SNAT --to-source 192.168.2.1
外网服务器
配置IP
配置httpd测试
vim /etc/httpd/conf/httpd.conf
修改
ServerName 前井号去除
vim /var/www/html/index.html
写入
It’s web
在内网访问
查看其日志
tailf /etc/httpd/logs/access_log
192.168.2.1 - - [17/Oct/2018:20:25:02 +0800] “GET / HTTP/1.1” 200 35 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131029 Firefox/17.0”
实际访问为 外网网关
本文标题为:Centos6.5 iptables 中的SNAT
基础教程推荐
- Centos 安装Django2.1 2023-09-24
- Docker容器操作方法详解 2022-11-13
- 为Win2003服务器打造铜墙铁壁的方法步骤 2022-09-01
- Centos7 nginx的安装以及开机自启动的设置 2023-09-22
- RFO SIG之openEuler AWS AMI 制作详解 2022-12-28
- 通过StatefulSet部署有状态服务应用实现方式 2022-10-01
- windows环境下apache-apollo服务器搭建 2023-09-10
- Apache Kafka 2.5 稳定版发布,新特性抢先看 2023-09-11
- Apache CarbonData 1.0.0发布及其新特性介绍 2023-09-11
- P3 利用Vulnhub复现漏洞 - Apache SSI 远程命令执行漏洞 2023-09-10
