[root@localhost]# system-config-network
[root@localhost]# netconfig -d eth1 注:配置eth1
--bootproto=(dhcp|bootp|none) Boot protocol to use(
--gateway=STRING Network gateway(指定网关)
--ip=STRING IP address(指定IP地址)
--nameserver=STRING Nameserver(指定DNS客户端)
--netmask=STRING Netmask(指定网络掩码)
--hostname=STRING Hostname( 指定主机名)
--domain=STRING Domain name(指定域名)
-d, --device=STRING Network device (指定网络设备)
--nodns No DNS lookups (没有DNS查询)
--hwaddr=STRING Ethernet hardware address (指定网卡的物理地址)
--description=STRING Description of the device (描述性文字)
Help options: (帮助选项)
-?, --help Show this help message
--usage Display brief usage message
[root@localhost]# adsl-start 注:启动拔号;
[root@localhost]# adsl-stop 注:断开连接;
[root@localhost]# more /etc/wvdial.conf
1.使用内核自带的网卡驱动程序;
2.为特定的网卡编译安装驱动模块;
3.使用NdisWrapper,利用面向Windows驱动程序驱动网卡。
现在市场上销售的绝大多数无线网卡都没有linux内核自带的驱动,所以第一种不予考虑;NdisWrapper软件并不编写linux驱动;
在配置无线网卡之前,必须确保内核设置中启动了无线局域网支持:
#grep CONFIG_NET_RADIO /boot/config-‘uname –r’
CONFIG_NET_RADIO=y
若没有,重新配置、编译内核来启动“Wireless Lan(non-hamradio)Drivers and Wireless Extensions”。(注:uname –r 显示内核版本号)
安装linux-wlan-ng-0.2.1-pre25.tar.gz,内核必须用源码编译过
#tar -zxvf linux-wlan-ng-0.2.1-pre25.tar.gz
#cd linux-wlan-ng-0.2.1-pre25
#./Configure 或者 #make config
-------------- Linux WLAN Configuration Script -------------
The default responses are correct for most users.
Build Prism2.x PCMCIA Card Services (_cs) driver? (y/n) [y]: n
Build Prism2 PLX9052 based PCI (_plx) adapter driver? (y/n) [n]: n
Build Prism2.5 native PCI (_pci) driver? (y/n) [n]: n
Build Prism2.5 USB (_usb) driver? (y/n) [n]: y
Linux source directory [/usr/src/linux]:
The kernel source tree is version 2.4.22
Alternate target install root directory on host []:
Module install directory [/lib/modules/2.4.22]:
It looks like you have a System V init file setup.
Prefix for build host compiler? (rarely needed) []:
Build for debugging (see doc/config.debug) (y/n) [y]:
Configuration successful.
#make all
#make install
然后修改相关文件:
1. 在/etc/wlan/wlan.conf里,设置自己的ssid;
SSID_wlan0="mywlan"
ENABLE_wlan0=y
2. 创建一个wlancfg-mywlan文件;
#cd /etc/wlan
#cp wlancfg-DEFAULT wlancfg-mywlan
并把里面的IS_ADHOC=n改成IS_ADHOC=y
3. 在/etc/modules.conf中加入一行:alias wlan0 prism2_usb
在/etc/modprobe.conf中加入一行:alias wlan0 prism2_usb
4. 插上USB无线网卡,指示灯亮
#ifconfig wlan0 up
然后就可以给wlan0配置地址了
#ifconfig wlan0 inet6 add fec0:106:2900::1/64
#ifconfig wlan0
#iwconfig wlan0:看无线网卡的一些信息(包括ssid等)
三、要实现切换,需要在MN上做一些改进
#/etc/init.d/wlan restart
#ifconfig wlan0 up
就可以了,不过地址得重新配置。
Linux-wlan-ng驱动下可以用wlanctl-ng命令来配置和更改无线网卡的参数,对于MN如何切换到外地,可以在MN上配置脚本文件(命名为g2ar):
#wlanctl-ng wlan0 lnxreq_ifstate ifstate=disable
#wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
# wlanctl-ng wlan0 dot11req_start ssid=foreignwlan bsstype=independent beaconperiod=100 dtimperiod=3 cfpollable=false cfpollreq=false cfpperiod=3 cfpmaxduration=100 probedelay=100 dschannel=6 basicrate1=2 basicrate2=4 operationalrate1=2 operationalrate2=4 operationalrate3=11 operationalrate4=22
然后运行命令:#bash g2ar
切换到新的AR或切回本地可以配置同样的脚本文件,只需把ssid换成相应的就可以了。