当前位置:网站首页>Backup and restore of SNAT and DNAT firewall rules
Backup and restore of SNAT and DNAT firewall rules
2022-07-28 17:31:00 【There are cranes in the clouds】
Preface : The anchor has something on his mind these days , So there is no foreword, friends

Catalog
1.SNAT Principle and Application
1.3.SNAT Conversion prerequisites
1.4SNAT transformation 1: Fixed public network IP Address
1.6.1 Install two machines first httpd Service and iptables service
1.6.2 Change the original network to user-defined mode and add an additional network card
1.6.3 modify ens33 and ens37 And restart
1.6.4 Permanent open IP Route forwarding
1.6.5SNAT transformation : Fixed public network IP Address
1.6.6 Modify the network card of the second machine and restart
1.6.7 modify windows To configure
1.6.8 The verification results
2.DNAT Conversion prerequisites
2.1DNAT Conversion prerequisites
2.2DNAT Application environment
2.4DNAT transformation 1: Publishing Intranet Web service
2.5DNAT transformation 2∶ Modify the target port when publishing
2.6.1 modify window Network configuration
2.6.2 Modify the network card of the second virtual machine and restart
2.6.3 Set up DNAT transformation edit
2.6.4 The verification results
1.SNAT Principle and Application
LAN hosts share a single public network IP Address access Internet( private IP Can't be in Internet Normal routing in )
1.2.SNAT principle
Source address translation , Modify the source of the packet according to the specified conditions IP Address , It is often called source mapping
Simply put, it is to modify the source address of the packet
1.3.SNAT Conversion prerequisites
1. Each host of LAN has been set correctly IP Address 、 Subnet mask 、 Default gateway address
2.Linux Gateway on IP Routing and forwarding
Temporarily open :
echo 1 > /proc/sys/net/ipv4/ip_forward
or
sysctl -w net.ipv4.ip_forward=1 The two methods
Permanently open :
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1 Write this line to the configuration file
sysctl -p The modified configuration will be taken
1.4SNAT transformation 1: Fixed public network IP Address
1.iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -o ens37 -j SNAT --to 10.0.0.1
2.ptables -t nat -A POSTROUTING -s 192.168.100.0/24 -o ens37 -j SNAT --to-source 10.0.0.1-10.0.0.10 Two kinds of
3.192.168.100.0/24 Intranet ip , -o Outbound extranet card ens37 ,10.0.0.1-10.0.0.10 Extranet ip Or address pool
1.5 Small knowledge expansion
One ip Address do SNAT transformation , You can usually let the intranet 100 To 200 This host can access the Internet
1.6DNAT experiment
1.6.1 Install two machines first httpd Service and iptables service


1.6.2 Change the original network to user-defined mode and add an additional network card


1.6.3 modify ens33 and ens37 And restart



1.6.4 Permanent open IP Route forwarding


1.6.5SNAT transformation : Fixed public network IP Address

1.6.6 Modify the network card of the second machine and restart



install apache Service and verify 
1.6.7 modify windows To configure


1.6.8 The verification results

2.DNAT Conversion prerequisites
2.1DNAT Conversion prerequisites
1. LAN servers can access Internet
2. The gateway's Internet address is correct DNS Parsing records
3Linux Gateway on IP Routing and forwarding
open DNAT
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p2.2DNAT Application environment
1. stay Internet Publish servers located in the LAN
2.3DNAT principle
1. Modify the destination address of the packet
2.4DNAT transformation 1: Publishing Intranet Web service
1.# Take from ens33 Come in and visit web The destination address of the service packet is converted to 192.168.100.118
iptables -t nat -A PREROUTING -i ens33 -d 12.0.0.1 -p tcp--dport 80 -j DNAT --to 192.168.100.118
or
2.iptables -t nat -A PREROUTING -i ens33 -d 12.0.0.1 -p tcp--dport 80-j DNAT --to-destination 192.168.100.118
Inbound | The network card | Extranet ip Intranet server ip
2.5DNAT transformation 2∶ Modify the target port when publishing
1.# Publish the information inside the LAN OpenSSH The server , The external network host needs to use 250 Port to connect
iptables-t nat -A PREROUTING -i ens33 -d 12.0.0.1 -p tcp--dport 250-jDNAT --to 192.168.100.102:22
2.6DNT Case study
2.6.1 modify window Network configuration


2.6.2 Modify the network card of the second virtual machine and restart
![]()
![]()


2.6.3 Set up DNAT transformation 
2.6.4 The verification results

3. summary
SNAT And DNAT It is a perfect interpretation of firewall data transmission
边栏推荐
- Some attention code explanations
- Why do I choose to use go language?
- 数据库优化——深入理解Mysql索引底层数据结构与算法
- Shell编程之Sed
- Zero foundation uses unity3d to develop AR applications and download 3D models remotely
- 【presto 】presto 新版本升级详情
- Linear algebra and matrix theory (10)
- Selection and application of capacitor in high speed circuit -- detailed explanation
- Introduction to vscade interface
- Verilog daily question (vl5 signal generator)
猜你喜欢

Vscode界面介绍

Goweb开发之Beego框架实战:第二节 项目初始化配置

Verilog 每日一题(VL6 数据串转并电路)

wpf命令按钮透明样式

Introduction to vscade interface

Verilog daily question (vl4 shift operation and multiplication)

Zero foundation uses unity3d to develop AR applications and download 3D models remotely

Vscode uses eslint prettier to format code automatically

Analysis of kubernetes service principle

Verilog daily question (VL2 asynchronous reset Series T trigger - Niuke network)
随机推荐
[CDH] configure CDH components through clouderamanager and collect JMX information with Prometheus monitoring
异步电路设计--同步脉冲器原理及例题
Several methods of importing excel file data by C #
Uparse rich text style of uni app
C # traversal set
线性代数及矩阵论(八)
C#遍历集合
MySQL detailed learning tutorial (recommended Collection)
线性代数及矩阵论(七)
Andthen of function interface
Reasoning Over Semantic-Level Graph for Fact Checking
Vscode uses eslint prettier to format code automatically
2021年4月份自考
Verilog daily question (VL2 asynchronous reset Series T trigger - Niuke network)
微信小程序现金红包返回“IP地址非你在商户平台设置的可用IP地址”错误终极解决方法
Jupyter notebook win installation record
Verilog daily question (vl14 vending machine 1 -- FSM common question types)
高速电路设计实践——概述
Janus series article 3 API usage guide videoroom creating a new video room
Asynchronous circuit design -- principle and example of synchronous pulser