Chinaunix

标题: v440两个网卡配置不同的ip,不同的网关,请问网关在那里配置呀? [打印本页]

作者: zcg931708    时间: 2006-01-06 23:20
标题: v440两个网卡配置不同的ip,不同的网关,请问网关在那里配置呀?
比如说,一个网卡ip为202.106.12.2,网关为202.106.12.1。 一个网卡ip为192.168.2.2网关为192.168.2.1

第一个网卡访问外网,第二个网卡访问内网。

是不是 vi /etc/defaultrouter

然后把两个网关都加进去?

或者不用加网关,就可以直接访问内网和外网?
作者: 风之幻想    时间: 2006-01-09 08:27
默认网关只能有一个.加一个/etc/gateways吧.

[ 本帖最后由 风之幻想 于 2006-1-9 14:39 编辑 ]
作者: wwxipconfig    时间: 2006-01-09 09:09
也可以把router add net 0.0.0.0 192.168.2.1   写到/etc/rc2.d/S72inet*,具体的名字我记不清楚了
作者: 为了谋生    时间: 2006-01-10 11:45
标题: 能否说具体下,我现在也遇到这个问题了
原帖由 wwxipconfig 于 2006-1-9 09:09 发表
也可以把router add net 0.0.0.0 192.168.2.1   写到/etc/rc2.d/S72inet*,具体的名字我记不清楚了

我现在也急需要解决这个问题
作者: Philmoon    时间: 2006-01-10 11:55
原帖由 风之幻想 于 2006-1-9 08:27 发表
默认网关只能有一个.加一个/etc/gateways吧.


注意:使用/etc/gateways要将/etc/defaultrouter去掉才生效
楼主的问题可以参见SA-389第6章的实习例子
作者: flutter    时间: 2006-01-10 20:22
1,如果网卡2只访问内网本网段,则很简单,网卡1写外网的地址hosts、hostname.xx0、掩码netmasks、网关defaultrouter,网卡2只写地址hostname.xx0和掩码netmasks,则有默认路由,可以满足你的要求,我在XP和SOL10下都是这样做的,一个访问外网INTERNET,一个访问内网。
2,使用双网关,一个网关写defaultrouter,一个写路由在/etc/rc2.d/S72inetsvc中:
router add net 192.168.2.0 192.168.2.1
3,两个都在在/etc/gateway中:
router add default net 202.106.12.0 202.106.12.1
router add net 192.168.2.0 192.168.2.1
作者: 风之幻想    时间: 2006-01-11 18:10
添加route add脚本的情况下,可以根据情况保留/etc/defaultrouter的.
作者: wxws2002    时间: 2006-01-12 09:07
同意FLUTTER的2,觉得这种应用较多
作者: zcg931708    时间: 2006-02-08 14:35
多谢几位大侠拔刀相助
作者: metor78    时间: 2006-02-08 15:02
Multihomed Host
To create a multihomed host:
1. Become superuser on the prospective multihomed host.
2. Create an /etc/hostname.interface file for each additional
network interface installed in the machine.
3. Type:
# touch /etc/notrouter
This creates an empty file called /etc/notrouter.
4. Reboot the machine.
When the machine reboots, the startup script looks for the presence of
the /etc/notrouter file. If the file exists, the startup script does not
run in.routed -s or in.rdisc -r, and does not turn on IP
forwarding on all interfaces configured “up” by ifconfig. This
happens regardless of whether an /etc/gateways file exists. Thus the
machine is now a multihomed host.
===================================
详细内容可以看SA389-SG的第六章




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