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

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - 駔ω迹

运行yum系统提示Existing lock /var/run/yum.pid: another copy is running as pid 3046 centos 5.3 搭建vsftpd centos 5.3 配置sendmail服务器 Centos 5.3 配置DNS服务器 CBC网络收音地址以及SOPCAST凤凰台地址 Xmanager 配置 萨姆经营企业的规则 反省 grub error 解决办法 linux 刻录软件 创建linux磁盘配额 鸟哥超级路由脚本 - 駔ω迹 - 博客园 Linux服务器安全 在linux系统下新增硬盘 kernel 2.6 support acl 2003批量创建域用户帐号 域控制器灾难恢复 网页,邮箱,有些字显示不出来!!! 致自己的一封信
linux 做NAT上网
駔ω迹 · 2009-01-20 · via 博客园 - 駔ω迹

第一步:设置网卡

(1)eth1是对外的外网网卡,ip地址为202.101.103.55

eth0对内的内网网卡,ip地址为192.168.1.0

(2)加入nat客户端ip和名称

vi /etc/hosts

格式为:
ip地址 主机名

127.0.0.1 host

(3)指定内网网关

vi /etc/sysconfig/network
gateway=202.101.103.1 #(网关地址,假如服务端的外网为拨号,就不要指定)

(4)设置DNS服务器
vi /etc/resolv.conf
格式为
nameserver ip地址
nameserver 127.0.0.1  

nameserver 202.101.103.54

(5)route -a #察看路由表,看一下默认网关是否为202.101.103.1 

 第二步:

在/etc/sysconfig/network 中已经加入了

FORWARD_IPV4=YES

echo "1" > /etc/proc/sys/net/ipv4/ip_forward (注:比较重要,开启转换功能)

第三步:

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1-j SNAT --to 202.101.103.55  (eth1 是外接口,eth0 是内接口)[只是外网是固定IP]

如果是adsl 用 iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

iptables -L 显示当前已经设置好的防火墙规则
iptables -t nat -L 显示当前NAT的防火墙规则
[root@tp ~]# /etc/rc.d/init.d/iptables save (保存规则,不然重启就没了)
[root@tp ~]# service iptables restart