Ad-hoc wireless networking with debian linux by ywr18717

VIEWS: 299 PAGES: 13

									Ad-hoc wireless networking with
         debian linux:

                Tim Ireland „06
                Adam Nyzio „06
         Department of Computer Science

         Brian Donovan (PhD student)
 Department of Electrical and Computer Engineering

           University of Massachusetts
                  January 2006


                                             Introduction   1-1
                      Outline

Overview of Tools
 Linux built in commands and tools.
 Madwifi, atheros specific pcmcia NIC driver (details)


Setup and Operation
 Getting a link up
 Tweaking the link for optimum performance
 Generating traffic on the link
 Capturing traffic for analysis

                                             Introduction   1-2
  Equipment setup                  2.4 GHz 24 dBi High Performance
                                   Reflector Grid
                                   Wireless LAN Antenna
                                   (8 degree beam width)




                                              N-male
                                              to N-male cable

                                                 pigtail



                                               Proxim Orinoco
Linux laptop driver for Atheros                8470-FC
chipset: http://www.madwifi.org/               802.11b/g PC Card

                                                    Introduction   1-3
Overview of Tools
 Interface configuration, ifconfig
    allows you to configure any network interface.
    statically set the ip address and network mask:
        • ifconfig ath0 192.168.1.1
        • ifconfig ath0 netmask 255.255.255.0
      set the MAC address:
        • ifconfig ath0 hw 00:11:22:33:44:55
 If things are not working correctly it can be
  beneficial to bring the interface down and then back
  up again. Note: this forces the interface to re-read
  the configuration in the file /etc/network/interfaces
      ifdown ath0
      ifup ath0


                                                       Introduction   1-4
Overview of Tools
   /etc/network/interfaces
        This file is the static configuration that the system reads when bringing the interface
         up.
        You can also specify some wireless settings for the interface as well.
        Here is a sample config file that will bring a machine up into an ad-hoc network called
         CS496, on channel 6, with 254 nodes, and we specify our ip address statically. It will
         also configure the ethernet port to be on another network.

           •   #Wireless interface
           •   auto ath0
           •   iface ath0 inet static
           •   address 192.168.1.1
           •   netmask 255.255.255.0
           •   wireless_mode Ad-Hoc
           •   wireless_essid CS496
           •   channel 6

           •   #Ethernet interface
           •   auto eth0
           •   iface eth0 inet static
           •   address 192.168.2.1
           •   netmask 255.255.255.0




                                                                               Introduction        1-5
Overview of Tools
 Wireless configuration, iwconfig
   Allows you to configure options for the wireless interface
    (ath0).
   Say we want to set the card to join a specific wireless
    network:
        • iwconfig ath0 essid NETWORKNAME
      Set the channel for the card to operate on:
        • iwconfig ath0 channel 6
      Specify the bitrate of the card as well:
        • iwconfig ath0 rate 54M
      Change between Ad-Hoc mode and Managed mode:
        • iwconfig ath0 mode Ad-Hoc
      Set the card to associate with a specific access point:
        • iwconfig ath0 ap 00:11:22:33:44:55
      Read the manpage for more details (man iwconfig)


                                                        Introduction   1-6
Overview of Tools
 Wireless configuration, iwlist
   Allows you to view information about the wireless
    networks around you.
   Check for signal strength of available networks:
        • iwlist ath0 ap
      Check for signal strength of a known access point:
        • iwlist ath0 ap | grep 00:11:22:33:44:55




                                                    Introduction   1-7
Overview of Tools
 Madwifi Tools (www.madwifi.org/wiki)
   With long distance links the timers for ACK
    timeouts must be tweaked to reflect the longer
    transmission times. We can set them appropriately
    with the athctrl utility, by specifying the distance
    in meters:
        • athctrl –i ath0 –d 1600
      Remember that you may have to reset this distance
       setting each time the card is brought down and
       back up again. If it does not seem to be working
       correctly after some changes, try poping out the
       card and re-inserting it.


                                             Introduction   1-8
Setup and Operation
 Getting a link up (using config file)
    Using the configuration file /etc/network/interfaces from
     the pervious slides will make it easy to get the link up and
     running. Once the file is ready, just run ifup ath0, and it will
     create the BSS with the network name that you provided.
    Now if another node was to run iwlist ath0 ap then they would
     see an access point listed with your MAC address.
    If the other node had the same network name listed in
     wireless_essid of their config file, then they would
     automatically join the network.
    In order to route to each other, the ip address of each host
     must be in the same subnet, and they must have different
     addresses.
    At this point the machines should be able to ping each other
     over the wireless link.

                                                       Introduction   1-9
Setup and Operation
 Getting a link up (manually)
      If no wireless networks exist yet, you can create one as follows.
       This will create a network called WIRELESS that others can then
       associate with.
        • iwconfig ath0 essid WIRELESS channel 6 mode Ad-Hoc
      If there already exists a network that you wish to join, then you can
       associate with that access point. You should know what the ip
       addressing scheme is so that you can give yourself an address that
       does not conflict.
        • iwconfig ath0 essid AP_NAME channel 1 mode Ad-Hoc
      If everything is in order, then you should have connectivity and
       should be able to ping the other host. If not, check the output of
       iwconfig to see if the ssid is the proper MAC address of the other
       host. If something goes wrong, bring the interface down and back
       up again. Also make sure that the ip addressing makes sense. Then
       try again.
      You can also try setting commands individually and see how the
       results if iwconfig output match up. For example, just set the mode
       to Ad-hoc.


                                                               Introduction   1-10
Setup and Operation
 Tweaking the link for optimum performance
    With the link up, you can now use iwlist to check your signal
     strength. You can watch how the signal strength changes as
     you adjust the position of the antenna.
        • iwlist ath0 ap | grep 00:11:22:33:44:55
      Make sure that the distance is set to a good setting. If it is
       set too high, you will be waiting too long uneccesarily, and it is
       too short, you will be congesting the link with retransmits.
      Check the number of other accesspoints on the same channel.
       If there are too many other nodes, try selecting a different
       channel, to avoid overlapping signals. A good rule of thumb is
       to use channel 1, 6, or 11.
        • iwlist ath0 ap
      To get the best performance in a 802.11g network, set the
       bitrate explicitly to 54Mbps.
        • iwconfig ath0 rate 54M



                                                           Introduction   1-11
Setup and Operation
 Generating traffic on the link
    To generate traffic for observation we us a tool called iperf.
     iperf uses a client/server model, so one host will run the
     server and the other host will connect with the iperf client
     and send lots of data as fast as possible.
        • iperf –s to run the server using TCP.
        • iperf –s –u to run the server using UDP.
        • iperf –c 192.168.1.1 to send the default ammount of data for a
          TCP connection.
        • iperf –c 192.168.1.1 –u to send the default ammount of data for
          a UDP connection.
      There are lots of other settings for iperf. You can adjust
       the ammount of data, the period of time that data is sent,
       you can optimize for the bandwidth of the link ect. Check out
       the manpage for more commands (man iperf)


                                                            Introduction   1-12
Setup and Operation
 Capturing traffic for analysis
    In order to capture the traffic on a link so that it can later
     be studied, we use a tool called tcpdump. We can use this to
     capture all the traffic we generated with iperf, and much
     more.
    Tcpdump captures packets and saves them in a file which can
     later be read by tcpdump, ethereal, or several other
     programs.
    Sample command to capture packets on the wireless interface
     and save them to a file called “packets.pcap” in the local
     directory.
        • tcpdump –i ath0 –w packets.pcap
      This will capture everything that the card sees, if you want to
       fine tune the capture, tcpdump has a lot of pattern matching
       options. See the manpage for more details (man tcpdump)


                                                        Introduction   1-13

								
To top