Chinaunix

标题: iptables 做nat,客户端无法上网 [打印本页]

作者: superwujc    时间: 2013-05-08 18:25
标题: iptables 做nat,客户端无法上网
环境:CentOS 6.4 64 bit,双网卡,内网1.1.1.1/24,外网192.168.1.80/24
iptables策略
  1. iptables -t nat -A POSTROUTING -s 1.1.1.0/24 -o eth0 -j MASQUERADE
复制代码
  1. [root@localhost ~]# sysctl -p
  2. net.ipv4.ip_forward = 1
  3. net.ipv4.conf.default.rp_filter = 1
  4. net.ipv4.conf.default.accept_source_route = 0
  5. kernel.sysrq = 0
  6. kernel.core_uses_pid = 1
  7. net.ipv4.tcp_syncookies = 1
  8. error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
  9. error: "net.bridge.bridge-nf-call-iptables" is an unknown key
  10. error: "net.bridge.bridge-nf-call-arptables" is an unknown key
  11. kernel.msgmnb = 65536
  12. kernel.msgmax = 65536
  13. kernel.shmmax = 68719476736
  14. kernel.shmall = 4294967296
复制代码
客户端,centos 6.4,ip,1.1.1.7/24,网关1.1.1.1,dns 1.1.1.1,与服务器可以ping通,仍然无法ping通baidu.com等外网

请教各位这是什么问题,谢谢。
作者: chenyx    时间: 2013-05-08 19:57
你先将iptables所有规则清空,所有链的默认规则都设置成ACCEPT,然后自添加你的那个iptables规则,测试
作者: superwujc    时间: 2013-05-09 10:19
回复 2# chenyx

多谢楼上,问题已经解决
原来是本地dns指向的问题,原来的配置是作为nat server的内网卡地址,而nat server并没有配置dns,所以无法解析
在nat server上启用dns,或在本地的resolv.conf中配置成公网dns就可以了

谢谢。
   
作者: chenyx    时间: 2013-05-09 20:22
本帖最后由 chenyx 于 2013-05-09 20:23 编辑

原来是dns的问题,我还以为是你nat做的有问题




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2