Advanced Wireless Networking
As stated earlier, Linux has had support for wireless networking since the first standards were developed in the early 1990s. With computers getting smaller and smaller, the uses for wireless networking have increased; meanwhile, the transmission speeds also are increasing all the time. There are several different ways to create a wireless network. The following sections introduce you to several Linux commands you can use to initialize, configure, and manage wireless networking on your Fedora system.
Support for Wireless Networking in Fedora
The Linux kernel that ships with Fedora provides extensive support for wireless networking. Related wireless tools for configuring, managing, or displaying information about a wireless connection include the following:
► iwconfig — Sets the network name, encryption, transmission rate, and other features of a wireless network interface
► iwlist — Displays information about a wireless interface, such as rate, power level, or frequency used
► iwpriv — Uses i to set optional features, such as roaming, of a wireless network interface
► iwspy — Shows wireless statistics of a number of nodes
Support varies for wireless devices — most likely in the form of a PCMCIA adapter — although some USB wireless devices now work with Linux. In general, Linux wireless device software (usually in the form of a kernel module) supports the creation of an ethernet device that can be managed by traditional interface tools such as ifconfig— with wireless features of the device managed by the various wireless software tools.
For example, when a wireless networking device is first recognized and initialized for use, the driver will most likely report a new device:
wvlan_cs: WaveLAN/IEEE PCMCIA driver v1.0.6
wvlan_cs: (c) Andreas Neuhaus
wvlan_cs: index 0x01: Vcc 3.3, irq 3, io 0x0100-0x013f
wvlan_cs: Registered netdevice eth0
wvlan_cs: MAC address on eth0 is 00 05 5d f3 1d da
This output (from the dmesgcommand) shows that the eth0device has been reported. If DHCP is in use, the device should automatically join the nearest wireless subnet and be automatically assigned an IP address. If not, the next step is to use a wireless tool such as iwconfigto set various parameters of the wireless device. The iwconfigcommand, along with the device name ( eth0in this example), shows the status:
# iwconfig eth0
eth0 IEEE 802.11-DS ESSID:"GreyUFO" Nickname:"Prism I"
Mode:Managed Frequency:2.412GHz Access Point: 00:02:2D:2E:FA:3C
Bit Rate:2Mb/s Tx-Power=15 dBm Sensitivity:1/3
RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:92/92 Signal level:-11 dBm Noise level:-102 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:4 Missed beacon:0
This example shows a 2Mbps connection to a network named GreyUFO. To change a parameter, such as the transmission rate, use a command-line option with the iwconfigcommand, like so:
# iwconfig eth0 rate 11M
Other options supported by the iwconfigcommand include essid, used to set the NIC to connect to a specific network by named; mode, used to enable the NIC to automatically retrieve settings from an access point or connect to another wireless host; or freq, to set a frequency to use for communication. Additional options include channel, frag, enc(for encryption), power, and txpower. Details and examples of these options are in the iwconfigmanual page.
You can then use the ifconfigcommand or perhaps a graphical Fedora tool to set the device networking parameters, and the interface will work as on a hardwired LAN. One handy output of the iwconfigcommand is the link quality output, which can be used in shell scripts or other graphical utilities for signal monitoring purposes (refer to Chapter 15, "Remote Access with SSH," for an example).
To understand networking with Linux, you need to know the basics of TCP/IP addressing. Internet IP addresses are assigned (for the United States and some other hosts) by the American Registry for Internet Numbers, available at http://www.arin.net/. The agency assigns Internet service providers (ISPs) one or more blocks of IP addresses, which the ISPs can then assign to their subscribers.
You will quickly recognize the current form of TCP/IP addressing, known as IPv4 (IP version 4). In this method, a TCP/IP address is expressed of a series of four decimal numbers — a 32-bit value expressed in a format known as dotted-decimal format, such as 192.168.120.135. Each set of numbers is known as an octet (eight ones and zeros, such as 10000000 to represent 128) and ranges from 0 to 255.
The first octet usually determines what class the network belongs to. There are three classes of networks, as follows:
► Class A— Consists of networks with the first octet ranging from 1 to 126. There are only 126 Class A networks — each composed of up to 16,777,214 hosts. (If you are doing the math, there are potentially 16,777,216 addresses, but no host portion of an address can be all zeros or 255s.) The "10." network is reserved for local network use, and the "127." network is reserved for the loopback address of 127.0.0.1.
NOTE
Notice that zero is not included in Class A. The zero address is used for network-to-network broadcasts. Also, note that there are two other classes of networks, Classes D and E. Class D networks are reserved for multicast addresses and are not for use by network hosts. Class E addresses are deemed experimental, and thus are not open for public addressing.
► Class B— Consists of networks defined by the first two octets, with the first ranging from 128 to 191. The "128." network is also reserved for local network use. There are 16,382 Class B networks — each with 65,534 possible hosts.
► Class C— Consists of a network defined by the first three octets, with the first ranging from 192 to 223. The "192." network is another that is reserved for local network use. There are a possible 2,097,150 Class C networks of up to 254 hosts each.
No host portion of an IP address can be all zeros or 255s. These addresses are reserved for local network broadcasts. Broadcast messages are not typically seen by users. IP addresses with all zeros in the host portion are reserved for network-to-network broadcast addresses
These classes are the standard, but a netmask also determines in what class your network is. The netmask determines what part of an IP address represents the network and what part represents the host. Common netmasks for the different classes are as follows:
► Class A— 255.0.0.0
► Class B— 255.255.0.0
► Class C— 255.255.255.0
Because of the allocation of IP addresses for Internet hosts, it is now impossible to get a Class A network. It is also nearly impossible to get a Class B network (all the addresses have been given out, but some companies are said to be willing to sell theirs), and Class C network availability is dropping rapidly with the current growth of Internet use worldwide. See the following sidebar.
Читать дальше