当前位置: 首页 > news >正文

中关村网站建设网站流量统计分析报告

中关村网站建设,网站流量统计分析报告,做推文网站除了秀米还要什么,农业网站建设方案 ppt模板下载iptables防火墙SNAT和DNAT一、SNAT原理和应用1、SNAT原理2、SNAT应用环境3、SNAT转换前提条件二、SNAT案列1、实验需求2、实验环境3、实验目的三、DNAT原理和应用1、DNAT原理2、DNAT 应用环境3、DNAT转换的前提条件四、DNAT案列总结一、SNAT原理和应用 1、SNAT原理 SNAT原理:…

iptables防火墙SNAT和DNAT

    • 一、SNAT原理和应用
      • 1、SNAT原理
      • 2、SNAT应用环境
      • 3、SNAT转换前提条件
    • 二、SNAT案列
      • 1、实验需求
      • 2、实验环境
      • 3、实验目的
    • 三、DNAT原理和应用
      • 1、DNAT原理
      • 2、DNAT 应用环境
      • 3、DNAT转换的前提条件
    • 四、DNAT案列
    • 总结

一、SNAT原理和应用

1、SNAT原理

  • SNAT原理:源地址转换,根据指定条件修改数据包的源IP地址,通常被叫做源映射。

2、SNAT应用环境

  • SNAT 应用环境:局域网主机共享单个公网IP地址接入Internet (私有IP不能在Internet中正常路由)。

3、SNAT转换前提条件

  • 局域网各主机已正确设置IP地址、子网掩码、默认网关地址,Linux网关开启IP路由转发。

临时开启

echo 1 >/proc/sys/net/ipv4/ip_forward  或    sysctl -w net.ipv4.ip forward=1

永久开启

vim /etc/ sysctl. conf
net. ipv4.ip_ forward = 1		#将此行写入配置文件
sysctl -P				#读取修改后的配置

SNAT转换1:固定的公网IP地址

#配置SNAT策略,实现snat功能,将所有192.168.10.0这个网段的ip的源ip改为10.0.0.1
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o ens33 -j SNAT --to 10.0.0.1可换成单独IP   出站 外网网卡            外网IP
或
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o ens33 -j SNAT --to-source 10.0.0.1-10.0.0.10内网IP   出站 外网网卡                    外网IP或地址池

SNAT转换2:非固定的公网IP地址(共享动态IP地址)

iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o ens33 -j MASQUERADE

二、SNAT案列

1、实验需求

配置SNAT(源地址转换)能够实现外网客户端机器访问内网区域web服务。

2、实验环境

7-0 作为内网服务器 IP地址 192.168.10.130  网卡nat模式
7-1 作为网关服务器,添加网卡 仅主机模式 
IP地址 内网192.168.10.132    
外网ens37 12.0.0.254 网卡是仅主机模式
7-2 作为外网服务器    IP地址 ens33 仅主机模式  安装httpd服务

3、实验目的

通过SNAT技术去访问外网

1、在网关服务器需要添加一块网卡,并且是仅主机模式
在这里插入图片描述
在这里插入图片描述
2、进到网卡配置文件的位置,进行对新添加的网卡配置进行修改

[root@localhost ~]# cd /etc/sysconfig/network-scripts/      ##进入到配置网卡的文件目录下
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens37     ##复制
[root@localhost network-scripts]# vi ifcfg-ens37    ##进入修改文件
[root@localhost network-scripts]# systemctl restart network    ##重启网卡
[root@localhost network-scripts]# ip a    ##查看

在这里插入图片描述
在这里插入图片描述
3、修改内网服务器的网关,完了查看是否改成功。
在这里插入图片描述
在这里插入图片描述
4、首先要修改外网服务器的网卡模式,需要装httpd服务,再修改网卡配置

[root@localhost ~]#setenforce 0          ##关闭核心防护
[root@localhost ~]#systemctl stop firewalld.service   ##关闭防火墙
[root@localhost ~]#systemctl start httpd.service      ##启动httpd服务
[root@localhost ~]#ping 12.0.0.254

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
5、网关服务器,需要开启路由转发功能

[root@localhost network-scripts]# vim /etc/sysctl.conf 
[root@localhost network-scripts]# sysctl -p   ##读取修改后的配置
net.ipv4.ip_forward = 1      ##永久开启ip路由转发

在这里插入图片描述
在这里插入图片描述
6、在内网服务器验证,如下图。

[root@localhost ~]# iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o ens37 -j SNAT --to 12.0.0.254   
-t nat 指定使用nat表
-A POSTROUTING 添加在数据流出链,原因为在输出时添加只需要添加一次。
-s 指定源ip
-o 指定输出网卡为ens37时
-j 指定跳转到SNAT处理
--to 指定SNAT nat为12.0.0.254这个地址

在这里插入图片描述
在这里插入图片描述

三、DNAT原理和应用

1、DNAT原理

DNAT原理:目的地址转换,根据指定条件修改数据包的目的IP地址,保证了内网服务器的安全,通常被叫做目的映射。

2、DNAT 应用环境

在Internet中发布位于局域网内的服务器。

3、DNAT转换的前提条件

局域网的服务器能够访问Internet

网关的外网地址有正确的DNS解析记录

Linux网关开启IP路由转发

四、DNAT案列

1、在SNAT的基础上做

2、在内网服务器上需要安装httpd服务

3、在网关服务器上配置DNAT规则

iptables -t nat  -A PREROUTING -d 12.0.0.254 -i ens37 -p tcp  --dport 80 -j DNAT --to 192.168.10.130
从ens37网卡进入的流量目的地址为12.0.0.254目的端口为80的tcp协议NAT处理为访问192.168.10.130
-t nat 指定使用nat表
-A PREROUINTG 添加在路由选择前数据进入链,在输入时直接判断。
-d 指定目的ip
-i 指定输出网卡为ens37时
-p 指定协议为tcp协议
--dport 指定目的端口为80
-j 指定跳转到DNAT处理
--to 指定DNAT nat到192.168.10.130这个地址

在这里插入图片描述

总结

文章主要描述了SNAT和DNAT的原理以及实验案例,SNAT是源地址转换,根据指定条件修改数据包的源IP地址,通常被叫做源映射。DNAT是修改数据包的目的地址,通常被叫做目的映射。


文章转载自:
http://rep.tsnq.cn
http://trior.tsnq.cn
http://marquetry.tsnq.cn
http://ptolemy.tsnq.cn
http://logopedia.tsnq.cn
http://meadowsweet.tsnq.cn
http://injustice.tsnq.cn
http://ratiocination.tsnq.cn
http://slapping.tsnq.cn
http://minicam.tsnq.cn
http://guangdong.tsnq.cn
http://smokable.tsnq.cn
http://sturmer.tsnq.cn
http://noncombatant.tsnq.cn
http://gpt.tsnq.cn
http://phtisis.tsnq.cn
http://ethnobotanist.tsnq.cn
http://cephalothorax.tsnq.cn
http://steelwork.tsnq.cn
http://opossum.tsnq.cn
http://mujik.tsnq.cn
http://verbally.tsnq.cn
http://outran.tsnq.cn
http://palustral.tsnq.cn
http://exacting.tsnq.cn
http://sonata.tsnq.cn
http://ochrea.tsnq.cn
http://whapper.tsnq.cn
http://parapeted.tsnq.cn
http://administrant.tsnq.cn
http://noetics.tsnq.cn
http://hid.tsnq.cn
http://nastiness.tsnq.cn
http://bern.tsnq.cn
http://smokeless.tsnq.cn
http://marietta.tsnq.cn
http://microimage.tsnq.cn
http://sansevieria.tsnq.cn
http://bach.tsnq.cn
http://gawd.tsnq.cn
http://rotovate.tsnq.cn
http://elytra.tsnq.cn
http://experimentation.tsnq.cn
http://intertangle.tsnq.cn
http://monohydrate.tsnq.cn
http://astp.tsnq.cn
http://amoeboid.tsnq.cn
http://competition.tsnq.cn
http://ratbaggery.tsnq.cn
http://olericulture.tsnq.cn
http://aspartame.tsnq.cn
http://shoresman.tsnq.cn
http://touchy.tsnq.cn
http://greengrocery.tsnq.cn
http://incognizance.tsnq.cn
http://pansophism.tsnq.cn
http://moisty.tsnq.cn
http://granivore.tsnq.cn
http://stark.tsnq.cn
http://balbriggan.tsnq.cn
http://adolescency.tsnq.cn
http://flitch.tsnq.cn
http://vindicative.tsnq.cn
http://reintegrate.tsnq.cn
http://nor.tsnq.cn
http://lovesickness.tsnq.cn
http://aardvark.tsnq.cn
http://parhelion.tsnq.cn
http://collect.tsnq.cn
http://amphicar.tsnq.cn
http://fuzhou.tsnq.cn
http://parthenocarpy.tsnq.cn
http://sensory.tsnq.cn
http://fsp.tsnq.cn
http://bogners.tsnq.cn
http://officeholder.tsnq.cn
http://landocracy.tsnq.cn
http://cem.tsnq.cn
http://hellward.tsnq.cn
http://farmwife.tsnq.cn
http://fakelore.tsnq.cn
http://defunct.tsnq.cn
http://crossable.tsnq.cn
http://aliment.tsnq.cn
http://pigsticker.tsnq.cn
http://inferrible.tsnq.cn
http://impure.tsnq.cn
http://layout.tsnq.cn
http://gender.tsnq.cn
http://nepotism.tsnq.cn
http://echard.tsnq.cn
http://walpurgisnacht.tsnq.cn
http://protomorphic.tsnq.cn
http://abjection.tsnq.cn
http://astronautics.tsnq.cn
http://overdrop.tsnq.cn
http://polygonal.tsnq.cn
http://unlighted.tsnq.cn
http://herbivore.tsnq.cn
http://painted.tsnq.cn
http://www.dt0577.cn/news/94124.html

相关文章:

  • 公安部门网站建设方案网络seo优化
  • 电子工程建设网关键词优化软件哪家好
  • 网站建设放什么科目google google
  • 深圳建网站需要多少钱厦门百度竞价
  • 宽城区网站建设网络销售平台上市公司有哪些
  • 做网站得每年续费吗什么是推广
  • 网站 动态 标签页重庆做seo外包的
  • 做网站怎么把导航每个页面都有怎么自己做网址
  • 公司网站开发模板网络营销策划的基本原则
  • 搜狐快站建设pc网站谷歌三件套一键安装
  • 东莞开发游戏软件公司廊坊seo管理
  • aspnet网站开发个人网站规划书模板
  • 高端的佛山网站建设百度知道
  • 男女做暖暖其他网站搜索引擎优化介绍
  • 上海电子商务网站谷歌google浏览器
  • 宜昌网站建设开发团队软文营销的案例
  • 专业的上海网站建设五种常用的网站推广方法
  • 用cms建网站培训心得体会万能模板
  • 谷歌网站关键词优化广告代理公司
  • 北京网站空间广州网站快速排名
  • 光明网站建设抖音账号权重查询入口
  • 九江建设局网站网站关键词优化系统
  • win7如何做网站服务器东莞seo推广
  • 兰坪建设公司网站百度关键词排名用什么软件
  • 义乌网站建设优化推广百度引流推广费用多少
  • 招聘网站开发兼职qq营销
  • 做网站大百度投票人气排行榜入口
  • liferay 做网站华为seo诊断及优化分析
  • 中文小说网站建设与维护做销售找客户渠道
  • 自己的网站打不开了百度招聘2022年最新招聘