LoveUnix » 培训认证 行业入门 » [帮助]路由问题
让LU留住您的每

一天 让LU博客留住您的每一天
2004-4-7 15:26 yuanziyang
公司用一台机器作为网关,现在是用的WINDOWS2000共享上网,但windows老出毛病,想用LINUX 9.0做gataway,我的LINUX知识很有限,请教怎样实现及实现步骤。<br /><br />机器是:linux 9.0+双网卡<br />内网IP:192。168。0。1<br />外网IP:10。1。0。156<br />域控,DHCP和DNS的IP:192。168。0。2<br /><br /> <!--emo&:unsure:--><img src='style_emoticons/default/unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' /><!--endemo-->  <!--emo&:unsure:--><img src='style_emoticons/default/unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' /><!--endemo-->  <!--emo&:unsure:--><img src='style_emoticons/default/unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' /><!--endemo-->

2004-4-11 02:53 老农
在TCP/IP上,LINUX和WINDOWS是一样的。

2004-4-13 10:32 yuanziyang
windows里有连接共享,LINUX里怎么做呢?

2004-4-16 17:43 zhaoxjss
双网卡各自绑定ip,然后打开rh9.0的内核ip forward,用route命令添加静态路由,在客户机配置好dhcp,dns应该就可以了,哦只看过没练过,就当我没说,呵呵,你的192.168.0.2服务也是用rh9.0实现吧,那你的内网网卡要绑定两个ip了,配置dns什么的最好有人指导,我就做过一遍,就是服务不正常,<br />呵呵,就当我没说。。。。^-^ <!--emo&^_^--><img src='style_emoticons/default/happy.gif' border='0' style='vertical-align:middle' alt='happy.gif' /><!--endemo-->

2004-6-4 13:03 yuanziyang
<!--QuoteBegin-zhaoxjss+2004-04-16 17:43:43--><div class='quotetop'>QUOTE(zhaoxjss @ 2004-04-16 17:43:43)</div><div class='quotemain'><!--QuoteEBegin--> 双网卡各自绑定ip,然后打开rh9.0的内核ip forward,用route命令添加静态路由,在客户机配置好dhcp,dns应该就可以了,哦只看过没练过,就当我没说,呵呵,你的192.168.0.2服务也是用rh9.0实现吧,那你的内网网卡要绑定两个ip了,配置dns什么的最好有人指导,我就做过一遍,就是服务不正常,<br />呵呵,就当我没说。。。。^-^ <!--emo&^_^--><img src='style_emoticons/default/happy.gif' border='0' style='vertical-align:middle' alt='happy.gif' /><!--endemo--> <!--QuoteEnd--></div><!--QuoteEEnd--><br />我添了两个静态路由:<br /><!--QuoteBegin--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--QuoteEBegin-->[root@www sbin]# ./route<br />Kernel IP routing table<br />Destination&nbsp; &nbsp;&nbsp; Gateway&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Genmask&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Flags Metric Ref&nbsp; &nbsp; Use Iface<br />192.168.0.0&nbsp; &nbsp;&nbsp; 192.168.0.218&nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; UG&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth0<br />192.168.0.0&nbsp; &nbsp;&nbsp; *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; U&nbsp; &nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth0<br />10.1.0.0&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.157&nbsp; &nbsp; &nbsp; 255.255.255.0&nbsp;&nbsp; UG&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth1<br />10.1.0.0&nbsp; &nbsp; &nbsp; &nbsp; *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; U&nbsp; &nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth1<br />169.254.0.0&nbsp; &nbsp;&nbsp; *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 255.255.0.0&nbsp; &nbsp;&nbsp; U&nbsp; &nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth1<br />127.0.0.0&nbsp; &nbsp; &nbsp;&nbsp; *&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 255.0.0.0&nbsp; &nbsp; &nbsp;&nbsp; U&nbsp; &nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 lo<br />default&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 10.1.0.1&nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; UG&nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0 eth1<br /><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />ech0为内网接口,ip:192.168.0.218(暂时),netmask:255.255.255.0<br />ech1为外网接口,ip:10.1.0.157,netmask:255.255.255.0,gateway:10.1.0.1<br />dns:202.96.134.188<br />    202.96.134.178<br />    202.96.134.143<br /><br />-------------------------------------------------------------------------<br />现在网关可以上网了,内部机器的网关也设为了192.168.0.218,可还是内部机器怎么还上不了网呢???请帮助

2004-6-4 14:31 tinyyjm
在搭鉴pppoe-server的时候遇到类似的情况,可能有点帮助<br />echo &quot;1&quot;&gt;/proc/sys/net/ip_forward 这个命令

2004-6-4 21:28 无花果
<!--QuoteBegin-yuanziyang+2004-06-04 13:03:12--><div class='quotetop'>QUOTE(yuanziyang @ 2004-06-04 13:03:12)</div><div class='quotemain'><!--QuoteEBegin--> ech0为内网接口,ip:192.168.0.218(暂时),netmask:255.255.255.0<br />ech1为外网接口,ip:10.1.0.157,netmask:255.255.255.0,gateway:10.1.0.1<br />dns:202.96.134.188<br />&nbsp; &nbsp; 202.96.134.178<br />&nbsp; &nbsp; 202.96.134.143<br /><br />-------------------------------------------------------------------------<br />现在网关可以上网了,内部机器的网关也设为了192.168.0.218,可还是内部机器怎么还上不了网呢???请帮助 <!--QuoteEnd--></div><!--QuoteEEnd--><br />这种情况不用路由,只能再做一次NAT.一句iptables就搞定了.<br /><br />服务器:<br /><br />1.  echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward<br /><br />    这句可以写入/etc/rc.d/rc.local<br /><br />2.  iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE<br /><br />    这句可以插入/etc/sysconfig/iptables,不过前提是该文件已有默认规则,插入格式为<br /><br />        -A POSTROUTING -s 192.168.0.0/255.255.255.0 -j MASQUERADE<br />    放在文件内*nat后,COMMIT前的位置.<br /><br />客户机:<br /><br />1. 网关: 192.168.0.218<br /><br />2. DNS: 202.96.134.188<br />        202.96.134.178 (网上的DNS SERVER都可以用)

2004-6-4 21:34 yuanziyang
呵呵,明天不上班只好周一上班再试了!不过先谢谢大家的回复,感谢!

2004-6-4 21:44 yuanziyang
我的服务器配置是:<br /><!--QuoteBegin--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--QuoteEBegin-->P4 1.7G / 精英主板I845 / 256M DDR / ... / 两个8139网卡<!--QuoteEnd--></div><!--QuoteEEnd--><br />公司现有100台机器通过100M交换机上网,现在是用的sysgate,效率可以忍受!<br />不知道,这样的配置装LINUX配成路由器效果比windows高吗?还是专门买个路由器呢?不知道市场上什么牌子路由器(150客户机)性价比会最好呢?可以防毒如震荡波最好啦,现在被它搞的真的很烦!!!

2004-6-7 09:41 yuanziyang
<!--QuoteBegin-无花果+2004-06-04 21:28:00--><div class='quotetop'>QUOTE(无花果 @ 2004-06-04 21:28:00)</div><div class='quotemain'><!--QuoteEBegin--> <!--QuoteBegin-yuanziyang+2004-06-04 13:03:12--><div class='quotetop'>QUOTE(yuanziyang @ 2004-06-04 13:03:12)</div><div class='quotemain'><!--QuoteEBegin--> ech0为内网接口,ip:192.168.0.218(暂时),netmask:255.255.255.0<br />ech1为外网接口,ip:10.1.0.157,netmask:255.255.255.0,gateway:10.1.0.1<br />dns:202.96.134.188<br />&nbsp; &nbsp; 202.96.134.178<br />&nbsp; &nbsp; 202.96.134.143<br /><br />-------------------------------------------------------------------------<br />现在网关可以上网了,内部机器的网关也设为了192.168.0.218,可还是内部机器怎么还上不了网呢???请帮助 <!--QuoteEnd--></div><!--QuoteEEnd--><br />这种情况不用路由,只能再做一次NAT.一句iptables就搞定了.<br /><br />服务器:<br /><br />1.  echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward<br /><br />    这句可以写入/etc/rc.d/rc.local<br /><br />2.  iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE<br /><br />    这句可以插入/etc/sysconfig/iptables,不过前提是该文件已有默认规则,插入格式为<br /><br />        -A POSTROUTING -s 192.168.0.0/255.255.255.0 -j MASQUERADE<br />    放在文件内*nat后,COMMIT前的位置.<br /><br />客户机:<br /><br />1. 网关: 192.168.0.218<br /><br />2. DNS: 202.96.134.188<br />        202.96.134.178 (网上的DNS SERVER都可以用) <!--QuoteEnd--></div><!--QuoteEEnd--><br />谢谢!成功了!十分感谢!

页: [1]
查看完整版本: [帮助]路由问题


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.