Page 1 of 5 123 ... LastLast
Results 1 to 10 of 41

Thread: Wireless Access Point

  1. #1
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Wireless Access Point

    I am trying to create a wireless access point, since my router keeps losing its settings. Eventually, the plan is to replace the router with my Linux Box. Anyway, I was trying to following the how to located here. But, now I can't even create the access point, whereas before I could create one, but just couldn't get WPA to work. During the setup I did hit one hickup while trying to start hostapd it failed.
    sudo /etc/init.d/hostapd restart
    Code:
     * Stopping advanced IEEE 802.11 management                              [ OK ] 
     * Starting advanced IEEE 802.11 management                              [fail]
    lspci | grep Network
    Code:
    04:06.0 Network controller: Atheros Communications Inc. AR922X Wireless Network Adapter (rev 01)
    ifconfig
    Code:
    eth0      Link encap:Ethernet  HWaddr 00:1f:e2:04:f3:a1  
              inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::21f:e2ff:fe04:f3a1/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:231436 errors:0 dropped:0 overruns:0 frame:0
              TX packets:170268 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:249093561 (249.0 MB)  TX bytes:45935995 (45.9 MB)
              Interrupt:17 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:101 errors:0 dropped:0 overruns:0 frame:0
              TX packets:101 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:10713 (10.7 KB)  TX bytes:10713 (10.7 KB)
    
    wlan0     Link encap:Ethernet  HWaddr 00:24:01:60:c9:0b  
              inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    iwconfig
    Code:
    lo        no wireless extensions.
    
    eth0      no wireless extensions.
    
    wlan0     IEEE 802.11bgn  ESSID:off/any  
              Mode:Managed  Access Point: Not-Associated   Tx-Power=27 dBm   
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Power Management:off
    Clearly, something is all screwy, but I don't know how to fix it. I am starting to think that I am just clueless, so I need some help setting this crap up.

    EDIT: Had some errors in my hostapd.conf file. I fixed them but still get the following
    sudo hostapd -B /etc/hostapd/hostapd.conf
    Code:
     
    Configuration file: /etc/hostapd/hostapd.conf
    wlan0: IEEE 802.11 Configured channel (60) not found from the channel list of current mode (1) IEEE 802.11g
    wlan0: IEEE 802.11 Hardware does not support configured channel
    Could not select hw_mode and channel. (-1)
    rmdir[ctrl_interface]: No such file or directory
    sudo /etc/init.d/hostapd restart
    Code:
     * Stopping advanced IEEE 802.11 management                              [ OK ] 
     * Starting advanced IEEE 802.11 management                                     rmdir[ctrl_interface]: No such file or directory
                                                                             [fail]
    Last edited by lvleph; May 21st, 2010 at 04:11 AM.

  2. #2
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    I got rid of the errors and hostapd loads, but I can't seem to find the connection. Here is my hostapd.conf
    Code:
    interface=wlan0
    driver=nl80211
    ssid=Testnet
    channel=1
    hw_mode=g
    auth_algs=1
    wpa=3
    wpa_passphrase=1234567890
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP CCMP
    rsn_pairwise=CCMP
    EDIT: Now I can see the wireless connection, but I can't seem to connect to it.

    EDIT2: Scratch that I can't see it anymore. Not sure what happened.

    EDIT3: Looks like I am back to this error
    Code:
    Configuration file: /etc/hostapd/hostapd.conf
    Failed to create interface mon.wlan0.
    nl80211 driver initialization failed.
    wlan0: Unable to setup interface.
    Last edited by lvleph; May 21st, 2010 at 04:29 AM.

  3. #3
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    I restarted the computer and now I can get hostap to start. However, I would like it to autostart, and I am not able to use the internet. Can someone help me out there?

  4. #4
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    Okay, now I have the internet through the wireless using
    Code:
    sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
    But, how do I make all this persistent?

    EDIT: I would also like to make the wireless available before log in. Although this is not a big deal since it only takes about 15 secs from grub to login.
    Last edited by lvleph; May 21st, 2010 at 05:41 AM.

  5. #5
    Join Date
    May 2010
    Location
    /tmp or /dev/null
    Beans
    163
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    You know what, I actually have a shell script that does just what you are trying to achieve- turn a target wireless card into an access point with a shared Internet connection! A .tar.gz file is attached to this post- extract it and you'll get a file called "ap_ctl." Move it to /usr/bin (or somewhere else). You will need to have hostapd and dhcp3-server installed.

    Anyway, to use the script, you'll have to open it up in a text editor and make some changes to suit your situation.

    1. Near the top of the script, you'll see the following lines:
      Code:
      # broadcasting interface
      BROADCAST="wlan1"
      
      # receiving interface broadcast is connected to
      RECEIVE="wlan0"
      Replace "wlan1" with your "broadcasting" wireless interface and "wlan0" with your "receiving" network interface (probably eth0 since you are going through Ethernet).
      .
    2. Next you'll have to set the IP address of your Linux box/router. Find the following two sections:
      Code:
       # set IP address
       ifconfig $BROADCAST 192.168.111.151
       sleep 2
      Code:
       # create iptables rules
       iptables -A FORWARD -i $RECEIVE -o $BROADCAST -s 192.168.111.151/24 -m conntrack --ctstate NEW -j ACCEPT
       iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
      ...and replace "192.168.111.151" with whatever you want that IP to be.
      .
    3. Configure /etc/hostapd/hostapd.conf and /etc/dhcp3/dhcpd.conf to your liking.
      .
    4. To start the access point, run:
      Code:
      ap_ctl --start
      ap_ctl --ics
      .
    5. You can add those two lines in /etc/rc.local to have them run at boot, usually just before login.

    And that's pretty much it! Everything else should pretty much take care of itself. Post back with any problems you may have.
    Attached Files Attached Files
    Last edited by purelinuxuser; May 21st, 2010 at 08:28 PM. Reason: Added some spacing between steps
    Running Ubuntu 10.04 on a Toshiba Satellite A505. You will not BELIEVE all the problems I have with it. But hey, that's all part of the fun! Even if fixing something does take hours...

  6. #6
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    Thank you very much. I will get this up and make sure I don't have any questions soon.

  7. #7
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    Okay, here the result of running
    sudo ./ap_ctl --start
    Code:
    Starting hostapd
    	You can view the log at /var/log/hostapd.log
    Starting dhcpd3
    Internet Systems Consortium DHCP Server V3.1.3
    Copyright 2004-2009 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/
    Wrote 0 leases to leases file.
    
    No subnet declaration for wlan0 (0.0.0.0).
    ** Ignoring requests on wlan0.  If this is not what
       you want, please write a subnet declaration
       in your dhcpd.conf file for the network segment
       to which interface wlan0 is attached. **
    
    
    Not configured to listen on any interfaces!
    Here is my edited ap_ctl
    Code:
    #!/bin/bash
    
    # broadcasting interface
    BROADCAST="wlan0"
    
    # receiving interface broadcast is connected to
    RECEIVE="eth0"
    
    if [[ $1 == "-0" || $1 == "--start" ]]
     then
     ## start hostapd
     echo "Starting hostapd"
     echo "	You can view the log at /var/log/hostapd.log"
    
     # launch hostapd daemon
     hostapd -d /etc/hostapd/hostapd.conf > /var/log/hostapd.log &
    
     ## start dhcp server
     echo "Starting dhcpd3"
    
     # set IP address
     ifconfig $BROADCAST 192.168.0.2
     sleep 2
    
     # launch dhcpd3 daemon
     echo "INTERFACES=$BROADCAST" > /etc/default/dhcp
     dhcpd3 $BROADCAST &
    
    elif [[ $1 == "-1" || $1 == "--stop" ]]
     then
     # send signal 2 to hostapd and dhcpd3
     killall -2 hostapd dhcpd3
    
    elif [[ $1 == "-2" || $1 == "--ics" ]]
     then
     # create iptables rules
     iptables -A FORWARD -i $RECEIVE -o $BROADCAST -s 192.168.0.2/24 -m conntrack --ctstate NEW -j ACCEPT
     iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
     iptables -A POSTROUTING -t nat -j MASQUERADE
    
     # set kernel variable(s)
     echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
    
     # edit kernel configuration
     cp /etc/sysctl.conf /etc/sysctl.conf.ap_ctl
     echo "net.ipv4.conf.default.forwarding=1" >> /etc/sysctl.conf
     echo "net.ipv4.conf.all.forwarding=1" >> /etc/sysctl.conf
    
     # restart networking
     /etc/init.d/networking restart
    
    elif [[ $1 == "-3" || $1 == "--noics" ]]
     then
     # remove iptables rules
     iptables -D FORWARD 1
     iptables -D FORWARD 1
    
     # set kernel variable(s)
     echo 0 > /proc/sys/net/ipv4/conf/all/forwarding
    
     # revert kernel configuration
     mv -i /etc/sysctl.conf.ap_ctl /etc/sysctl.conf
    
     # restart networking
     /etc/init.d/networking restart
    
    else
     echo $0
     echo "A tool to manage hostapd and dhcpd3"
     echo "Usage:"
     echo "	-0 --start	Start hostapd and dhcpd3"
     echo "	-1 --stop	Stop hostapd and dhcpd3 with signal 2"
     echo "	-2 --ics	Activate internet connection sharing"
     echo "			between specified interfaces"
     echo "	-3 --noics	Undo internet connection sharing settings"
    fi
    
    exit 0
    Here is my dhcpd.conf
    Code:
    ddns-update-style interim;
    ignore client-updates;
     
     subnet 192.168.0.0 netmask 255.255.255.0 {
      
       # The range of IP addresses the server
       # will issue to DHCP enabled PC clients
       # booting up on the network
      
       range 192.168.0.3 192.168.0.220;
      
       # Set the amount of time in seconds that
       # a client may keep the IP address
    
      default-lease-time 86400;
      max-lease-time 86400;
     
       # Set the default gateway to be used by
       # the PC clients
      
       option routers 192.168.0.2;
       # Don't forward DHCP requests from this
       # NIC interface to any other NIC
       # interfaces
     
        option ip-forwarding off;
     
        # Set the broadcast
    		# address and subnet mask
        # to be used by the
     		# DHCP clients
      
      option broadcast-address 192.168.0.255;
      option subnet-mask 255.255.255.0;
      
       # Set the NTP server to be used by the
       # DHCP clients
    
      option ntp-servers 192.168.0.100;
    
       # Set the DNS server to be used by the
       # DHCP clients
    
      option domain-name-servers 192.168.0.100;
     
       # If you specify a WINS server for your Windows clients,
       # you need to include the following option in the dhcpd.conf file:
    
       option netbios-name-servers 192.168.0.100;
      
       # You can also assign specific IP addresses based on the clients'
       # ethernet MAC address as follows (Host's name is "laser-printer":
    
     # host laser-printer {
     #     hardware ethernet 08:00:2b:4c:59:23;
     #    fixed-address 192.168.0.222;
     #   }
    }
    #
    # List an unused interface here
    #
    subnet 192.168.2.0 netmask 255.255.255.0
    {
    }

  8. #8
    Join Date
    May 2010
    Location
    /tmp or /dev/null
    Beans
    163
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    It looks like there is a problem with your dhcpd.conf. I have had to fiddle around with that thing to get everything working correctly- darn, I should have backed it up when I upgraded to 10.04.

    I'll try and see if I can get a sample config working. I'll post back when it works.
    Running Ubuntu 10.04 on a Toshiba Satellite A505. You will not BELIEVE all the problems I have with it. But hey, that's all part of the fun! Even if fixing something does take hours...

  9. #9
    Join Date
    May 2010
    Location
    /tmp or /dev/null
    Beans
    163
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    Ok, I've created a valid and working dhcpd.conf file and a client has been able to successfully associate and have an IP assigned. Here's my working config:
    Code:
    default-lease-time            600;
    max-lease-time                7200;
    
    option subnet-mask            255.255.255.0;
    option broadcast-address      192.168.111.255;
    option routers                192.168.111.151;
    option domain-name-servers    208.67.222.222, 208.67.220.220;
    
    subnet 192.168.111.0 netmask 255.255.255.0 {
        range 192.168.111.100 192.168.111.150;
        }
    Source: http://www.ubuntugeek.com/how-to-ins...tu-server.html

    Just adapt it to your preference. I suspect the problem with your file is the section in bold- you didn't specify an IP address range. That's just my guess though, don't think it's actually correct!
    Last edited by purelinuxuser; May 22nd, 2010 at 03:16 AM.
    Running Ubuntu 10.04 on a Toshiba Satellite A505. You will not BELIEVE all the problems I have with it. But hey, that's all part of the fun! Even if fixing something does take hours...

  10. #10
    Join Date
    Jul 2006
    Beans
    809
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Wireless Access Point

    Got the same error.

Page 1 of 5 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •