免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: dzbjet
打印 上一主题 下一主题

3个网络的访问问题 [复制链接]

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
11 [报告]
发表于 2009-04-21 17:50 |只看该作者
晕,缺省路由啊 。

论坛徽章:
0
12 [报告]
发表于 2009-04-22 01:12 |只看该作者
这样?
A网关:
route add default gw 172.19.20.21 tunnel0
其中172.19.20.21是B网的网关,也就是ip tunnel连接的另一端。

A网关对其子网内发往公网的ip数据包,首先做SNAT,换src mac,src ip
然后,根据dest ip,查路由表,发现是到外网的,因此匹配缺省路由,即
上面所写的default gw 172.19.20.21,但是该网关不是一跳直接到的,可以吗?
另外,假设可以,那么交给ip tunnel tunnel0网络接口处理,由此tennel0接口进行封装,
添加最外一层ip头部,src ip是自己,dest ip是172.19.20.21,dest mac是下一跳的路由器的mac,
ok?

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
13 [报告]
发表于 2009-04-22 07:59 |只看该作者
你完全搞混了。

论坛徽章:
0
14 [报告]
发表于 2009-04-22 09:25 |只看该作者

回复 #13 ssffzz1 的帖子

你给个方案吧,如果你可以的话。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
15 [报告]
发表于 2009-04-22 09:36 |只看该作者
你tunnel的TUN源和TUN目的应该是B网段的地址,这个之间的路由是通过主机路由做通的。
TUNNEL自身的地址段你要重新分配的。
C路由器指定到A的下一条是要指定TUNNEL出口或者TUNNEL对端IP的,而不是B网的地址。同样A也要这么指定的。

说你搞乱了不是这个方案不行,而是你吧参数的作用搞混了。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
16 [报告]
发表于 2009-04-22 09:37 |只看该作者
你把隧道内部地址和隧道外部的搞混淆了。

论坛徽章:
0
17 [报告]
发表于 2009-04-22 11:42 |只看该作者
Let's say you have 3 networks: Internal networks A and B, and intermediate network C (or let's say, Internet). So we have network A:

network 10.0.1.0
netmask 255.255.255.0
router  10.0.1.1

The router has address 172.16.17.18 on network C.

and network B:

network 10.0.2.0
netmask 255.255.255.0
router  10.0.2.1

The router has address 172.19.20.21 on network C.

As far as network C is concerned, we assume that it will pass any packet sent from A to B and vice versa. You might even use the Internet for this.

Here's what you do:

First, make sure the modules are installed:

insmod ipip.o
insmod new_tunnel.o

Then, on the router of network A, you do the following:

ifconfig tunl0 10.0.1.1 pointopoint 172.19.20.21
route add -net 10.0.2.0 netmask 255.255.255.0 dev tunl0

And on the router of network B:

ifconfig tunl0 10.0.2.1 pointopoint 172.16.17.18
route add -net 10.0.1.0 netmask 255.255.255.0 dev tunl0



我没有搞混吧,上面的例子,对于我来说,就是如何
route add -net default  dev tunl0

是否可行的问题。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP