|
Lines 470-475
Link Here
|
| 470 |
</sect2> |
470 |
</sect2> |
| 471 |
</sect1> |
471 |
</sect1> |
| 472 |
|
472 |
|
|
|
473 |
<sect1 id="wireless"> |
| 474 |
<sect1info> |
| 475 |
<authorgroup> |
| 476 |
<author> |
| 477 |
<firstname>Eric</firstname> |
| 478 |
<surname>Anderson</surname> |
| 479 |
<contrib>Written by </contrib> |
| 480 |
</author> |
| 481 |
</authorgroup> |
| 482 |
</sect1info> |
| 483 |
<title>Wireless</title> |
| 484 |
|
| 485 |
<sect2> |
| 486 |
<title>Introduction</title> |
| 487 |
<para>It can be very useful to be able to use a computer without the |
| 488 |
annoyance of having a network cable attached at all times. FreeBSD can |
| 489 |
be used as a wireless client, and even as a wireless <quote>access |
| 490 |
point</quote>.</para> |
| 491 |
</sect2> |
| 492 |
|
| 493 |
<sect2> |
| 494 |
<title>Wireless Devices</title> |
| 495 |
<para>There are two main types of wireless devices: access points, and clients.<para> |
| 496 |
|
| 497 |
<sect3> |
| 498 |
<title>Access Points</title> |
| 499 |
<para>Access points are wireless networking devices that allow one or more wireless |
| 500 |
clients to use the device as a central hub. When using an access point, all |
| 501 |
clients communicate through the access point. Multiple access points are often |
| 502 |
used to cover a complete area such as a house, business, or park with a wireless |
| 503 |
network.</para> |
| 504 |
|
| 505 |
<para>Access points typically have multiple network connections: the wireless card, |
| 506 |
and one or more wired ethernet adapters for connection to the rest of the network. |
| 507 |
</para> |
| 508 |
|
| 509 |
<para>Access points can either be purchased prebuilt, or you can build |
| 510 |
your own with FreeBSD and a supported wireless card. Several vendors make |
| 511 |
wireless access points and wireless cards with various features.</para> |
| 512 |
</sect3> |
| 513 |
|
| 514 |
<sect3> |
| 515 |
<title>Building a FreeBSD Access Point</title> |
| 516 |
|
| 517 |
<sect4><title>Requirements</title> |
| 518 |
<para>In order to set up a wireless access point with FreeBSD, you need to have |
| 519 |
a compatible wireless card. Currently, only cards with the Prism chipset are |
| 520 |
supported. You'll also need a wired network card that is also supported by FreeBSD |
| 521 |
(this shouldn't be difficult to find, FreeBSD supports a lot of different |
| 522 |
devices). For this guide, we'll assume you want to &man.bridge.4; all traffic between |
| 523 |
the wireless device and the network attached to the wired network card.</para> |
| 524 |
</sect4> |
| 525 |
|
| 526 |
<sect4> |
| 527 |
<title>Setting it up</title> |
| 528 |
<para>First, make sure your system can see the wireless card:</para> |
| 529 |
<screen>&prompt.root; <userinput>ifconfig -a</userinput> |
| 530 |
wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 |
| 531 |
inet6 fe80::202:2dff:fe2d:c938%wi0 prefixlen 64 scopeid 0x7 |
| 532 |
inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 |
| 533 |
ether 00:09:2d:2d:c9:50 |
| 534 |
media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps) |
| 535 |
status: no carrier |
| 536 |
ssid "" |
| 537 |
stationname "FreeBSD Wireless node" |
| 538 |
channel 10 authmode OPEN powersavemode OFF powersavesleep 100 |
| 539 |
wepmode OFF weptxkey 1</screen> |
| 540 |
|
| 541 |
<para>Don't worry about the details now, just make sure it shows you |
| 542 |
something to indicate you have a wireless card installed.</para> |
| 543 |
|
| 544 |
<para>Next, you'll need to load a module in order to get the bridging part |
| 545 |
of FreeBSD ready for the access point. In order to load the &man.bridge.4; module, |
| 546 |
simply run the following command:</para> |
| 547 |
|
| 548 |
<screen>&prompt.root; <userinput>kldload bridge</userinput></screen> |
| 549 |
|
| 550 |
<para>It should not have produced any errors when loading the module. If it |
| 551 |
did, you may need to compile the &man.bridge.4; code into your kernel. The |
| 552 |
(<xref linkend="bridging">) Handbook should be able |
| 553 |
to help you accomplish that task.</para> |
| 554 |
|
| 555 |
<para>Now that you have the bridging stuff done, we need to tell the FreeBSD |
| 556 |
kernel which interfaces to bridge together. We do that by using sysctl:</para> |
| 557 |
|
| 558 |
<screen>&prompt.root; <userinput>sysctl net.link.ether.bridge=1</userinput></screen> |
| 559 |
<screen>&prompt.root; <userinput>sysctl net.link.ether.bridge_cfg="wi0 xl0"</userinput></screen> |
| 560 |
<screen>&prompt.root; <userinput>sysctl net.inet.ip.forwarding=1</userinput></screen> |
| 561 |
|
| 562 |
<para>Now it's time for the wireless card setup.</para> |
| 563 |
<para>The following commands will set the card into BSS mode (turning it |
| 564 |
into an access point):</para> |
| 565 |
|
| 566 |
<screen>&prompt.root; <userinput>wicontrol -s "FreeBSD AP" -t 3 -n "my_net"</userinput></screen> |
| 567 |
<screen>&prompt.root; <userinput>ifconfig wi0 inet up ssid my_net mediaopt hostap</userinput></screen> |
| 568 |
<screen>&prompt.root; <userinput>wicontrol -p 6</userinput></screen> |
| 569 |
|
| 570 |
<para>The first &man.wicontrol.8; command tells FreeBSD that the name of this access point |
| 571 |
is FreeBSD AP by using the -s FreeBSD AP flags, to use auto rate selection at the |
| 572 |
highest rate (11Mbps) with the -t 3 flags, and the SSID (station ID) is set to |
| 573 |
my_net with the -n flag. Check out &man.wicontrol.8; for more information.</para> |
| 574 |
|
| 575 |
<para>The &man.ifconfig.8; line brings the wi0 interface up, and sets its SSID to my_net. |
| 576 |
This is a little redundant, but it's shown here to emphasize that you can do |
| 577 |
these settings in either place. You'll also notice a mediaopt hostap setting; |
| 578 |
this setting is to tell &man.ifconfig.8; to put the interface into access point mode.</para> |
| 579 |
|
| 580 |
<para>The second &man.wicontrol.8; line turns the interface into access point mode, instead |
| 581 |
of the default IBSS (ad-hoc) mode.</para> |
| 582 |
|
| 583 |
<para>Now you should have a complete functioning access point up and running. You |
| 584 |
are encouraged to read &man.wicontrol.8;, &man.ifconfig.8;, and &man.wi.4; for further information. |
| 585 |
</para> |
| 586 |
|
| 587 |
<para>It is also suggested that you read the section on encryption that follows.</para> |
| 588 |
</sect4> |
| 589 |
</sect3> |
| 590 |
|
| 591 |
<sect3> |
| 592 |
<title>Clients</title> |
| 593 |
<para>A wireless client is a system that accesses an access point or another client |
| 594 |
directly. </para> |
| 595 |
|
| 596 |
<para>Typically, wireless clients only have one network device, the wireless |
| 597 |
networking card.<para> |
| 598 |
|
| 599 |
<para>There are a few different ways to configure a wireless client. These are based |
| 600 |
on the different wireless modes, generally BSS (infrastructure mode, which requires an |
| 601 |
access point), and IBSS (ad-hoc, or peer-to-peer mode). In our example, we'll use the |
| 602 |
most popular of the two, BSS mode, to talk to an access point.</para> |
| 603 |
|
| 604 |
<sect4> |
| 605 |
<title>Requirements</title> |
| 606 |
<para>There is only one real requirement for setting up FreeBSD as a wireless client. |
| 607 |
You'll need a wireless card that is supported by FreeBSD.</para> |
| 608 |
</sect4> |
| 609 |
|
| 610 |
<sect4> |
| 611 |
<title>Setting Up A Wireless FreeBSD Client</title> |
| 612 |
<para>You'll need to know a few things about the wireless network you are joining before |
| 613 |
you start. In this example, we are joining a network that has a name of my_net, and |
| 614 |
encryption turned off.</para> |
| 615 |
|
| 616 |
<para>Note: In this example, we are not using encryption, which is a dangerous situation. |
| 617 |
In the next section, you'll learn how to turn on encryption, and why it is important to |
| 618 |
do so, and why some encryption technologies still don't completely protect you.</para> |
| 619 |
|
| 620 |
<para>Make sure your card is recognized by FreeBSD:</para> |
| 621 |
|
| 622 |
<screen>&prompt.root; <userinput>ifconfig -a</userinput> |
| 623 |
wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 |
| 624 |
inet6 fe80::202:2dff:fe2d:c938%wi0 prefixlen 64 scopeid 0x7 |
| 625 |
inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 |
| 626 |
ether 00:09:2d:2d:c9:50 |
| 627 |
media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps) |
| 628 |
status: no carrier |
| 629 |
ssid "" |
| 630 |
stationname "FreeBSD Wireless node" |
| 631 |
channel 10 authmode OPEN powersavemode OFF powersavesleep 100 |
| 632 |
wepmode OFF weptxkey 1</screen> |
| 633 |
|
| 634 |
<para>Now, we'll set the card to the correct settings for our network:</para> |
| 635 |
|
| 636 |
<screen>&prompt.root; <userinput>ifconfig wi0 inet 192.168.0.20 netmask 255.255.255.0 ssid my_net</userinput></screen> |
| 637 |
|
| 638 |
<para>Replace 192.168.0.20 and 255.255.255.0 with a valid IP address and netmask on |
| 639 |
your wired network. Remember, our access point is bridging the data between the |
| 640 |
wireless network, and the wired network, so it will appear to the other devices on |
| 641 |
your network that you are on the wired network just as they are.</para> |
| 642 |
|
| 643 |
<para>Once you have done that, you should be able to ping hosts on the wired network |
| 644 |
just as if you were connected using a standard wired connection.</para> |
| 645 |
|
| 646 |
<para>If you are experiencing problems with your wireless connection, check to make |
| 647 |
sure that your are associated (connected) to the access point: |
| 648 |
|
| 649 |
<screen>&prompt.root; <userinput>ifconfig wi0</userinput></screen> |
| 650 |
|
| 651 |
should return some information, and you should see:</para> |
| 652 |
<screen>status: associated</screen> |
| 653 |
|
| 654 |
<para>If it does not show associated, then you may be out of range of the access point, don't have |
| 655 |
encryption on, or possibly have a configuration problem.</para> |
| 656 |
|
| 657 |
</sect4> |
| 658 |
</sect3> |
| 659 |
|
| 660 |
<sect3> |
| 661 |
<title>Encryption</title> |
| 662 |
|
| 663 |
<para>Encryption on a wireless network is important because you no longer have the |
| 664 |
ability to keep the network contained in a well protected area. Your wireless data |
| 665 |
will be broadcast across your entire neighborhood, so anyone who cares to read it |
| 666 |
can. This is where encryption comes in. By encrypting the data that is sent over |
| 667 |
the air waves, you make it much more difficult for any interested party to grab your |
| 668 |
data right out of the air. </para> |
| 669 |
|
| 670 |
<para>The two most common ways to encrypt the data between your client and the access |
| 671 |
point, are WEP, and &man.ipsec.4;.</para> |
| 672 |
|
| 673 |
<sect4> |
| 674 |
<title>WEP</title> |
| 675 |
<para>WEP is an abbreviation for Wired Equivalency Protocol. WEP is an attempt to |
| 676 |
make wireless networks as safe and secure as a wired network. Unfortunately, it |
| 677 |
has been cracked, and is fairly trivial to break. This also means it isn't something |
| 678 |
to rely on when it comes to encrypting sensitive data. </para> |
| 679 |
|
| 680 |
<para>It's better than nothing, so here's how to turn on WEP on your new FreeBSD |
| 681 |
access point:</para> |
| 682 |
|
| 683 |
<screen>&prompt.root; <userinput>ifconfig wi0 inet up ssid my_net wepkey 0x1234567890 mediaopt hostap</userinput></screen> |
| 684 |
|
| 685 |
<para>And here's how you turn on WEP on a client:</para> |
| 686 |
|
| 687 |
<screen>&prompt.root; <userinput>ifconfig wi0 inet 192.168.0.20 netmask 255.255.255.0 ssid my_net wepkey 0x1234567890</userinput></screen> |
| 688 |
|
| 689 |
<para>Note that you should replace the 0x1234567890 with a more unique key.</para> |
| 690 |
|
| 691 |
</sect4> |
| 692 |
|
| 693 |
<sect4> |
| 694 |
<title>IPsec</title> |
| 695 |
<para>&man.ipsec.4; is a much more robust and powerful tool for encrypting data across a |
| 696 |
network. This is definitely the preferred way to encrypt wireless data over a |
| 697 |
network. You can read more about &man.ipsec.4; security and how to implement it in the |
| 698 |
(<xref linkend="ipsec">) handbook.</para> |
| 699 |
</sect4> |
| 700 |
</sect3> |
| 701 |
|
| 702 |
<sect3> |
| 703 |
<title>Tools</title> |
| 704 |
<para>There are a small number of tools available for use in debugging and setting |
| 705 |
up your wireless network, and here we'll attempt to describe some of them and what |
| 706 |
they do.</para> |
| 707 |
|
| 708 |
<sect4> |
| 709 |
<title>bsd-airtools</title> |
| 710 |
<para>bsd-airtools is a package that includes wireless auditing tools for wep key |
| 711 |
cracking, access point detection, etc.</para> |
| 712 |
|
| 713 |
<para>bsd-airtools can be installed from the ports collection. Information on |
| 714 |
installing ports can be found in (<xref linkend="ports">) the handbook.<para> |
| 715 |
|
| 716 |
<para>dstumbler is the packaged tool that allows for access point discovery and |
| 717 |
signal to noise ratio graphing. If you are having a hard time getting your access |
| 718 |
point up and running, dstumbler may help you get started.</para> |
| 719 |
|
| 720 |
<para>To test your wireless network security, you may choose to use dweputils to |
| 721 |
help you determine if wep is the right solution to your wireless security needs.</para> |
| 722 |
|
| 723 |
</sect4> |
| 724 |
|
| 725 |
<sect4> |
| 726 |
<title>wicontrol, ancontrol, raycontrol</title> |
| 727 |
<para>These are the tools you use to control how your wireless card behaves on the |
| 728 |
wireless network. In the examples above, we've chosen to use &man.wicontrol.8;, since our |
| 729 |
wireless card is a wi0 interface. If you had a Cisco wireless device, it would come |
| 730 |
up as an0, and therefore you would use &man.ancontrol.8;.<para> |
| 731 |
|
| 732 |
</sect4> |
| 733 |
|
| 734 |
<sect4> |
| 735 |
<title>ifconfig</title> |
| 736 |
<para>&man.ifconfig.8; can be used to do many of the same options as &man.wicontrol.8;, however it |
| 737 |
does lack a few options. Check &man.ifconfig.8; for command line parameters and options.</para> |
| 738 |
|
| 739 |
</sect4> |
| 740 |
|
| 741 |
</sect3> |
| 742 |
|
| 743 |
<sect3> |
| 744 |
<title>Supported Cards</title> |
| 745 |
<sect4> |
| 746 |
<title>Access Points</title> |
| 747 |
<para>The only cards that are currently supported for BSS (as an access point) mode are |
| 748 |
devices based on the Prism (or Prism 2, 2.5) chipset. For a complete list, look |
| 749 |
at &man.wi.4;.</para> |
| 750 |
|
| 751 |
</sect4> |
| 752 |
|
| 753 |
<sect4> |
| 754 |
<title>Clients</title> |
| 755 |
<para>Almost all 802.11b wireless cards are currently supported under FreeBSD. Most |
| 756 |
cards based on Prism, Spectrum24, Hermes, Aironet, and Raylink will work as a wireless |
| 757 |
network card in IBSS (ad-hoc, peer-to-peer, and BSS) mode.</para> |
| 758 |
|
| 759 |
</sect4> |
| 760 |
</sect3> |
| 761 |
|
| 762 |
</sect2> |
| 763 |
</sect1> |
| 764 |
|
| 765 |
|
| 473 |
<sect1 id="bridging"> |
766 |
<sect1 id="bridging"> |
| 474 |
<sect1info> |
767 |
<sect1info> |
| 475 |
<authorgroup> |
768 |
<authorgroup> |