论坛风格切换切换到宽版
  • 594阅读
  • 4回复

[问题求助]用iptables作nat的问题 [复制链接]

上一主题 下一主题
离线cylczzj.
 
发帖
2088
C币
-60539
威望
413
贡献值
1
银元
-4
铜钱
4850
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
1、.你无需.设置 NAT,只需要设置 routing 就可以了<性病>
2、1.11 .和 0.12 的网.关都必须指向这个 Linux.
3、echo 1 >; /p.roc/sys/net/ipv4/ip_forward,需要启用内核的路由转.发功能    外汇

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线session1987.
发帖
1990
C币
-61049
威望
329
贡献值
1
银元
-2
铜钱
4261
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13


QUOTE:原帖由 "hongw" 发表:


关键是这句,以前系统这句放在rc.local里,我给忘啦。下午在坛子里搜半天关键字iptables都没解决,我真猪头。在次谢谢老大!
   谁教你把这句放在 rc.local里的?

离线hekate.
发帖
2011
C币
-60972
威望
352
贡献值
1
银元
-2
铜钱
4292
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
/etc/init.d/rc.net

iptables=/sbin/iptables
iptables --flush -t nat
iptables --t nat -A POSTROUTING -p tcp -o eth0 -j MASQUERADE
iptables --t nat -A POSTROUTING -p udp -o eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 >; /proc/sys/net/ipv4/ip_forward
然后让他开机就跑

离线lj790816.
发帖
1941
C币
-139573
威望
326
贡献值
1
银元
0
铜钱
4299
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
不用改/etc/sysctl.conf, 这是我的
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl( and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

我现在正在使用

离线呼唤.
发帖
2030
C币
-60609
威望
360
贡献值
1
银元
-1
铜钱
4475
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13


QUOTE:原帖由 "ljj1998" 发表:
不用改/etc/sysctl.conf, 这是我的
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

我现在正在使用

要么你没看懂楼主要实现什么,要么你是在开玩笑吧?
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
上一个 下一个