• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

SO_ORIGINAL_DST, good news

发布: 2007-7-04 12:06 | 作者: admin | 来源:  网友评论 | 查看: 19次 | 进入软件测试论坛讨论

领测软件测试网 SO_ORIGINAL_DST, good news

hellwolf|misty Hi every one who can tell me exactly what implicit source local NAT is?
jengelh well
jengelh at least it's taken out
jengelh -t nat -A OUTPUT -j DNAT --to-dest (non-127.0.0.1)
jengelh that would require to modify the source address _within_ DNAT, that's "implicit source local nat"
jengelh and it's been taken out in 2.6.12
jengelh but I think there is a workaround to get it back
hellwolf|misty And when I do so, I will get a kernel message:NAT: packet src %u.%u.%u.%u -> dst %u.%u.%u.%u\n,and I never understand what does it mean...
jengelh Yeah that's it
jengelh though
hellwolf|misty yeah thanks. And another question,# iptables -t nat  -I OUTPUT -d 1.2.3.4 -j DNAT --to 127.0.0.1. # nc -vvv -l  8888 &
hellwolf|misty [1] 2038
hellwolf|misty # nc 1.2.3.4 8888&
hellwolf|misty [2] 2039,I will get tcp        0      0 127.0.0.1:8888              222.185.xx.xx:1025. the port 1025 looks so strange
jengelh the messagei s
jengelh                 printk("NAT: no longer support implicit source local NAT\n");
jengelh                 printk("NAT: packet src %u.%u.%u.%u -> dst %u.%u.%u.%u\n",
jengelh hm DNAT to 127.0.0.1 should work though
jengelh and in fact, works for me
jengelh well, if -s 127.0.0.1 and -d 127.0.0.1
jengelh --
jengelh NAT: no longer support implicit source local NAT
jengelh NAT: packet src 127.0.0.1 -> dst 192.168.222.34
jengelh iptables -t nat -A OUTPUT -d wideland -p tcp --dport 23 -j DNAT --to-dest 127.0.0.1:22
jengelh But I still get my openssh banner upon telnet wideland 23
jengelh What does not work is iptables -t nat -A OUTPUT -p tcp --dport 23 -j DNAT --to-dest 192.168.222.34:139 (no message either)
hellwolf|misty Now I have a application that listen on port 8888, and I REDIERCT all Local connection to this port, I want this appliction know where they wanto go
hellwolf|misty I try to collect those information from /proc/net/ip_conntrack
jengelh What?
jengelh Please state your redirect wish
hellwolf|misty Sorry for my broken english.--;;
jengelh it's fine
hellwolf|misty I have application A that listen on port 8888, and -I OUTPUT -j REDIRECT --to-ports 8888. And now I want  A know where the connection really want to go(if not REDIRECTED)
jengelh where it came from?
hellwolf|misty local
hellwolf|misty local output
jengelh yes, yes -t nat -I OUTPUT always comes from 127.0.0.1...
jengelh -j REDIRECT => always dst=127.0.0.1
hellwolf|misty well, for instance: nc www.google.com 80, it REDIRECT to localhost:8888,and A capture this connect, and how can A know I want to  google?
jengelh it can't
Hidden of course it _can_
hellwolf|misty But I feel that in /proc/net/ip_conntrack, there's enough infomation
hellwolf|misty Hidden: How to?
Hidden although only for TCP connection at the moment
hellwolf|misty Hidden: sounds greate
Hidden using the SO_ORIGINAL_DST socket option and getsockopt()
jengelh Yeah and by expecting the layer7 data
jengelh heh
jengelh Host: header
jengelh dammit, 8888 and 80 sounds like you want transparent proxying, try tproxy :D
hellwolf|misty THANKS all...!!
Hidden yes, but that works only for HTTP
jengelh Hidden : That's all squid needs.
hellwolf|misty only for HTTP?
Hidden you probably don't need tproxy if you don't care about transparency
Hidden hellwolf|misty: I meant the 'Host:' header jengelh has mentioned
jengelh I really need to write a new transparent proxyings howto (with all new stuff invented in 2005)
Hidden hellwolf|misty: the getsockopt() way works for all TCP connections
hellwolf|misty well, I even written a kmodule to do so. SO_ORIGINAL_DST..new to me

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网