- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
做个ADSL+LINUX软路由器
录入:edatop.com 点击:
本解决方案主要针对公司、学校、网吧等需用一条ADSL将整个局网连上INTERNET,适合于10 -50台计算机的中小型网络用户。对于10台以下计算机的用WINAGTE、SYGATE就蛮好用。
让我们来看看具体环境先,某公司总部办公室21间、计算机30台。组成10-100MB对等局域网,用一条ADSL宽带线路跑,以前用WINGATE将局域网连上INTERNET,后来觉得不爽我又用WINDOWS2000双网卡做了个NAT地址转换,使用网关和透明协议拖。这下下感觉舒服些了。呵呵,用了不久又发现些不大不小的毛病:比如内部互发OICQ慢啊,访问SINA.COM.CN等个别网站有问题啊等等。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]#ifconfig
lo Link encap:Local 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
只有lo没找到网卡。不急,自己配。我是DLINK的DE220 IRQ=3 IO=300,兼容NE2000。在/etc/conf.modules 加两句。
具体如下:
[root@localhost /root]#cd /etc
[root@localhost /root]#vi conf.modules
alias 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.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes
BOOTPROTO=none
重起就能找到网卡。
我们再[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 encap:Local 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的驱动。去http://www.roaringpenguin.com/pppoe/rp-pppoe-2.6.tar.gz 下个驱动程序先,大概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就可以了
4、最后一步:配置ipchains伪装IP。
在 /etc/sysconfig的network文件里保证要有这句: FORWARD_IPV4=true
然后改/etc/rc.d/rc.local这个文件,加入以下内容
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 encap:Local 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 encap:Point-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没有!
让我们来看看具体环境先,某公司总部办公室21间、计算机30台。组成10-100MB对等局域网,用一条ADSL宽带线路跑,以前用WINGATE将局域网连上INTERNET,后来觉得不爽我又用WINDOWS2000双网卡做了个NAT地址转换,使用网关和透明协议拖。这下下感觉舒服些了。呵呵,用了不久又发现些不大不小的毛病:比如内部互发OICQ慢啊,访问SINA.COM.CN等个别网站有问题啊等等。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]#ifconfig
lo Link encap:Local 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
只有lo没找到网卡。不急,自己配。我是DLINK的DE220 IRQ=3 IO=300,兼容NE2000。在/etc/conf.modules 加两句。
具体如下:
[root@localhost /root]#cd /etc
[root@localhost /root]#vi conf.modules
alias 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.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes
BOOTPROTO=none
重起就能找到网卡。
我们再[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 encap:Local 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的驱动。去http://www.roaringpenguin.com/pppoe/rp-pppoe-2.6.tar.gz 下个驱动程序先,大概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就可以了
4、最后一步:配置ipchains伪装IP。
在 /etc/sysconfig的network文件里保证要有这句: FORWARD_IPV4=true
然后改/etc/rc.d/rc.local这个文件,加入以下内容
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 encap:Local 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 encap:Point-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没有!
上一篇:笔记本中的三种无线技术
下一篇:FreeBSD
5.0
ADSL安装指南