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\r\n\r\n第一个网卡访问外网,第二个网卡访问内网。\r\n\r\n是不是 vi /etc/defaultrouter\r\n\r\n然后把两个网关都加进去?\r\n\r\n或者不用加网关,就可以直接访问内网和外网?
作者: 风之幻想    时间: 2006-01-09 08:27
默认网关只能有一个.加一个/etc/gateways吧.\n\n[ 本帖最后由 风之幻想 于 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 发表\r\n也可以把router add net 0.0.0.0 192.168.2.1   写到/etc/rc2.d/S72inet*,具体的名字我记不清楚了
\r\n我现在也急需要解决这个问题
作者: Philmoon    时间: 2006-01-10 11:55
原帖由 风之幻想 于 2006-1-9 08:27 发表\r\n默认网关只能有一个.加一个/etc/gateways吧.
\r\n\r\n注意:使用/etc/gateways要将/etc/defaultrouter去掉才生效\r\n楼主的问题可以参见SA-389第6章的实习例子
作者: flutter    时间: 2006-01-10 20:22
1,如果网卡2只访问内网本网段,则很简单,网卡1写外网的地址hosts、hostname.xx0、掩码netmasks、网关defaultrouter,网卡2只写地址hostname.xx0和掩码netmasks,则有默认路由,可以满足你的要求,我在XP和SOL10下都是这样做的,一个访问外网INTERNET,一个访问内网。\r\n2,使用双网关,一个网关写defaultrouter,一个写路由在/etc/rc2.d/S72inetsvc中:\r\nrouter add net 192.168.2.0 192.168.2.1\r\n3,两个都在在/etc/gateway中:\r\nrouter add default net 202.106.12.0 202.106.12.1\r\nrouter 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\r\nTo create a multihomed host:\r\n1. Become superuser on the prospective multihomed host.\r\n2. Create an /etc/hostname.interface file for each additional\r\nnetwork interface installed in the machine.\r\n3. Type:\r\n# touch /etc/notrouter\r\nThis creates an empty file called /etc/notrouter.\r\n4. Reboot the machine.\r\nWhen the machine reboots, the startup script looks for the presence of\r\nthe /etc/notrouter file. If the file exists, the startup script does not\r\nrun in.routed -s or in.rdisc -r, and does not turn on IP\r\nforwarding on all interfaces configured “up” by ifconfig. This\r\nhappens regardless of whether an /etc/gateways file exists. Thus the\r\nmachine is now a multihomed host.\r\n===================================\r\n详细内容可以看SA389-SG的第六章




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