⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hotplug.txt

📁 采用嵌入式开发的wireless无线模组的应用开发工具
💻 TXT
📖 第 1 页 / 共 3 页
字号:
	To use Hotplug network configuration with 16 bits Pcmciacards, first make sure the Pcmcia subsystem is properly configured andthat cardmgr load the right driver module (in most case, itshould). Then, make sure that you don't have any configuration entriesin /etc/pcmcia/network.opts and /etc/pcmcia/wireless.opts. Make surethat none of entries in your system network configuration use 'eth0'or 'wlan0' (in /etc/network/interfaces for Debian users).	Then, just follow the procedure described above for"Configuration Using Hotplug" to configure your network cards.	You might want a little bit of explanation on why this magicwill work (which would help in case it doesn't work).	There are two types of Pcmcia network configuration scripts,available as /etc/pcmcia/network. The original Pcmcia script configurenetwork cards using options found in /etc/pcmcia/network.opts and/etc/pcmcia/wireless.opts. Most distributions replace it with a scriptcalling 'ifup'. By making sure that network.opts and wireless.opts are"empty", we neutralise the first set of scripts. By making sure nosystem configuration uses 'eth0' or 'wlan0', we neutralise the secondset of scripts, the script would call 'ifup' with the defaultinterface name, which is usually 'eth0', ifup would not find aconfiguration for it and would just ignores it.	The card would still be configured because hotplug networkevents are generated for every interfaces, not only for devicesmanaged by hotplug. So, net.agent would receive an event and performthe necessary steps to configure it.	Personally, I'm still using the original Pcmcia scripts for myPcmcia cards as described in the file PCMCIA.txt, because it stillworks and I will migrate my complex configurations over time.	You can also decide to not use Hotplug for Pcmcia cards andmodify the distribution Pcmcia scripts in /etc/pcmcia/* to handlePcmcia cards with ifrename. You would need to modify/etc/pcmcia/network to add 'ifrename' before 'ifup' the same way itwas done for /etc/hotplug/net.agent. But, as in the long term Pcmciawill migrate to Hotplug, I would not bother...MANUAL LOADING, DOCKING STATIONS--------------------------------	Manual loading is used for built-in network interfaces thatare only use at specific time, and that you want disabled the rest ofthe time. We assume that you still use modules so that when theinterface is not used you can remove the driver from the kernel.	First, you need to set the configuration for those interfaces,the same way it's done for other network interfaces. The maindifference is that you need to specify that those interfaces shouldnot be enabled at boot time. It's also a good idea to disable Hotpluginit scripts.	With Debian, you just need to make sure that the 'auto"keyword doesn't apply to this interface.--------- /etc/network/interfaces -----------# AMD AMD PCnet LANCE PCI cardiface eth4 inet dhcp---------------------------------------------	If you use driver statically built in the kernel, you can justenable and disable those interfaces with 'ifup ethX' and 'ifdown ethX'.	If you use both a modular system and 'ifrename', you will needto change your habits when enabling those devices. The classical 'ifupethX' won't work.	If you don't use Hotplug, you need to do :-----------------------------------modprobe eth4ifrenameifup eth4-----------------------------------	If you use hotplug, you only need to do :-----------------------------------modprobe eth4-----------------------------------	On the other hand, disabling the interface has not changed :-----------------------------------ifdown eth4modprobe -r eth4-----------------------------------	Using "modprobe -r" make sure that if the driver is composedof multiple module all the modules are unloaded.	Docking stations for laptops may contain built-ininterfaces. My previous laptop had one, and Linux had no support forit. To be able to simply manage my docking station, I had created twolittle scripts to enable and disable my network interface.	After docking, you would run :-------- /sbin/dock ----------------------------#!/bin/shmodprobe eth4ifrenameifup eth4------------------------------------------------	And prior to undocking, you would run :-------- /sbin/undock ----------------------------#!/bin/shifdown eth4modprobe -r eth4------------------------------------------------	Thanks to 'ifrename', the network interface in your dock willalways be properly configured regardless of if you have a Pcmcianetwork card in the Pcmcia slot or not.SCHEMES (MULTI-CONFIG)----------------------	Most Ethernet cards will only connect to a single network, orcan use DHCP to be auto-configured. With Wireless Cards, it's muchmore likely that you will need multiple configurations, for example atwork, at home and on-the-go.	Most distributions have various level of support for suchschemes. Some distributions offer simple network schemes, while otheroffer "overall" schemes changing the whole configuration. I documentthe support for schemes in various distributions in the fileDISTRIBUTIONS.txt.	You can also use tools such as ifplugd, waproamd orwlandetect. Those tools are a kind of "wireless-DHCP", they attempt toautomatically detect the proper wireless configuration and applyit. Most will also attempt to detect network changes.	The main limitation of those tools is that they offer verylittle manual control. If two valid alternatives are possible, youcan't switch between them. If a configuration can't be detected, theyusually fail.	That's the same concept as using DHCP versus Static IPaddresses. Some people are very happy with DHCP, my style is Static IPaddresses.	If you use Debian and want to use simple manual schemes, theseare the things you need to do.	1) Make sure that 'ifscheme' and 'ifscheme-mapping' areinstalled on the system. You may find them in a separate tar file onmy web site.	2) Check the path for 'ifscheme-mapping' (using whereis).	3) Modify you /etc/network/interface to add proper mapping andconfiguration.------- /etc/network/interfaces ----------------------# Enable Hotplug support (Sarge and later)mapping hotplug    script echo# SMC 2835W wireless CardBus cardmapping prism0    script /sbin/ifscheme-mappingiface prism0-any inet dhcp    wireless-essid any    wireless-mode managediface prism0-adhoc inet static    address 10.0.1.2    network 10.0.1.0    netmask 255.255.255.0    broadcast 10.0.1.255    wireless-essid THE_ESSID    wireless-mode ad-hoc    wireless-channel 5iface prism0-other inet static    address 10.10.10.2    network 10.10.10.0    netmask 255.255.255.0    broadcast 10.10.10.255    wireless-essid ANOTHER_ESSID    wireless-mode ad-hoc    wireless-key "s:secure"------------------------------------------------------FIRMWARE LOADING----------------	A lot of modern wireless card don't have built in firmware andneed firmware loading. Recent kernel (2.6.X) have a firmwareloader. These are a few notes on how to use it.	First, read the documentation coming with your driver, becauseeach driver has specificities (like the name of the firmware file itrequires).	You need to compile your kernel with firmware loading(CONFIG_FW_LOADER in "Generic Driver Options"). If your driver wasbuilt from the kernel, chances are that it enabled this featurealready. Make sure you boot from this new kernel.	The 'sysfs' file system must be mounted. The easiest is tomount it at boot time, add a line for it in /etc/fstab :-------- /etc/fstab ------------------------------sysfs		/sys	      sysfs  defaults                   0      0--------------------------------------------------	Then, you add the firmware file in the directory where it'sexpected, which is /usr/lib/hotplug/firmware/ in most cases.	Most distributions nowadays have a version of the Hotplugscripts that knows how to deal with firmware. If it is not the case,just grab the 'firmware.agent' file from an alternate source and copyit into your /etc/hotplug directory (make sure it's executable).	You can try the canonical version :		http://linux-hotplug.sourceforge.net/	Or Debian's version :		http://packages.debian.org/unstable/admin/hotplug	Note that firmware loading will usually only work withinterfaces that are fully managed by Hotplug. This is the only way toensure the that proper sequence of action is happening in the rightorder every time. Firmware loading will usually not work properly forinterfaces configured in the init scripts.	This means that if you have a built-in interface that requirefirmware loading, you should just use manage those interfaces likeremovable interfaces (see section above). However, interfaceconfiguration need to be explicitely triggered at boot time.	One possibility is to set-up Hotplug to be run from the initscript at boot time. This is usually an option for recentdistributions (it's not the case for Hotplug in Debian 3.0). But, wehave seen that this has some issues.	The other possibility is to use an hybrid between the initscript method and the hotplug method. First, you need to add an aliasfor the driver in /etc/modprobe.conf. Then, you need to specify amapping for this interface in /etc/iftab, and specify a configurationfor this interface and that that it is enabled at boot time. Lastly,you make sure that the network init scripts run 'ifrename-p'. 'Ifrename' will trigger the module to load, and all the Hotplugevents will be generated properly to configure the interface.DEVICES WITH MULTIPLE NAMES---------------------------	Some wireless drivers offer multiple network interfaces forthe same device. A classical example is the Aironet driver thatcreates a 'ethX' and 'wifiY' for each card.	'ifrename' allow you a finer selection of interfaces than'nameif'. For example, to only rename the pseudo-Ethernet networkinterface name of the Aironet driver, you would do :--------- /etc/iftab -----------------------# Cisco Aironet 350 wireless Pcmcia cardairo*		mac 00:07:0E:* arp 1---------------------------------------------	After that, your device would be available through 'eth0' and'wifi0'.	You can rename both interfaces. You just need to remember that'ifrename' start matching from the last line of the file, so you woulddo :--------- /etc/iftab -----------------------# Cisco Aironet 350 wireless Pcmcia cardwifi*		mac 00:07:0E:*airo*		mac 00:07:0E:* arp 1---------------------------------------------	The current version of 'ifrename' support only the most usefulselectors, and is architectured such as adding selectors is relativelytrivial. If you find a case that 'ifrename' can't handle, you shouldjust extend it.DEVICES WITHOUT MAC ADDRESSES-----------------------------	Most Ethernet and Wireless devices have a fixed and unique MACaddress, and it is therefore advised to name them based on thiscriteria. However, there is also network interfaces that don't have afixed and unique MAC address, for example Ethernet over USB, IP overFireWire, PPP and tunnel interfaces.	The driver for those devices create the interface with a namespecific to the driver, such as ppp* for PPP interfaces and usb* forEthernet over USB, and therefore they are easy to identify andconfigure, and few users feel the need to rename them. Moreover, someof them, such as PPP, have their own configuration scripts andmethodology addressing their unique needs.	There is a few cases where you might want to rename interfaceswithour MAC addresses. One example is two Ethernet over USBdongles. The way to do this is to use alternate ifrenameselectors. Choosing the right selector depend on what you want toachieve.	A quick theoretical example to illustrate :--------- /etc/iftab -----------------------# All other usbnet devicesusb*		driver usbnet# Specific usbnet devicesusb-p		firmware "Prolific PL-2301/PL-2302"usb-4		bus-info usb-00:02.0-1.4---------------------------------------------TROUBLESHOOTING---------------	If your interface doesn't show up as expected with ifconfig,you will need to find out why. First, you need to be familiar with thesequence of actions in the system and find which one did not happen.	You need to check that the driver module(s) was loaded using'lsmod'.	You need to check if the interface was properly renamed with'ifrename'. You can use 'ifrename -D -V' to debug your /etc/iftab.	Get the the list of interfaces on your system with 'cat/proc/net/dev', and check if an interface is using the name youassigned or 'eth0'. Check any suspicious interfaces with 'ifconfigeth0', and check its MAC address. Note that some rare drivers don'thave a proper MAC address before brought up, which fools ifrename.	Verify that no line in /etc/iftab matches the all-zero MACaddress. The all-zero MAC address matches the loopback interface 'lo'and various pseudo network devices, renaming the loopback interface ishighly discouraged.	You need to check which configuration was given to theinterface using 'ifconfig' and 'iwconfig'.	The Hotplug subsystem has also good debugging facilities.	To enable Hotplug debugging, just make sure the variable DEBUGis defined in /sbin/hotplug :--------- /sbin/hotplug --------------------------------- /sbin/hotplug-old      Tue Mar 26 09:00:20 2002+++ /sbin/hotplug       Fri Feb 20 18:40:38 2004@@ -22,7 +22,7 @@ cd /etc/hotplug . hotplug.functions -# DEBUG=yes export DEBUG+DEBUG=yes export DEBUG  if [ "$DEBUG" != "" ]; then     mesg "arguments ($*) env (`env`)"------------------------------------------------------	Then, you can check your message logs for Hotplug events with'tail -f /var/log/messages'. Verify that the various Hotplug eventshappen as expected (pci, firmware, net...), and verify the logmessages from 'net.agent'.	Have fun...	Jean

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -