[实践OK]centos7 使用lsusb 和lspci 安装 yum install usbutils -y usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息!!!
yum install usbutils -y
yum install pciutils -y
usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息!!!
安装CentOS5、驱动usb-adsl、安装下载软件、安装多媒体软件、编译内核、适合新手。
在正文开始前我先说两句废话,我喜欢玩电脑但是很菜,所以以下所写的肯定会有很多错误的地方,比如正确的用语等等。希望高手们能多多的指正。以下方法只在CentOS5系统中通过,不保证其它系统也能通过。
第一步:CentOS5系统安装。
-、系统安装
介绍基本安装的文章很多,我这里只说一下我的分区情况和GRUB(开机引导程序)安装情况。安装顺序,先安装XP再装CentOS5.
1、分区
在安装进行到分区这一步时一定要选择自定义分区。建议建立两个主分区。下面是我的分区情况,供参考。
Device Boot Start End Blocks Id System
/dev/hdc1 1 787 6321546 7 HPFS/NTFS (第一主分区安装XP,大小看你的习惯)
/dev/hdc2 * 788 1934 9213277+ 83 Linux (第二主分区安装CentOS5,并设为活动分区。大小为8G,最好能在大点)
/dev/hdc3 1935 9729 62613337+ f W95 Ext'd (LBA)
/dev/hdc5 1935 3268 10715323+ 7 HPFS/NTFS
/dev/hdc6 3269 5563 18434556 b W95 FAT32
/dev/hdc7 5564 6839 10249438+ b W95 FAT32
/dev/hdc8 6840 9602 22193766 b W95 FAT32
/dev/hdc9 9603 9729 1020096 82 Linux swap / Solaris (linux交换分区,大小为你的内存大小或内存大小的两倍。把swap放在最后好像可以提高读写的速度,也不知道有没有道理。)
在安装结束后重起电脑会进入XP,并不会出现GRUB引导界面,别急,这是因为活动分区还是/dev/hdc1的过。进入XP利用PM之类的工具将活动分区改为/dev/hdc2重启后就出现GRUB引导界面了。
这样分区的好处是减少一个系统崩溃时对另一个系统的影响。比如XP崩溃需要重新安装时它会覆盖MBR,如果我们把GRUB安装在MBR,这时你就无法进入CentOS5了,你必须用引导盘进入linux的救援模式键入命令从装GRUB。这虽然简单但是对于一个从未接触过linux的新手来说也许是致命的。如果我们把GRUB安装在/dev/hdc2,在重装了XP后只需要改变下活动分区就可以了。再比如linux崩溃了(尽管这不容易,但是对于向我这一类的新手来说还是很有可能的)我们也同样只需利用win98或带有fdisk的DOS引导盘在DOS下把活动分区改为XP就可以进入XP了。(XP引导盘是不是也可以改变活动分区我不知道,如果可以的话还希望高手们教我们这些菜鸟)
2、GRUB引导设置。
我的配置文件:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/hdc2
# initrd /boot/initrd-version.img
#boot=/dev/hdc2
default=3 (默认引导系统,第一个为0,这里3代表第四个WinXP系统为默认引导系统)
timeout=8 (默认引导等待时间,单位秒)
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.20.10-02)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10-02 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10-02.img
title CentOS (2.6.18-8.el5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-8.el5.img
title CentOS (2.6.20.10)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10.img
title WinXP
rootnoverify (hd0,0)
chainloader +1
你可以改变default=后面的数字以选择你要默认引导的系统。改变timeout=后面的数值以改变默认引导时的等待时间,如果为0表示不等待。
如果你在安装过程中遇到其他问题可以多多求助于网络。基本上都能得到解决。
第二步,连接互联网。
这一步非常的重要,现在的linux对互联网的依赖非常强。
我所使用的是usb的adsl。所以这里只介绍usb的adsl的安装方法。
说明:usb adsl芯片是Conexant的。
1、首先安装如下的软件包
usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息
linux-atm-2.5.0-1.20050118cvs.i3886.rpm
linux-atm-libs-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须
linux-atm-libs-devel-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须,安装
后三个包CentOS5光盘中没有,我是用的FC6中。
检查rp-pppoe是否安装:
[root@localhost tmp]# rpm -q rp-pppoe
rp-pppoe-3.5-32.1
如果没有安装CentOS5中就有,安装它。
在没有联网之前我们只能通过在终端下使用rpm来安装、升级、卸载软件包。基本命令如下。
rpm -q filename.rpm 查询名为filename的软件包是否安装。
rpm -ivh filename.rpm 安装名为filename的软件包。
rpm -e fielname.rpm 卸载名为filename的软件包。
rpm -qpl filename.rpm 查询名为filename的软件包都将安装那些文件到系统中。
2、准备要用的文件CnxEtU.sys
[root@localhost tmp]#cp /mnt/hdc1/WINDOWS/system32/drivers/CnxEtU.sys /tmp
如果你使用默认内核不支持ntfs分区,你可以在XP下把CnxEtU.sys先放到一个fat32分区。然后在linux下挂载这个fat32分区。
[root@localhost tmp]#mkdir /mnt/hdc7 新建一个文件夹,以便将一个WIN分区挂载到linux下。
[root@localhost tmp]#mount -t vfat /dev/hdc7 /mnt/hdc7 将/dev/hdc7分区以文件夹方式挂载到/mnt/hdc7。
3、用lsusb命令查看usb adsl连接情况
[root@localhost tmp]# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 002: ID 0572:cb00 Conexant Systems (Rockwell), Inc. E-Tech ADSL Modem v2
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
4、生成cxacru-fw.bin文件
需要CnxEtU.sys文件,此文件从windows版驱动而来,在windows下查找此文件。
利用编辑器,比如gedit新建cxacru-fw.c文件,将下面内容粘贴到文件中去。
/*****************************************************************************
* cxacru-fw - utility to extract firmware for the USB ADSL modems based on
* Conexant AccessRunner chipset, from the Conexant driver for
* Windows(R)
*
* Copyright (C) 2005 Roman Kagan (rkagan % mail ! ru)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****************************************************************************/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <error.h>
#include <argp.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <endian.h>
#include <byteswap.h>
#if __BYTE_ORDER == __BIG_ENDIAN
static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}
static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}
#else
static inline uint16_t le16_to_cpup(uint16_t *x) {return *x;}
static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}
#endif
uint8_t *findfw(uint8_t *buf, int len, int *fwlen)
{
const static uint8_t fwstart[] = { /* ARM LE asm */
0x1c, 0x24, 0x9f, 0xe5, /* e59f241c ldr r2, [pc, #0x41c] */
0x00, 0x10, 0xa0, 0xe3, /* e3a01000 mov r1, #0x0 */
0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */
0x22, 0x00, 0x00, 0xeb, /* eb000022 bl 0x9c */
};
const static uint8_t bpstart[] = {
0x78, 0x20, 0x9f, 0xe5, /* e59f2078 ldr r2, [pc, #0x78] */
0x01, 0x10, 0xa0, 0xe3, /* e3a01001 mov r1, #0x1 */
0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */
0x70, 0x20, 0x9f, 0xe5, /* e59f2070 ldr r2, [pc, #0x70] */
};
uint8_t *fw, *bp, *nt_header, *sect_header;
uint32_t tmp;
uint16_t nsect;
uint32_t dataoff, datalen;
*fwlen = 0;
/* IMAGE_DOS_HEADER size and .Signature */
if (len < 0x40 || memcmp(buf, "MZ", 2)) {
error(0, 0, "file is not a DOS executable");
return NULL;
}
/* IMAGE_NT_HEADERS size and .Signature */
tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));
nt_header = buf + tmp;
if (len < tmp + 0x18 || memcmp(nt_header, "E\0\0", 4)) {
error(0, 0, "file is not a portable executable (PE)");
return NULL;
}
/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */
nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));
/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */
tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));
sect_header = nt_header + 0x18 + tmp;
for (; nsect; nsect--, sect_header += 0x28) {
if (sect_header + 0x28 > buf + len) {
error(0, 0, "file header corrupted");
return NULL;
}
if (!memcmp(sect_header, ".data", 5))
break;
}
if (!nsect) {
error(0, 0, "`.data' section not found");
return NULL;
}
/* IMAGE_SECTION_HEADER.SizeOfRawData */
datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));
/* IMAGE_SECTION_HEADER.PointerToRawData */
dataoff = le32_to_cpup((uint32_t *) (sect_header + 0x14));
if (dataoff + datalen > len) {
error(0, 0, "`.data' section extends beyond end of file");
return NULL;
}
/* find the starting sequence of the firmware image */
fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));
if (!fw) {
error(0, 0, "firmware start sequence not found");
return NULL;
}
*fwlen = datalen - (fw - (buf + dataoff));
/* find the starting sequence of the boot ROM patch, if present */
bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));
if (bp)
*fwlen = bp - fw;
return fw;
}
const char * argp_program_version = "002";
const char * argp_program_bug_address =
"<accessrunner-general at lists dot sourceforge dot net>";
const static char args_doc[] = "INFILE OUTFILE";
const static char doc[] =
"Firmware extractor for Conexant AccessRunner ADSL USB modems\n"
"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"
"OUTFILE - firmware image (usually cxacru-fw.bin)";
struct args {
char *infile;
char *outfile;
};
static error_t parse_opts(int key, char *arg, struct argp_state *state)
{
struct args *args = state->input;
switch (key) {
case ARGP_KEY_ARG:
switch (state->arg_num) {
case 0:
args->infile = arg;
break;
case 1:
args->outfile = arg;
break;
default:
argp_usage (state);
}
break;
case ARGP_KEY_END:
if (state->arg_num < 2)
argp_usage (state);
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
static struct argp argp = {0, parse_opts, args_doc, doc};
int main(int argc, char **argv)
{
int ret, fd;
struct args args;
struct stat instat;
uint8_t *buf, *fw;
int len, fwlen;
argp_parse(&argp, argc, argv, 0, NULL, &args);
fd = open(args.infile, O_RDONLY);
if (fd < 0)
error(1, errno, "failed to open `%s' for reading", args.infile);
ret = fstat(fd, &instat);
if (ret)
error(1, errno, "failed to obtain the size of `%s'", args.infile);
len = instat.st_size;
buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
close(fd);
if (!buf)
error(1, errno, "failed to mmap `%s'", args.infile);
fw = findfw(buf, len, &fwlen);
if (!fw)
error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);
fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0)
error(1, errno, "failed to open `%s' for writing", args.outfile);
if (write(fd, fw, fwlen) != fwlen)
error(1, errno, "failed to write firmware to `%s'", args.outfile);
close(fd);
munmap(buf, len);
printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);
}
新建makefile将下面内容粘贴到文件中。
cxacru-fw:
编译cxacru-fw.c文件生成cxacru-fw可执行文件。
[root@localhost tmp]# make
从CnxEtU.sys提取固件信息生成firmeare文件。
[root@localhost tmp]# ./cxacru-fw cnxetu.sys cxacru-fw.bin
拷贝到/lib/firmware文件夹。
[root@localhost tmp]# cp cxacru-fw.bin /lib/firmware
热插拔一下adsl。
5、运行br2684ctl驱动adsl建立虚拟网卡界面nas0。
[root@localhost tmp]# br2684ctl -b -c 0 -a 0.35 (vpi 0,vci 35 你的vpi和vci的具体数值可以去看XP下的adsl信息或向当地ISP查询。)
RFC1483/2684 bridge: Interface "nas0" created sucessfully
RFC1483/2684 bridge: Communicating over ATM 0.0.33, encapsulation: LLC
RFC1483/2684 bridge: Interface configured
6、激活nas0
[root@localhost tmp]# ifconfig nas0 up
[root@localhost tmp]# ifconfig
lo Link encapocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1426 errors:0 dropped:0 overruns:0 frame:0
TX packets:1426 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2271757 (2.1 MiB) TX bytes:2271757 (2.1 MiB)
nas0 Link encap:Ethernet HWaddr 00:08:5C:08:CB:6F
inet6 addr: fe80::208:5cff:fe08:cb6f/64 Scopeink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13114 errors:0 dropped:0 overruns:0 frame:0
TX packets:12551 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10585126 (10.0 MiB) TX bytes:1614057 (1.5 MiB)
如果有nas0出现,那说明操作成功。
7、pppoe的设置
[root@linux root]# adsl-setup
Welcome to the Roaring Penguin PPPoE 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 bxxxnxnx@sympatico.ca):(输入你的adsl帐号)
INTERFACE
>>> Enter the Ethernet interface connected to the DSL 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): nas0(就是nas0,不要用别的)
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 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: (你的域名服务器的主IP地址,根据自己的情况设置)
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: (你的域名服务器的副IP地址,根据自己的情况设置)
PASSWORD
>>> Please enter your PPPoE password:(帐号密码)
>>> Please re-enter your PPPoE password:(确认帐号密码)
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): 1(防火墙设置,自己家用,选1吧)
** Summary of what you entered **
Ethernet Interface: nas0
User name: (自己的adsl用户)
Activate-on-demand: No
Primary DNS: (自己的设置)
Secondary DNS: (自己的设置)
Firewalling: STANDALONE
>>> Accept these settings and adjust configuration files (y/n)? y(不保存怎么能行,当然是“y”)
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)
Congratulations, it should be all set up!
Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring
it down. Type 'pppoe-status' to see the link status.
8、建立连接。
[root@localhost tmp]# adsl-start
[root@localhost tmp]# ifconfig
lo Link encapocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2281 errors:0 dropped:0 overruns:0 frame:0
TX packets:2281 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2415979 (2.3 MiB) TX bytes:2415979 (2.3 MiB)
nas0 Link encap:Ethernet HWaddr 00:08:5C:61:75:1A
inet6 addr: fe80::208:5cff:fe61:751a/64 Scopeink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:576 errors:0 dropped:0 overruns:0 frame:0
TX packets:594 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:350866 (342.6 KiB) TX bytes:78820 (76.9 KiB)
ppp0 Link encapoint-to-Point Protocol
inet addr:124.129.83.213 P-t-P:221.0.255.157 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:430 errors:0 dropped:0 overruns:0 frame:0
TX packets:442 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:344960 (336.8 KiB) TX bytes:58169 (56.8 KiB)
如果有ppp0出现,那说明你成功了。
现在你可以去上网冲浪了。
第三步、BT下载工具、amule(电驴)、的安装和使用
1、transmission(BT)
从网上下个transmission-0.72.tar.gz回来然后解压缩。
[root@localhost tmp]#tar -zxvf transmission-0.72.tar.gz
进入解压缩目录
[root@localhost tmp]# cd transmission
[root@localhost transmission]#
接下来执行./configure,这个好像是检查当前系统是否适合安装所要安装的软件,以及所依赖的其它软件是否安装。好像是这个目的,望高手指正。
[root@localhost transmission]# ./configure --prefix=/usr/local/transmission
加入--prefix=/usr/local/transmission是指定安装路经,以便于我们日后删除方便。
注意执行./configure后终端显示的信息,如果报错停止那么要记下出错的信息开始是为什么出错,多数是应为依赖关系得不到满足。如果你解决不了可以把错误信息帖到网上来大家帮你解决。
接下来执行make进行编译。
[root@localhost transmission]# make
如果make也正确结束的话下来就是安装了make install
[root@localhost transmission]# make install
安装完成,进入安装目录
[root@localhost transmission]# cd /usr/local/transmission/bin
[root@localhost bin]#
执行transmission-gtk
[root@localhost bin]# ./transmission-gtk
加入./的意思是执行当前目录中的程序,不然系统会到/bin、/sbin、/usr/bin、/usr/sbin去寻找transmission-gtk,当然就找不到了。你可以在桌面建立快捷方式方便使用。transmission虽然功能简单但是在我这里速度还可以。你还可以尝试Azureus,在我这里Azureus的速度实在没法接受。另外还有BitTorrent,这个我还没试过。
启动transmission后打开首选项在listening port 中填入6881,这是你使用的端口,当然你还可以使用其它端口。然后打开终端使用下面的命令打开6881端口。
[root@localhost ~]# iptables -I INPUT -p tcp --dport 6881 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp --dport 6881 -j ACCEPT
你也可以把这两条命令加入到/etc/ppp/firewall-standalone文件中。在执行adsl-start自动执行这两条命令。
yum install pciutils -y
usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息!!!
安装CentOS5、驱动usb-adsl、安装下载软件、安装多媒体软件、编译内核、适合新手。
在正文开始前我先说两句废话,我喜欢玩电脑但是很菜,所以以下所写的肯定会有很多错误的地方,比如正确的用语等等。希望高手们能多多的指正。以下方法只在CentOS5系统中通过,不保证其它系统也能通过。
第一步:CentOS5系统安装。
-、系统安装
介绍基本安装的文章很多,我这里只说一下我的分区情况和GRUB(开机引导程序)安装情况。安装顺序,先安装XP再装CentOS5.
1、分区
在安装进行到分区这一步时一定要选择自定义分区。建议建立两个主分区。下面是我的分区情况,供参考。
Device Boot Start End Blocks Id System
/dev/hdc1 1 787 6321546 7 HPFS/NTFS (第一主分区安装XP,大小看你的习惯)
/dev/hdc2 * 788 1934 9213277+ 83 Linux (第二主分区安装CentOS5,并设为活动分区。大小为8G,最好能在大点)
/dev/hdc3 1935 9729 62613337+ f W95 Ext'd (LBA)
/dev/hdc5 1935 3268 10715323+ 7 HPFS/NTFS
/dev/hdc6 3269 5563 18434556 b W95 FAT32
/dev/hdc7 5564 6839 10249438+ b W95 FAT32
/dev/hdc8 6840 9602 22193766 b W95 FAT32
/dev/hdc9 9603 9729 1020096 82 Linux swap / Solaris (linux交换分区,大小为你的内存大小或内存大小的两倍。把swap放在最后好像可以提高读写的速度,也不知道有没有道理。)
在安装结束后重起电脑会进入XP,并不会出现GRUB引导界面,别急,这是因为活动分区还是/dev/hdc1的过。进入XP利用PM之类的工具将活动分区改为/dev/hdc2重启后就出现GRUB引导界面了。
这样分区的好处是减少一个系统崩溃时对另一个系统的影响。比如XP崩溃需要重新安装时它会覆盖MBR,如果我们把GRUB安装在MBR,这时你就无法进入CentOS5了,你必须用引导盘进入linux的救援模式键入命令从装GRUB。这虽然简单但是对于一个从未接触过linux的新手来说也许是致命的。如果我们把GRUB安装在/dev/hdc2,在重装了XP后只需要改变下活动分区就可以了。再比如linux崩溃了(尽管这不容易,但是对于向我这一类的新手来说还是很有可能的)我们也同样只需利用win98或带有fdisk的DOS引导盘在DOS下把活动分区改为XP就可以进入XP了。(XP引导盘是不是也可以改变活动分区我不知道,如果可以的话还希望高手们教我们这些菜鸟)
2、GRUB引导设置。
我的配置文件:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/hdc2
# initrd /boot/initrd-version.img
#boot=/dev/hdc2
default=3 (默认引导系统,第一个为0,这里3代表第四个WinXP系统为默认引导系统)
timeout=8 (默认引导等待时间,单位秒)
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.20.10-02)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10-02 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10-02.img
title CentOS (2.6.18-8.el5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-8.el5.img
title CentOS (2.6.20.10)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10.img
title WinXP
rootnoverify (hd0,0)
chainloader +1
你可以改变default=后面的数字以选择你要默认引导的系统。改变timeout=后面的数值以改变默认引导时的等待时间,如果为0表示不等待。
如果你在安装过程中遇到其他问题可以多多求助于网络。基本上都能得到解决。
第二步,连接互联网。
这一步非常的重要,现在的linux对互联网的依赖非常强。
我所使用的是usb的adsl。所以这里只介绍usb的adsl的安装方法。
说明:usb adsl芯片是Conexant的。
1、首先安装如下的软件包
usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息
linux-atm-2.5.0-1.20050118cvs.i3886.rpm
linux-atm-libs-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须
linux-atm-libs-devel-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须,安装
后三个包CentOS5光盘中没有,我是用的FC6中。
检查rp-pppoe是否安装:
[root@localhost tmp]# rpm -q rp-pppoe
rp-pppoe-3.5-32.1
如果没有安装CentOS5中就有,安装它。
在没有联网之前我们只能通过在终端下使用rpm来安装、升级、卸载软件包。基本命令如下。
rpm -q filename.rpm 查询名为filename的软件包是否安装。
rpm -ivh filename.rpm 安装名为filename的软件包。
rpm -e fielname.rpm 卸载名为filename的软件包。
rpm -qpl filename.rpm 查询名为filename的软件包都将安装那些文件到系统中。
2、准备要用的文件CnxEtU.sys
[root@localhost tmp]#cp /mnt/hdc1/WINDOWS/system32/drivers/CnxEtU.sys /tmp
如果你使用默认内核不支持ntfs分区,你可以在XP下把CnxEtU.sys先放到一个fat32分区。然后在linux下挂载这个fat32分区。
[root@localhost tmp]#mkdir /mnt/hdc7 新建一个文件夹,以便将一个WIN分区挂载到linux下。
[root@localhost tmp]#mount -t vfat /dev/hdc7 /mnt/hdc7 将/dev/hdc7分区以文件夹方式挂载到/mnt/hdc7。
3、用lsusb命令查看usb adsl连接情况
[root@localhost tmp]# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 002: ID 0572:cb00 Conexant Systems (Rockwell), Inc. E-Tech ADSL Modem v2
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
4、生成cxacru-fw.bin文件
需要CnxEtU.sys文件,此文件从windows版驱动而来,在windows下查找此文件。
利用编辑器,比如gedit新建cxacru-fw.c文件,将下面内容粘贴到文件中去。
/*****************************************************************************
* cxacru-fw - utility to extract firmware for the USB ADSL modems based on
* Conexant AccessRunner chipset, from the Conexant driver for
* Windows(R)
*
* Copyright (C) 2005 Roman Kagan (rkagan % mail ! ru)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****************************************************************************/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <error.h>
#include <argp.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <endian.h>
#include <byteswap.h>
#if __BYTE_ORDER == __BIG_ENDIAN
static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}
static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}
#else
static inline uint16_t le16_to_cpup(uint16_t *x) {return *x;}
static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}
#endif
uint8_t *findfw(uint8_t *buf, int len, int *fwlen)
{
const static uint8_t fwstart[] = { /* ARM LE asm */
0x1c, 0x24, 0x9f, 0xe5, /* e59f241c ldr r2, [pc, #0x41c] */
0x00, 0x10, 0xa0, 0xe3, /* e3a01000 mov r1, #0x0 */
0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */
0x22, 0x00, 0x00, 0xeb, /* eb000022 bl 0x9c */
};
const static uint8_t bpstart[] = {
0x78, 0x20, 0x9f, 0xe5, /* e59f2078 ldr r2, [pc, #0x78] */
0x01, 0x10, 0xa0, 0xe3, /* e3a01001 mov r1, #0x1 */
0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */
0x70, 0x20, 0x9f, 0xe5, /* e59f2070 ldr r2, [pc, #0x70] */
};
uint8_t *fw, *bp, *nt_header, *sect_header;
uint32_t tmp;
uint16_t nsect;
uint32_t dataoff, datalen;
*fwlen = 0;
/* IMAGE_DOS_HEADER size and .Signature */
if (len < 0x40 || memcmp(buf, "MZ", 2)) {
error(0, 0, "file is not a DOS executable");
return NULL;
}
/* IMAGE_NT_HEADERS size and .Signature */
tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));
nt_header = buf + tmp;
if (len < tmp + 0x18 || memcmp(nt_header, "E\0\0", 4)) {
error(0, 0, "file is not a portable executable (PE)");
return NULL;
}
/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */
nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));
/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */
tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));
sect_header = nt_header + 0x18 + tmp;
for (; nsect; nsect--, sect_header += 0x28) {
if (sect_header + 0x28 > buf + len) {
error(0, 0, "file header corrupted");
return NULL;
}
if (!memcmp(sect_header, ".data", 5))
break;
}
if (!nsect) {
error(0, 0, "`.data' section not found");
return NULL;
}
/* IMAGE_SECTION_HEADER.SizeOfRawData */
datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));
/* IMAGE_SECTION_HEADER.PointerToRawData */
dataoff = le32_to_cpup((uint32_t *) (sect_header + 0x14));
if (dataoff + datalen > len) {
error(0, 0, "`.data' section extends beyond end of file");
return NULL;
}
/* find the starting sequence of the firmware image */
fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));
if (!fw) {
error(0, 0, "firmware start sequence not found");
return NULL;
}
*fwlen = datalen - (fw - (buf + dataoff));
/* find the starting sequence of the boot ROM patch, if present */
bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));
if (bp)
*fwlen = bp - fw;
return fw;
}
const char * argp_program_version = "002";
const char * argp_program_bug_address =
"<accessrunner-general at lists dot sourceforge dot net>";
const static char args_doc[] = "INFILE OUTFILE";
const static char doc[] =
"Firmware extractor for Conexant AccessRunner ADSL USB modems\n"
"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"
"OUTFILE - firmware image (usually cxacru-fw.bin)";
struct args {
char *infile;
char *outfile;
};
static error_t parse_opts(int key, char *arg, struct argp_state *state)
{
struct args *args = state->input;
switch (key) {
case ARGP_KEY_ARG:
switch (state->arg_num) {
case 0:
args->infile = arg;
break;
case 1:
args->outfile = arg;
break;
default:
argp_usage (state);
}
break;
case ARGP_KEY_END:
if (state->arg_num < 2)
argp_usage (state);
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
static struct argp argp = {0, parse_opts, args_doc, doc};
int main(int argc, char **argv)
{
int ret, fd;
struct args args;
struct stat instat;
uint8_t *buf, *fw;
int len, fwlen;
argp_parse(&argp, argc, argv, 0, NULL, &args);
fd = open(args.infile, O_RDONLY);
if (fd < 0)
error(1, errno, "failed to open `%s' for reading", args.infile);
ret = fstat(fd, &instat);
if (ret)
error(1, errno, "failed to obtain the size of `%s'", args.infile);
len = instat.st_size;
buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
close(fd);
if (!buf)
error(1, errno, "failed to mmap `%s'", args.infile);
fw = findfw(buf, len, &fwlen);
if (!fw)
error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);
fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0)
error(1, errno, "failed to open `%s' for writing", args.outfile);
if (write(fd, fw, fwlen) != fwlen)
error(1, errno, "failed to write firmware to `%s'", args.outfile);
close(fd);
munmap(buf, len);
printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);
}
新建makefile将下面内容粘贴到文件中。
cxacru-fw:
编译cxacru-fw.c文件生成cxacru-fw可执行文件。
[root@localhost tmp]# make
从CnxEtU.sys提取固件信息生成firmeare文件。
[root@localhost tmp]# ./cxacru-fw cnxetu.sys cxacru-fw.bin
拷贝到/lib/firmware文件夹。
[root@localhost tmp]# cp cxacru-fw.bin /lib/firmware
热插拔一下adsl。
5、运行br2684ctl驱动adsl建立虚拟网卡界面nas0。
[root@localhost tmp]# br2684ctl -b -c 0 -a 0.35 (vpi 0,vci 35 你的vpi和vci的具体数值可以去看XP下的adsl信息或向当地ISP查询。)
RFC1483/2684 bridge: Interface "nas0" created sucessfully
RFC1483/2684 bridge: Communicating over ATM 0.0.33, encapsulation: LLC
RFC1483/2684 bridge: Interface configured
6、激活nas0
[root@localhost tmp]# ifconfig nas0 up
[root@localhost tmp]# ifconfig
lo Link encapocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1426 errors:0 dropped:0 overruns:0 frame:0
TX packets:1426 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2271757 (2.1 MiB) TX bytes:2271757 (2.1 MiB)
nas0 Link encap:Ethernet HWaddr 00:08:5C:08:CB:6F
inet6 addr: fe80::208:5cff:fe08:cb6f/64 Scopeink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13114 errors:0 dropped:0 overruns:0 frame:0
TX packets:12551 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10585126 (10.0 MiB) TX bytes:1614057 (1.5 MiB)
如果有nas0出现,那说明操作成功。
7、pppoe的设置
[root@linux root]# adsl-setup
Welcome to the Roaring Penguin PPPoE 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 bxxxnxnx@sympatico.ca):(输入你的adsl帐号)
INTERFACE
>>> Enter the Ethernet interface connected to the DSL 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): nas0(就是nas0,不要用别的)
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 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: (你的域名服务器的主IP地址,根据自己的情况设置)
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: (你的域名服务器的副IP地址,根据自己的情况设置)
PASSWORD
>>> Please enter your PPPoE password:(帐号密码)
>>> Please re-enter your PPPoE password:(确认帐号密码)
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): 1(防火墙设置,自己家用,选1吧)
** Summary of what you entered **
Ethernet Interface: nas0
User name: (自己的adsl用户)
Activate-on-demand: No
Primary DNS: (自己的设置)
Secondary DNS: (自己的设置)
Firewalling: STANDALONE
>>> Accept these settings and adjust configuration files (y/n)? y(不保存怎么能行,当然是“y”)
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)
Congratulations, it should be all set up!
Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring
it down. Type 'pppoe-status' to see the link status.
8、建立连接。
[root@localhost tmp]# adsl-start
[root@localhost tmp]# ifconfig
lo Link encapocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2281 errors:0 dropped:0 overruns:0 frame:0
TX packets:2281 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2415979 (2.3 MiB) TX bytes:2415979 (2.3 MiB)
nas0 Link encap:Ethernet HWaddr 00:08:5C:61:75:1A
inet6 addr: fe80::208:5cff:fe61:751a/64 Scopeink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:576 errors:0 dropped:0 overruns:0 frame:0
TX packets:594 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:350866 (342.6 KiB) TX bytes:78820 (76.9 KiB)
ppp0 Link encapoint-to-Point Protocol
inet addr:124.129.83.213 P-t-P:221.0.255.157 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:430 errors:0 dropped:0 overruns:0 frame:0
TX packets:442 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:344960 (336.8 KiB) TX bytes:58169 (56.8 KiB)
如果有ppp0出现,那说明你成功了。
现在你可以去上网冲浪了。
第三步、BT下载工具、amule(电驴)、的安装和使用
1、transmission(BT)
从网上下个transmission-0.72.tar.gz回来然后解压缩。
[root@localhost tmp]#tar -zxvf transmission-0.72.tar.gz
进入解压缩目录
[root@localhost tmp]# cd transmission
[root@localhost transmission]#
接下来执行./configure,这个好像是检查当前系统是否适合安装所要安装的软件,以及所依赖的其它软件是否安装。好像是这个目的,望高手指正。
[root@localhost transmission]# ./configure --prefix=/usr/local/transmission
加入--prefix=/usr/local/transmission是指定安装路经,以便于我们日后删除方便。
注意执行./configure后终端显示的信息,如果报错停止那么要记下出错的信息开始是为什么出错,多数是应为依赖关系得不到满足。如果你解决不了可以把错误信息帖到网上来大家帮你解决。
接下来执行make进行编译。
[root@localhost transmission]# make
如果make也正确结束的话下来就是安装了make install
[root@localhost transmission]# make install
安装完成,进入安装目录
[root@localhost transmission]# cd /usr/local/transmission/bin
[root@localhost bin]#
执行transmission-gtk
[root@localhost bin]# ./transmission-gtk
加入./的意思是执行当前目录中的程序,不然系统会到/bin、/sbin、/usr/bin、/usr/sbin去寻找transmission-gtk,当然就找不到了。你可以在桌面建立快捷方式方便使用。transmission虽然功能简单但是在我这里速度还可以。你还可以尝试Azureus,在我这里Azureus的速度实在没法接受。另外还有BitTorrent,这个我还没试过。
启动transmission后打开首选项在listening port 中填入6881,这是你使用的端口,当然你还可以使用其它端口。然后打开终端使用下面的命令打开6881端口。
[root@localhost ~]# iptables -I INPUT -p tcp --dport 6881 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp --dport 6881 -j ACCEPT
你也可以把这两条命令加入到/etc/ppp/firewall-standalone文件中。在执行adsl-start自动执行这两条命令。
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/3227/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2024-4-18 19:20
评论列表