Chinaunix首页 | 论坛 | 博客
  • 博客访问: 798538
  • 博文数量: 770
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 4950
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-09 17:49
文章分类

全部博文(770)

文章存档

2011年(1)

2008年(769)

我的朋友

分类:

2008-10-10 11:38:36

本解决方案主要针对公司、学校、网吧等需用一条ADSL将整个局域网连上INTERNET,适合于10-50台计算机的中小型网络用户。对于10台以下计算机的用WINAGTE、SYGATE就可以了。
  让我们先看看具体环境,某办公室21间、计算机30台。组成10-100MB对等局域网,用一条ADSL宽带线路,以前用WINGATE将局域网连上INTERNET,后来觉得不爽我又用WINDOWS2000双网卡做了个NAT地址转换,使用网关和透明协议。这下下感觉舒服些了。用了不久又发现些不大不小的毛病:比如内部互发OICQ慢,访问新浪等个别网站有问题等等。MS的东东看似简单但是当你想微调一下系统的时候,你就会突然发现原来人生多么无奈啊。因此我毅然决定放弃WINDOWS2000,改用LINUX!!要用LINUX得搞台机器吧,东拼西凑好不容易搞了一台。各位请看:INTEL FX主板+PENTIUM 75芯片+16MB内存+540MB硬盘+512K显卡+DE220 10MB网卡。软件嘛随便找个LINUX发行版,我手头有REDHAT 6.2 核心是2.2.14,按SERVER的安装方式,经过长达48分钟左右的安装,可爱的#提示符出现在大家面前!各位也可以根据自己的具体情况安装。
  硬件、软件都装好了,下面开始具体配置。(加了#提示符号表示输入命令)


1、 用ifconfig看看网络配置

  [root@localhost /root]#ifconfiglo  Link encapocal Loopback  inet addr:127.0.0.1 Mask:255.0.0.0UP LOOPBACK RUNNING MTU:3924  Metric:1RX packets:23  errors:0  dropped:0  overruns:0  frame:0TX  packets:23  errors:0  dropped:0  overruns:0  carrier:0
  只有lo没找到网卡。不急,自己配。我是DLINK的DE220 IRQ=3 IO=300,兼容NE2000。在/etc/conf.modules 加两句。 具体如下:
  [root@localhost /root]#cd /etc[root@localhost /root]#vi conf.modulesalias eth0 ne options eth0 io=0x300 irq=3
  IO和IRQ可以根据你自己的网卡设置,如果不能插入就按INSERT,加完就按ESC。再按:,再输入w 存盘,再q 退出。如果不放心就 #more conf.modules 看看写进去没有。
  一般市面上ISA的便宜网卡都兼容NE2000。如果是新手在LINUX下安装网卡的可能会遇到这样那样的问题,多在网上找找看看,一般都能解决。要提醒大家最好别用PNP即插即用模式,在LINUX出了问题不好解决,简直是场噩梦。

2、 配置网卡IP地址

  在/etc/sysconfig/network-scripts下有个文件 ifcfg-eth0 写成如下:
  DEVICE=eth0 IPADDR=192.168.0.254
  这是网卡的IP地址,以后客户机的网关就是这个地址。
  NETMASK=255.255.255.0NETWORK=192.168.0.0BROADCAST=192.168.0.2
  然后重启就能找到网卡。
  我们再[root@localhost /root]#ifconfig
  eth0 Link encap:Ethernet HWaddr 00:40:05:64:11:28
  inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  RX packets:347573 errors:0 dropped:0 overruns:0 frame:0
  TX packets:40194 errors:0 dropped:0 overruns:0 carrier:0
  collisions:35 txqueuelen:100
  Interrupt:3 Base address:0x300
lo  Link encapocal Loopback
  inet addr:127.0.0.1 Mask:255.0.0.0
  UP LOOPBACK RUNNING MTU:3924 Metric:1
  RX packets:23 errors:0 dropped:0 overruns:0 frame:0
  TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  哈哈,eth0找到网卡了,配置也正确,恭喜恭喜!进行下一步。


3、 做ADSL的驱动

  去 下个驱动程序先,大概85K大小。 考到/root去。然后 #tar xvfz rp-pppoe-2.6.tar.gz#cd rp-pppoe-2.6#./go
  开始安装,装好就#make一下下,开始配置ADSL。
  Welcome to the Roaring Penguin ADSL client setup. First, I will run some checks on your system to  make sure the PPPoE client is installed properly... Looks good! Now, please enter some information:
USER NAME
  >>> Enter your PPPoE user name (default): 这里输入在电信局申请的adsl的帐号
  INTERFACE>>> Enter the Ethernet interface connected to the ADSL modem For Solaris, this is likely to be something like /dev/hme0. For Linux, it will be ethn, where 'n' is a number.(default eth0): 问你  用哪片网卡拨号,默认是第一片eth0就可以了Do you want the link to come up on demand, or stay up continuously? If you want it to come up on demand, enter the idle time in seconds after which the link should be dropped. If you want the link to stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP addresses. You may have some problems with demand-activated links.>>> Enter the demand value (default no): 用缺省的no就可以了。
  Please enter the IP address of your ISP's primary DNS server. If your ISP claims that 'the server will provide DNS addresses', enter 'server' (all lower-case) here. If you just press enter, I will assume you know what you are doing and not modify your DNS setup.>>> Enter the DNS information here: 这里填你ISP的DNS地址,成都用61.139.2.69,辅助DNS成都可用202.98.127.32
  PASSWORD>>> Please enter your PPPoE password:ADSL拨号密码这个东东。
  搞定!爽爽,用#adsl-start 就可以开始拨号。如果连接成功系统会提示你:…….connect
  用ifconfig看看。[root@localhost /root]# ifconfig
eth0  Link encap:Ethernet HWaddr 00:40:05:64:11:28
   inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0
   UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
   RX packets:347573 errors:0 dropped:0 overruns:0 frame:0
   TX packets:40194 errors:0 dropped:0 overruns:0 carrier:0
   collisions:35 txqueuelen:100
   Interrupt:3 Base address:0x300
lo   Link encapocal Loopback
   inet addr:127.0.0.1 Mask:255.0.0.0
   UP LOOPBACK RUNNING MTU:3924 Metric:1
   RX packets:23 errors:0 dropped:0 overruns:0 frame:0
   TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:0
ppp0  Link encapoint-to-Point Protocol
   inet addr:61.157.91.227 P-t-P:61.157.91.1 Mask:255.255.255.255
   UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492

Metric:1
   RX packets:20498 errors:0 dropped:0 overruns:0 frame:0
   TX packets:19187 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:10
  看见ppp0没有!

4、配置ipchains伪装IP

  在 /etc/sysconfig的network文件里保证要有这句: FORWARD_IPV4=true,然后改/etc/rc.d/rc.local这个文件,加入以下内容:
  route add -net 192.168.0.0 netmask 255.255.255.0 eth0depmod -amodprobe ip_masq_ftpmodprobe  ip_masq_ircmodprobe ip_masq_raudio/sbin/ipchains -P forward DENY/sbin/ipchains -A forward -s 192.168.0.0/24 -j MASQ
  以防万一:# echo 1 > /proc/sys/net/ipv4/ip_forward 这样一下。存盘,退出,重启,完。是不是很简单啊!这样一台最简单的软路由就做好了,其实ipchains功能很强大,这里就不详细再讲了如有需要我会另外找时间再写。

5、配置每台客户机

  如果用WINDOWNS系列,只要在网络设置的网卡的TCP/IP中加入网关192.168.0.254。
  算算成本一台这样的机器加一套不要钱的LINUX最多花个300-500的(本人连显示器都不要,安装的时候用用,之后就用TELNET远程管理)。这套搭配功能无比强大,稳定,高效,安全。      
--------------------next---------------------
[QUOTE]最初由 阿泰 发布
[B]本解决方案主要针对公司、学校、网吧等需用一条ADSL将整个局域网连上INTERNET,适合于10-50台计算机的中小型网络用户。对于10台以下计算机的用WINAGTE、SYGATE就可以了。
  让我们先看看具体环境,某办公室21间、计算机30台。组成10-100MB对等局域网,用一条ADSL宽带线路,以前用WINGATE将局域网连上INTERNET,后来觉得不爽我又用WINDOWS2000双网卡做了个NAT地址转换,使用网关和透明协议。这下下感觉舒服些了。用了不久又发现些不大不小的毛病:比如内部互发OICQ慢,访问新浪等个别网站有问题等等。MS的东东看似简单但是当你想微调一下系统的时候,你就会突然发现原来人生多么无奈啊。因此我毅然决定放弃WINDOWS2000,改用LINUX!!要用LINUX得搞台机器吧,东拼西凑好不容易搞了一台。各位请看:INTEL FX主板+PENTIUM 75芯片+16MB内存+540MB硬盘+512K显卡+DE220 10MB网卡。软件嘛随便找个LINUX发行版,我手头有REDHAT 6.2 核心是2.2.14,按SERVER的安装方式,经过长达48分钟左右的安装,可爱的#提示符出现在大家面前!各位也可以根据自己的具体情况安装。
  硬件、软件都装好了,下面开始具体配置。(加了#提示符号表示输入命令)


1、 用ifconfig看看网络配置

  [root@localhost /root]#ifconfiglo  Link encapocal Loopback  inet addr:127.0.0.1 Mask:255.0.0.0UP LOOPBACK RUNNING MTU:3924  Metric:1RX packets:23  errors:0  dropped:0  overruns:0  frame:0TX  packets:23  errors:0  dropped:0  overruns:0  carrier:0
  只有lo没找到网卡。不急,自己配。我是DLINK的DE220 IRQ=3 IO=300,兼容NE2000。在/etc/conf.modules 加两句。 具体如下:
  [root@localhost /root]#cd :Ethernet HWaddr 00:40:05:64:11:28
  ipback
  ine

 # errors:0 dropped:0 overruns:0 carrier:0
   collisions:35 txqueuelen:100
   In
   TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:0
ppp0  Link 187 errors:0 dropped:0 overruns:0 c
  在 /etc/sysconfig的network文件里保证要有这句: FORWARD_IPV4=true,然后改/etc/rc.d/rc.local这个文件,加入以下内容:
  route add -net 192.168.0.0 netmask 255.255.255.0 eth0depmod -amodprobe ip_masq_ftpmodprobe  ip_masq_ircmodprobe ip_masq_raudio/sbin/ipchains -P forward DENY/sbin/ipchains -A forward -s 192.168.0.0/24 -j MASQ
  以防万一:# echo 1 > /proc/sys/net/ipv4/ip_forward 这样一下。存盘,退出,重启,完。是不是很简单啊!这样一台最简单的软路由就做好了,其实ipchains功能很强大,这里就不详细再讲了如有需要我会另外找时间再写。

5、配置每台客户机

  如果用WINDOWNS系列,只要在网络设置的网卡的TCP/IP中加入网关192.168.0.254。
  算算成本一台这样的机器加一套不要钱的LINUX最多花个300-500的(本人连显示器都不要,安装的时候用用,之后就用TELNET远程管理)。这套搭配功能无比强大,稳定,高效,安全。 [/B][/QUOTE]

一个网卡转发?:confused:      
--------------------next---------------------
A泰,就一个网卡呀?:confused:

转一贴:
RedHat 8.0提供ADSL共享上网的解决办法

一、操作环境:
机器系统与配置:三台机器的关健部件
第一台:台式机,双网卡,8139和8029,操作系统RedHat 8.0
第二台:Toshiba notebook,PC卡。RTL-8139/8139C/8139C+,操作系统RedHat 8.0
第三台:台式机,8029网卡,操作系统windowme
Hub[集线器]:Tp-Link 10M,8口
ADSL,乙太口,非路由。
二、网卡设置如下:
在第一台机器的双网卡的接法:把ADSL接在eth0上,把eth1接在HUB上。
第一块网卡的ip设置:
ip地址:192.168.0.1
掩码:255.255.255.0
第二块网卡的设置
ip地址:192.168.0.2
掩码:255.255.255.0
在这两块网卡中,不要设置网关。
++++++++++++++++++++++++++++++++++++++++
第二台:Toshiba notebook的网卡设置
IP:192.168.0.6
掩码:255.255.255.0
网关:192.168.0.1
DNS:设置电信给的,或者下面的也行
202.96.134.133
202.96.168.68
++++++++++++++++++++++++++++++++++++++++
第三台机器的网卡设置
P:192.168.0.8
掩码:255.255.255.0
网关:192.168.0.1
DNS:设置电信给的,或者下面的也行
202.96.134.133
202.96.168.68
三、设置ppp拔号,
1]删除原来的ppp的ADSL链接。
如果redhat-config-network原来已经用 redhat-config-network设置的ppp的ADSL连接拔号,用下面的命令调用删除。
#redhat-config-network
2]在终端上以root权限运行
#adsl-setup
进入设置过程:
Welcome to the ADSL client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly...

LOGIN NAME

Enter your Login Name (default root): ADSL提供商给的用户名,写在这里

INTERFACE

Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0): eth0这是ADSL通过第一台机器的第一张网卡eth0提供上网

Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
Enter the demand value (default no):在这里按一下回车就行了。

DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here: 202.96.134.133这是DSN,最好用你本地电信给的
Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
Enter the secondary DNS server address here: 202.96.168.68这是第二个DNS,也是电信给的。

PASSWORD

Please enter your Password:在这里把ADSL提供商给的密码写上
Please re-enter your Password:

USERCTRL

Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): yes

FIREWALLING

Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.

The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2): 2

Start this connection at boot time

Do you want to start this connection at boot time?
Please enter no or yes (default no):yes

** Summary of what you entered **

Ethernet Interface: eth0
User name: ADSL用户名
Activate-on-demand: No
Primary DNS: 202.96.134.133
Secondary DNS: 202.96.168.68
Firewalling: MASQUERADE
User Control: yes
Accept these settings and adjust configuration files (y/n)?y

三、在/etc/rc.d/rc.local中加入如下:

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

四、重新启动机器。就OK了。      
--------------------next---------------------

阅读(421) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~