论坛风格切换切换到宽版
  • 543阅读
  • 7回复

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

上一主题 下一主题
离线zhurry.
 
发帖
2077
C币
-521811
威望
325
贡献值
2
银元
-5
铜钱
4492
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
我在linux之下用
r.p-pppoe-3.3-1.i386.rpm    健康
设置了宽带上网,但无法让其他的计算机上网,请教高手,如何设.置才能使其他计算机也能够.上网呢。学习

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线evasyy.
发帖
2023
C币
-60854
威望
372
贡献值
1
银元
0
铜钱
4499
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
将你的计算机的ip作为其它计算机的网关和dns就应该可以了

离线fuqi.
发帖
2052
C币
-60763
威望
381
贡献值
1
银元
-1
铜钱
4632
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
[quote]原帖由 "地震高钢"]将你的计算机的ip作为其它计算机的网关和dns就应该可以了[/quote 发表:


让我试试看。

离线jjpan.
发帖
2081
C币
-198470
威望
399
贡献值
1
银元
-3
铜钱
4820
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
不行啊,我试过了,一点都不行。所有WINDOWS主机都无法正常链接上网。

离线double123.
发帖
2094
C币
-604838
威望
395
贡献值
1
银元
-5
铜钱
4662
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
关注!我也想知道如何设置router

离线森帝.
发帖
1943
C币
-61022
威望
362
贡献值
1
银元
-2
铜钱
4367
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
要设置两个地方,一个是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.

离线zhangz.
发帖
2110
C币
-262594
威望
471
贡献值
6
银元
5
铜钱
4751
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
看懂了,天晚了,改天找机会试试,先谢谢楼上的兄弟!

离线kawayiyi.
发帖
2126
C币
-60558
威望
397
贡献值
1
银元
-2
铜钱
4789
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
今天休假,没得试了,改天一定试过,谢谢兄弟啊。
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个