免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1339 | 回复: 7
打印 上一主题 下一主题

如何让局域网中的用户共享宽带上网。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-11-18 17:02 |只看该作者 |倒序浏览
我在linux之下用
rp-pppoe-3.3-1.i386.rpm
设置了宽带上网,但无法让其他的计算机上网,请教高手,如何设置才能使其他计算机也能够上网呢。

论坛徽章:
0
2 [报告]
发表于 2004-11-18 17:47 |只看该作者

如何让局域网中的用户共享宽带上网。

将你的计算机的ip作为其它计算机的网关和dns就应该可以了

论坛徽章:
0
3 [报告]
发表于 2004-11-27 15:03 |只看该作者

如何让局域网中的用户共享宽带上网。

[quote]原帖由 "地震高钢"]将你的计算机的ip作为其它计算机的网关和dns就应该可以了[/quote 发表:


让我试试看。

论坛徽章:
0
4 [报告]
发表于 2004-11-27 15:25 |只看该作者

如何让局域网中的用户共享宽带上网。

不行啊,我试过了,一点都不行。所有WINDOWS主机都无法正常链接上网。

论坛徽章:
0
5 [报告]
发表于 2004-11-27 18:35 |只看该作者

如何让局域网中的用户共享宽带上网。

关注!我也想知道如何设置router

论坛徽章:
0
6 [报告]
发表于 2004-11-27 19:23 |只看该作者

如何让局域网中的用户共享宽带上网。

要设置两个地方,一个是route,一个是IPTABLE。route中设置好网关等东东,IPTABLE中把MASQUERADE打开,具体步骤如下:

1. On the linux box (that is directly connected to the internet, and is
supposed to do the internet sharing), start a terminal. Run the command

su

and then type the root password to become root.

2. Open the file /etc/rc.d/rc.local in your favorite text editor and
add this on a new line at the bottom

/etc/rc.d/rc.ipmasq

and save the file.

3. Then, create a new file called rc.ipmasq in the /etc/rc.d/ directory
and open this file in a text editor and add these lines


#!/bin/sh

IPTABLES=/sbin/iptables

#All The lines below are NAT routing

# flush any old rules
$IPTABLES -F -t nat

# turn on NAT (IP masquerading for outgoing packets)
$IPTABLES -A POSTROUTING -t nat -o eth0 -j MASQUERADE

# enable IP forwarding (of incoming packets)
echo 1 >; /proc/sys/net/ipv4/ip_forward



Save this file.

This script assumes that eth0 is the ethernet adaptor connected to the internet (say, thru a DSL/cable modem). Change it depending on your configuration (eth1, eth2 and so on). If the connection to the internet is not thru an ethernet device (as in the case of ordinary dialup or USB modem), you have to use ppp0 (or ppp1, ppp2 and so on). The network connections to the internet and intranet should already be up (how to do that is outside the scope of this document).

4. Make this script file executable by running

chmod 755 /etc/rc.d/rc.ipmasq

5. Then run the command /etc/rc.d/rc.ipmasq to enable the internet
sharing.

6. Now you can stop being root by running exit

The above script will work after the following have been already done:

Set up the network on all the computers in the LAN. Make sure every computer can be reached from another computer by "ping".
On each client computer, set the gateway to the internal IP address of the linux computer that is connected directly to the internet. Under DNS put in the primary and/or secondary DNS IP addresses of your ISP (Internet Service Provider).

Now you should be able to browse the internet from the other computers on your internal network.

It is strongly recommended that you also use a firewall on the linux
gateway. This above script will work with the firewall script without
any changes being required.

论坛徽章:
0
7 [报告]
发表于 2004-11-28 00:42 |只看该作者

如何让局域网中的用户共享宽带上网。

看懂了,天晚了,改天找机会试试,先谢谢楼上的兄弟!

论坛徽章:
0
8 [报告]
发表于 2004-11-28 10:14 |只看该作者

如何让局域网中的用户共享宽带上网。

今天休假,没得试了,改天一定试过,谢谢兄弟啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP