strange routing / nat behavior

0 views
Skip to first unread message

Zhang Weiwu

unread,
Oct 7, 2009, 10:16:44 AM10/7/09
to debian-c...@lists.debian.org
这个问题很奇怪的。我在兰州家中的电脑使用铁通拨号上网,modem后接了一台路由器(NAT防火墙),
路由器上接Linux主机。表现很奇怪。如果连接到北京的一台服务器上,用who命令显示自己IP地址
为123.138.24.244;如果连接到香港一台服务器上,用who命令显示自己IP地址为123.81.20.79。

如下:

zhangweiwu@zhangweiwu-laptop:~$ ssh zhang...@www.linuxbanks.cn
zhang...@www.linuxbanks.cn's password:
Linux casablanca 2.6.18.1-fl2f-v1.02 #41 Thu Jul 3 10:13:18 CST 2008
mips64

The programs included with the Debian GNU/Linux system are free
software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Wed Oct 7 22:03:36 2009 from 123.138.24.244
zhangweiwu@casablanca:~$ date; who
Wed Oct 7 22:09:06 CST 2009
zhangweiwu tty1 2009-09-23 20:53
zhangweiwu tty3 2009-09-24 08:49
zhangweiwu pts/6 2009-10-07 22:09 (123.138.24.244)
zhangweiwu@casablanca:~$ logout
Connection to www.linuxbanks.cn closed.
zhangweiwu@zhangweiwu-laptop:~$ ssh rea...@123.108.108.80
Enter passphrase for key '/home/zhangweiwu/.ssh/id_dsa':
Linux www.german-company-directory.com 2.6.18-6-686 #1 SMP Sun Feb 10
22:11:31 UTC 2008 i686

The programs included with the Debian GNU/Linux system are free
software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
Last login: Wed Oct 7 21:26:47 2009 from 123.116.123.210
realss@www:~$ date; who
Wed Oct 7 21:29:40 CST 2009
realss pts/0 2009-10-07 21:18 (123.116.123.210)
realss pts/1 2009-10-07 21:29 (123.81.20.79)
realss@www:~$ logout
Connection to www.german-company-directory.com closed.

这种情况,说明从兰州到北京经过了masquerade,到香港则没有。换言之如果在这个兰州
家中电脑上运行一个网站,香港人可以看到,大陆人看不到。实际使用nc试着做个“网站”
也证实了这个猜测。

问题一:这种奇怪的情况,有谁之前发现过?我在北京家中电脑上无法重现这个问题,
即如果北京家中电脑上运行一个网站,那么兰州和香港都能访问。

问题二:这种奇怪的设置有什么用意呢?我只能想到这样把国内的amule网络堵上了。

Alan Guo

unread,
Oct 7, 2009, 12:47:11 PM10/7/09
to debian-c...@lists.debian.org, debian-c...@lists.debian.org
traceroute 一下, 看看到达北京和香港的路径有什么不一样.

BTW: 在你家里路由器上public ip是什么?

2009/10/7 Zhang Weiwu <zhang...@realss.com>



--
Alan Guo
http://bluestone.cublog.cn

Zhang Weiwu

unread,
Oct 7, 2009, 11:03:13 PM10/7/09
to Alan Guo, debian-c...@lists.debian.org
Alan Guo wrote:
> traceroute 一下, 看看到达北京和香港的路径有什么不一样.
>
根本没用,不知道什么原因:

root@zhangweiwu-laptop:~# traceroute www.linuxbanks.cn
traceroute to www.linuxbanks.cn (123.116.123.210), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
root@zhangweiwu-laptop:~# traceroute 123.108.108.80
traceroute to 123.108.108.80 (123.108.108.80), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *


> BTW: 在你家里路由器上public ip是什么?
123.81.20.79,和香港服务器上显示的一样。


--
To UNSUBSCRIBE, email to debian-chine...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Liang Guo

unread,
Oct 8, 2009, 1:26:37 AM10/8/09
to Zhang Weiwu, debian-c...@lists.debian.org

ssh 到北京, 在北京的服务器上运行
netstat -an|grep \:22

看看连接到服务器22端口的ip地址是否是你的路由上的public ip地址, 如果不是, 则在网络的某个地方做了NAT,

这种情况在公网上似乎不可能发生.

这种配置技术是可以实现, 但是无法带来任何好处.

2009/10/8 Zhang Weiwu <zhang...@realss.com>



--
Liang Guo
http://bluestone.cublog.cn

Zhang Weiwu

unread,
Oct 8, 2009, 1:30:23 AM10/8/09
to Liang Guo, debian-c...@lists.debian.org
Liang Guo wrote:
>
> ssh 到北京, 在北京的服务器上运行
> netstat -an|grep \:22
>
> 看看连接到服务器22端口的ip地址是否是你的路由上的public ip地址,
不是。首贴说到用nc测试过,就可以肯定做了nat了。

> 如果不是, 则在网络的某个地方做了NAT,
>
> 这种情况在公网上似乎不可能发生.
>
> 这种配置技术是可以实现, 但是无法带来任何好处.
我的问题就是这个,为什么要这样做呢?

Alex Zhang

unread,
Oct 8, 2009, 1:40:15 AM10/8/09
to Zhang Weiwu, Liang Guo, debian-c...@lists.debian.org

2009/10/8 Zhang Weiwu <zhang...@realss.com>

Liang Guo wrote:
>
> ssh 到北京, 在北京的服务器上运行
> netstat -an|grep \:22
>
> 看看连接到服务器22端口的ip地址是否是你的路由上的public ip地址,
不是。首贴说到用nc测试过,就可以肯定做了nat了。
> 如果不是, 则在网络的某个地方做了NAT,
>
> 这种情况在公网上似乎不可能发生.
>
> 这种配置技术是可以实现, 但是无法带来任何好处.
我的问题就是这个,为什么要这样做呢?
我也遇到过这种情况,在山东聊城家里ssh到除了PKU的任意计算机都显示
我的公网IP,但是联PKU的VPN显示的IPAddress是“上海市超级计算中心”
我也不理解这有什么好处。家里的是电信ADSL。
我想到了一个问题:跨运行商流量结算的费用问题,据我所知这个的费用
比较高,是不是ISP出于成本考虑呢?至少CERNET和公网的结算费用众
所周知。换便宜的ISP路由?

Liang Guo

unread,
Oct 8, 2009, 1:41:57 AM10/8/09
to Alex Zhang, Zhang Weiwu, debian-c...@lists.debian.org
看来是非技术因素, 这就很难说了.

2009/10/8 Alex Zhang <cheun...@gmail.com>

Zhang Weiwu

unread,
Oct 8, 2009, 2:04:28 AM10/8/09
to Alex Zhang, Liang Guo, debian-c...@lists.debian.org
Alex Zhang wrote:
> 我也遇到过这种情况,在山东聊城家里ssh到除了PKU的任意计算机都显示
> 我的公网IP,但是联PKU的VPN显示的IPAddress是“上海市超级计算中心”
这种网络结构很制造麻烦的,我现在不便使用ekiga电话了,因为传入兰州的呼叫没办法处理。

从下面记录可以看出,从兰州到北京,在山西或陕西处做了NAT。


$ whois 123.138.24.244

% [whois.apnic.net node-2]
% Whois data copyright terms http://www.apnic.net/db/dbcopyright.html

inetnum: 123.138.0.0 - 123.139.255.255
netname: UNICOM-SN
descr: China Unicom Shannxi province network
descr: China Unicom
country: CN
admin-c: CH1302-AP
tech-c: CH679-AP
remarks: service provider
status: ALLOCATED PORTABLE
mnt-by: APNIC-HM
mnt-lower: MAINT-CNCGROUP-SN
mnt-routes: MAINT-CNCGROUP-RR
remarks: -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
remarks: This object can only be updated by APNIC hostmasters.
remarks: To update this object, please contact APNIC
remarks: hostmasters and include your organisation's account
remarks: name in the subject line.
remarks: -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
changed: hm-ch...@apnic.net 20070228
changed: hm-ch...@apnic.net 20090508
source: APNIC

route: 123.138.0.0/15
descr: CNC Group CHINA169 Shanni Province Network
country: CN
origin: AS4837
mnt-by: MAINT-CNCGROUP-RR
changed: ab...@cnc-noc.net 20070228
source: APNIC

person: ChinaUnicom Hostmaster
nic-hdl: CH1302-AP
e-mail: ab...@chinaunicom.cn
address: No.21,Jin-Rong Street
address: Beijing,100140
address: P.R.China
phone: +86-10-66259940
fax-no: +86-10-66259764
country: CN
changed: ab...@chinaunicom.cn 20090408
mnt-by: MAINT-CNCGROUP
source: APNIC

person: CNCGroup-SN Hostmaster
nic-hdl: CH679-AP
e-mail: qu...@china-netcom.com
address: China Network Communication ,SVT
address: NO.2 GuangDe Road, High Tec Zone
address: Xi'an, Shannxi, China
phone: +86-29-88192060
fax-no: +86-29-88192037
country: CN
changed: qu...@china-netcom.com 20060119
mnt-by: MAINT-CNCGROUP-SN
source: APNIC

Reply all
Reply to author
Forward
0 new messages