惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
T
The Blog of Author Tim Ferriss
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
爱范儿
爱范儿
GbyAI
GbyAI
H
Help Net Security
I
InfoQ
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
P
Privacy & Cybersecurity Law Blog
A
Arctic Wolf
Know Your Adversary
Know Your Adversary
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tor Project blog
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
G
GRAHAM CLULEY
K
Kaspersky official blog
T
Tailwind CSS Blog
T
Threat Research - Cisco Blogs
博客园 - Franky
D
Docker
Security Latest
Security Latest
I
Intezer
有赞技术团队
有赞技术团队
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 【当耐特】
B
Blog RSS Feed
T
The Exploit Database - CXSecurity.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - NetSoft

java - 环境变量 ubuntu - 网络文件夹访问 ubuntu - 查看硬盘占用情况 ubuntu - 查看系统资源占用(内存,cpu和进程) ubuntu - 配置IP地址 Ubuntu - 切换到管理员(root)身份 ubuntu - 下更改语言环境 reporting server改名 facebook是如何管理代码的 SIM卡编号的含意 vi编辑器常用的命令及快捷键 IIS 问题 64位windows 2003环境UNC部署权限设置 Linux常用的压缩及解压缩命令如表2-5所示。 Esxi开启putty链接 Android系统中自带的图标 Unparsed aapt error(s)! Check the console for output解决方法 - NetSoft Eclipse自动拷贝SVN的.SVN目录到bin目录问题的解决 - NetSoft - 博客园 浅议DAS、NAS、SAN区别(转载)
Ubuntu iptables 内网端口映射
NetSoft · 2010-09-26 · via 博客园 - NetSoft

1.系统环境

内网两台服务器:

A 172.16.119.128

B 172.16.119.129

希望将A机器的80端口映射到B机器的8013端口。 

2.设置步骤

2.1./etc/sysctl.conf配置文件修改

删除“# net.ipv4.ip_forward = 1”行前面的“#”。 默认该行被注释掉的。

2.2.查看现有配置信息

iptables -L

如果显示内容如下:

Chain INPUT (policy ACCEPT)

target     prot opt source               destination

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination

表示无任何设置,可以继续下一步操作。

否则执行:

iptalbes -F

iptalbes -X

iptalbes -Z 

2.3.设置端口映射

分别执行: 

iptables -t nat -A PREROUTING -d 172.16.119.128 -p tcp --dport 80 -j DNAT --to-destination 172.16.119.129:8013

iptables -t nat -A POSTROUTING -d 172.16.119.129 -p tcp --dport 8013 -j SNAT --to 172.16.119.128

iptables -A FORWARD -o eth0 -d 172.16.119.129 -p tcp --dport 8013 -j ACCEPT

iptables -A FORWARD -i eth0 -s 172.16.119.129 -p tcp --sport 8013 -j ACCEPT

4.验证端口映射

此时,访问http://172.16.119.128/abc.htm,应该能访问到对应129服务器上端口为8013网站的abc.htm页面。 

 
3.设置开机自动加载iptables的配置文件

3.1 保存配置

执行命令: 

# iptables-save > /etc/init.d/iptables.up.rules

将当前配置保存再iptables.up.rules文件中,文件名可以自己决定。

3.2 修改网卡配置文件

在网卡IP配置文件/etc/network/interfaces末行加入(/etc/init.d/iptables.up.rules可改成自己定义的配置文件位置和名称)

pre-up iptables-restore < /etc/init.d/iptables.up.rules

3.3 重启服务器验证

shutdown -r now