免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5893 | 回复: 16
打印 上一主题 下一主题

我的PF死活nat不出去! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-24 09:49 |只看该作者 |倒序浏览
2可用积分

  1. # ifconfig
  2. lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33224
  3.         groups: lo
  4.         inet 127.0.0.1 netmask 0xff000000
  5.         inet6 ::1 prefixlen 128
  6.         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
  7. rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  8.         lladdr 00:0e:1f:01:13:3c
  9.         media: Ethernet autoselect (100baseTX full-duplex)
  10.         status: active
  11.         inet6 fe80::20e:1fff:fe01:133c%rl0 prefixlen 64 scopeid 0x1
  12. ne3: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  13.         lladdr 00:40:26:5f:4d:9a
  14.         media: Ethernet autoselect (10baseT)
  15.         inet 192.168.188.1 netmask 0xffffff00 broadcast 192.168.188.255
  16.         inet6 fe80::240:26ff:fe5f:4d9a%ne3 prefixlen 64 scopeid 0x2
  17. pflog0: flags=0<> mtu 33224
  18. enc0: flags=0<> mtu 1536
  19. tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1488
  20.         groups: tun egress
  21.         inet 192.168.135.234 --> 10.5.5.5 netmask 0xffffffff
复制代码

  1. # pfctl -sa
  2. TRANSLATION RULES:
  3. nat on tun0 inet from 192.168.188.0/24 to any -> (tun0) round-robin

  4. FILTER RULES:
  5. scrub in all fragment reassemble
  6. pass in quick all flags S/SA keep state
  7. pass out quick all flags S/SA keep state
  8. No queue in use

  9. STATES:
  10. all udp 255.255.255.255:5678 <- 192.168.0.25:5678       NO_TRAFFIC:SINGLE
  11. all udp 192.255.255.255:138 <- 192.168.18.79:138       NO_TRAFFIC:SINGLE
  12. all udp 192.168.18.255:138 <- 192.168.18.222:138       NO_TRAFFIC:SINGLE
  13. all tcp 220.181.29.154:80 <- 192.168.188.8:1156       CLOSED:SYN_SENT
  14. all tcp 192.168.188.8:1156 -> 192.168.135.234:53878 -> 220.181.29.154:80       ESTABLISHED:SYN_SENT
  15. all udp 192.168.18.255:138 <- 192.168.18.111:138       NO_TRAFFIC:SINGLE
  16. all udp 192.168.255.255:138 <- 192.168.18.170:138       NO_TRAFFIC:SINGLE
  17. all udp 192.168.18.255:138 <- 192.168.18.1:138       NO_TRAFFIC:SINGLE
  18. all udp 192.255.255.255:137 <- 192.168.18.3:137       NO_TRAFFIC:SINGLE
  19. all tcp 202.108.22.46:80 <- 192.168.188.8:1157       CLOSED:SYN_SENT
  20. all tcp 192.168.188.8:1157 -> 192.168.135.234:50692 -> 202.108.22.46:80       ESTABLISHED:SYN_SENT
  21. all icmp 61.144.56.100:512 <- 192.168.188.8       0:0
  22. all udp 192.255.255.255:138 <- 192.168.18.117:138       NO_TRAFFIC:SINGLE
  23. all udp 192.255.255.255:138 <- 192.168.18.72:138       NO_TRAFFIC:SINGLE
  24. all udp 192.255.255.255:137 <- 192.168.18.72:137       NO_TRAFFIC:SINGLE
  25. all udp 192.168.18.255:137 <- 192.168.18.199:137       NO_TRAFFIC:SINGLE

  26. INFO:
  27. Status: Enabled for 0 days 00:18:59           Debug: Urgent

  28. State Table                          Total             Rate
  29.   current entries                       16
  30.   searches                            7255            6.4/s
  31.   inserts                              577            0.5/s
  32.   removals                             561            0.5/s
  33. Counters
  34.   match                               4330            3.8/s
  35.   bad-offset                             0            0.0/s
  36.   fragment                               0            0.0/s
  37.   short                                  0            0.0/s
  38.   normalize                              0            0.0/s
  39.   memory                                 0            0.0/s
  40.   bad-timestamp                          0            0.0/s
  41.   congestion                             0            0.0/s
  42.   ip-option                              0            0.0/s
  43.   proto-cksum                            0            0.0/s
  44.   state-mismatch                       265            0.2/s
  45.   state-insert                           0            0.0/s
  46.   state-limit                            0            0.0/s
  47.   src-limit                              0            0.0/s
  48.   synproxy                               0            0.0/s

  49. TIMEOUTS:
  50. tcp.first                   120s
  51. tcp.opening                  30s
  52. tcp.established           86400s
  53. tcp.closing                 900s
  54. tcp.finwait                  45s
  55. tcp.closed                   90s
  56. tcp.tsdiff                   30s
  57. udp.first                    60s
  58. udp.single                   30s
  59. udp.multiple                 60s
  60. icmp.first                   20s
  61. icmp.error                   10s
  62. other.first                  60s
  63. other.single                 30s
  64. other.multiple               60s
  65. frag                         30s
  66. interval                     10s
  67. adaptive.start             6000 states
  68. adaptive.end              12000 states
  69. src.track                     0s

  70. LIMITS:
  71. states        hard limit    10000
  72. src-nodes     hard limit    10000
  73. frags         hard limit     5000
  74. tables        hard limit     1000
  75. table-entries hard limit   200000

  76. TABLES:

  77. OS FINGERPRINTS:
  78. 696 fingerprints loaded
  79. #
复制代码

-------------------------------------

  1. D:\>ipconfig

  2. Windows IP Configuration
  3. Ethernet adapter 本地连接:

  4.         Connection-specific DNS Suffix  . :
  5.         IP Address. . . . . . . . . . . . : 192.168.188.8
  6.         Subnet Mask . . . . . . . . . . . : 255.255.255.0
  7.         Default Gateway . . . . . . . . . : 192.168.188.1

  8. D:\>
复制代码

论坛徽章:
0
2 [报告]
发表于 2007-09-24 09:55 |只看该作者
这个静态路由表,是不是有问题啊??
STATES:
all udp 255.255.255.255:5678 <- 192.168.0.25:5678       NO_TRAFFIC:SINGLE
all udp 192.255.255.255:138 <- 192.168.18.79:138       NO_TRAFFIC:SINGLE
all udp 192.168.18.255:138 <- 192.168.18.222:138       NO_TRAFFIC:SINGLE
all tcp 220.181.29.154:80 <- 192.168.188.8:1156       CLOSED:SYN_SENT
all tcp 192.168.188.8:1156 -> 192.168.135.234:53878 -> 220.181.29.154:80       ESTABLISHED:SYN_SENT
all udp 192.168.18.255:138 <- 192.168.18.111:138       NO_TRAFFIC:SINGLE
all udp 192.168.255.255:138 <- 192.168.18.170:138       NO_TRAFFIC:SINGLE
all udp 192.168.18.255:138 <- 192.168.18.1:138       NO_TRAFFIC:SINGLE
all udp 192.255.255.255:137 <- 192.168.18.3:137       NO_TRAFFIC:SINGLE
all tcp 202.108.22.46:80 <- 192.168.188.8:1157       CLOSED:SYN_SENT
all tcp 192.168.188.8:1157 -> 192.168.135.234:50692 -> 202.108.22.46:80       ESTABLISHED:SYN_SENT
all icmp 61.144.56.100:512 <- 192.168.188.8       0:0
all udp 192.255.255.255:138 <- 192.168.18.117:138       NO_TRAFFIC:SINGLE
all udp 192.255.255.255:138 <- 192.168.18.72:138       NO_TRAFFIC:SINGLE
all udp 192.255.255.255:137 <- 192.168.18.72:137       NO_TRAFFIC:SINGLE
all udp 192.168.18.255:137 <- 192.168.18.199:137       NO_TRAFFIC:SINGLE

论坛徽章:
0
3 [报告]
发表于 2007-09-24 09:57 |只看该作者
:wink: 規則?

论坛徽章:
0
4 [报告]
发表于 2007-09-24 10:01 |只看该作者
原帖由 gofans 于 2007-9-24 09:57 发表
:wink: 規則?

  1. 规则大概是这样吧
  2. Ext="tun0"
  3. Int="ne3"
  4. internal_net="192.168.188.0/24"
  5. scrub in all
  6. nat on $Ext from $internal_net to any -> ($Ext)
  7. pass in quick all
  8. pass out quick all
复制代码

论坛徽章:
0
5 [报告]
发表于 2007-09-24 10:09 |只看该作者
規則改成這樣試試!! 但是建議把外網的IP不要搞成192.168.x.x段,會比較好!!
ext_if="tun0"
nat on $ext_if from 192.168.188.0/24  to any -> ($ext_if)
pass in all
pass out all

论坛徽章:
0
6 [报告]
发表于 2007-09-24 10:25 |只看该作者
原帖由 gofans 于 2007-9-24 10:09 发表
規則改成這樣試試!! 但是建議把外網的IP不要搞成192.168.x.x段,會比較好!!
ext_if="tun0"
nat on $ext_if from 192.168.188.0/24  to any -> ($ext_if)
pass in all
pass out all


192.168.x.x是内网IP,外网的网卡rl0 没有设置IP

论坛徽章:
0
7 [报告]
发表于 2007-09-24 10:29 |只看该作者
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1488
        groups: tun egress
        inet 192.168.135.234 --> 10.5.5.5 netmask 0xffffffff



就是你的外網啊!!! 建議看看pf faq!!  http://www.openbsd.org/faq/pf/

论坛徽章:
0
8 [报告]
发表于 2007-09-24 10:31 |只看该作者
原帖由 gofans 于 2007-9-24 10:29 发表
tun0: flags=8051 mtu 1488
        groups: tun egress
        inet 192.168.135.234 --> 10.5.5.5 netmask 0xffffffff



就是你的外網啊!!! 建議看看pf faq!!  http://www.openbsd.org/faq/pf/

这个不是我弄的,是pppoe拨号上去之后自动获取的

论坛徽章:
0
9 [报告]
发表于 2007-09-24 10:35 |只看该作者
没开启路由功能吧

论坛徽章:
0
10 [报告]
发表于 2007-09-24 10:37 |只看该作者
原帖由 就不改 于 2007-9-24 10:35 发表
没开启路由功能吧

开启路由?
请问怎么开启? 不是直接使用pf的nat功能就可以了nat出去的吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP