LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 805|回复: 12

老大们,帮帮忙吧!我快苦死了!!!关于共享上网的问题!急急!!!!!!!!在线等待!

[复制链接]
发表于 2003-7-16 15:13:41 | 显示全部楼层 |阅读模式
我的linux 7.3 服务器已经能用adsl拨号上网了,rc.local里添加了这些:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.


echo 1> /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.1.2/30 -o ppp0 -j MASQUERADE


touch /var/lock/subsys/local

网也通了,web server也ok了,可是LAN里机器就是上不了网,为什么???


急急!!!!!!!!急死了!
发表于 2003-7-16 16:03:37 | 显示全部楼层
你确认LAN机器在“192.168.1.2/30 ”里面?
把“-s 192.168.1.2/30 ”去掉试试~
LAN机器的GATEWAY是否已经设定为SERVER的内部IP?
还有,PING 一下SERVER对外的那个IP,是否通?
 楼主| 发表于 2003-7-16 18:23:31 | 显示全部楼层
都试了还是不行!对了pppoe和linux自带的有什么区别么?
发表于 2003-7-16 22:01:19 | 显示全部楼层
PING 外部的IP能PING 通吗?
 楼主| 发表于 2003-7-17 01:48:20 | 显示全部楼层
局域网是通的,和外部没有通!
发表于 2003-7-19 11:11:38 | 显示全部楼层
lsmod |grep ip_tables 看iptables载入否
否则modprobe ip_tables载入
我也碰到过同样问题
若还不行,发邮件给我:ntbxm@163.net
发表于 2003-7-19 12:30:12 | 显示全部楼层
我的也是这样,
我的设置:
R9.0通过eth0上网,eth1接hub
eth0:192.168.0.1 255.255.255.0
eth1:192.168.0.2 255.255.255.0
内网机子均为XP
:ip 192.168.0.X 255.255.255.0
网关 192.168.0.1
DNS 192.168.0.1(不行)
isp没给 我DNS
内网机子192.168.0.X能ping通192.168.0.1但ping不通外网
R9.0也能ping通内网机子
R9.0能上网,
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local


echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j MASQUERADE
~
~


[root@localhost root]# lsmod | grep ip_tables
ip_tables              14648   6  [ipt_REJECT iptable_filter ipt_MASQUERADE iptable_nat]
还望高手解答爱
发表于 2003-7-19 12:32:21 | 显示全部楼层
后来,我用adsl-connect
把DNS添加了,
可还是不行,
发表于 2003-7-22 09:09:34 | 显示全部楼层
其实网上很多文章都写的不错的。但以我的看来,有些细节在局域网中可能有所不同。
你的配置大致没问题,我的建议如下(以客户端能出去为目的,详细的防火墙规则参考网上文章)
1.eth0接hub,建议netmask 不要和eth1相同网段,如199.10.10.1/255.255.255.0->199.10.0.1/255.255.0.0
2.dns ->202.96.134.133
3.R9.0能拨号后,你逐步执行如下指令:
   a.  vi /etc/sysctl.conf
       改 net.ipv4.ip_forwd=1
   b.  执行 sysctl -w net.ipv4.ip_forward=1
   c.  lsmod |grep ip_tables  确认ip_tables 已载入,若没,执行 modprobe ip_tables
   d.  iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
   e.  route   确认默认网关为ppp0
   f.  iptables -t nat -L -n  查看d步结果,若有"OSTROUTING",恭喜,你差不多了
   g.  客户端改: 网关:192.168.0.1  DNS 202.96.134.133

简单吧!以上指令建议一条一条的执行,先不要用文档方式执行,以免不知道出什么问题,祝好运!
发表于 2003-7-22 09:18:40 | 显示全部楼层
最初由 osoftware 发表
我的也是这样,
我的设置:
R9.0通过eth0上网,eth1接hub
eth0:192.168.0.1 255.255.255.0
eth1:192.168.0.2 255.255.255.0
内网机子均为XP
:ip 192.168.0.X 255.255.255.0
网关 192.168.0.1
DNS 192.168.0.1(不行)
isp没给 我DNS
内网机子192.168.0.X能ping通192.168.0.1但ping不通外网
R9.0也能ping通内网机子
R9.0能上网,
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local


echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j MASQUERADE
~
~


[root@localhost root]# lsmod | grep ip_tables
ip_tables              14648   6  [ipt_REJECT iptable_filter ipt_MASQUERADE iptable_nat]
还望高手解答爱




你ping 不通外网?
查一下你的output和input吧!最好是自定义防火墙规则
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表