Difference between revisions of "Access Point"

From LinuxMCE
Jump to: navigation, search
(/etc/network/interfaces)
Line 39: Line 39:
 
  $ sudo mv /etc/network/interfaces /etc/network/interfaces.bak
 
  $ sudo mv /etc/network/interfaces /etc/network/interfaces.bak
 
The interfaces file shown here is based on the setup described in the overview above.
 
The interfaces file shown here is based on the setup described in the overview above.
auto lo eth1 br0 eth0
+
<code>
# Loopback Interface
+
#####
iface lo inet loopback
+
# Loopback interface
# Internet Interface
+
#####
iface eth1 inet dhcp
+
iface lo inet loopback
# LAN Interface
+
 
iface eth0 inet manual
+
#####
up /sbin/ifconfig eth0 up
+
# xDSL PPPoE interface
down /sbin/ifconfig eth0 down
+
#####
# Wireless Interface
+
iface dsl-provider inet ppp
iface wlan0 inet manual
+
        pre-up   /sbin/ifconfig eth1 up
# Wireless/LAN Bridge
+
        up /etc/wide-dhcpv6/dhcp6c-ifupdown start
iface br0 inet static
+
        down /etc/wide-dhcpv6/dhcp6c-ifupdown stop
address 192.168.80.1
+
        provider dsl-provider
network 192.168.80.0
+
 
netmask 255.255.255.0
+
#####
broadcast 192.168.80.255
+
# IPv4 network interfaces
pre-up /usr/sbin/brctl addbr br0
+
#####
pre-up /usr/sbin/brctl addif br0 eth0
+
 
pre-up /usr/local/bin/hostapd -B /etc/hostapd/hostapd.conf
+
# --- External NIC ---
pre-up /usr/sbin/brctl addif br0 wlan0
+
 
        up /sbin/ifconfig br0 inet 192.168.80.1 broadcast 192.168.80.255 netmask 255.255.255.0
+
# --- Internal NIC ---
post-down /usr/sbin/brctl delif br0 eth0
+
iface eth0 inet manual
post-down /usr/sbin/brctl delif br0 wlan0
+
 
post-down /usr/sbin/brctl delbr br0
+
iface wlan0 inet manual
 +
 
 +
iface br0 inet static
 +
        post-up /usr/sbin/hostapd -B /etc/hostapd/hostapd.conf
 +
        post-up service isc-dhcp-server restart
 +
        bridge_ports eth0 wlan0
 +
        address 192.168.80.1
 +
        netmask 255.255.255.0
 +
          # DNS Settings for Internal Net
 +
        dns-nameservers 192.168.80.1
 +
        dns-search LinuxMCE
 +
 
 +
  #####
 +
  # Activating interfaces
 +
  #####
 +
  auto dsl-provider eth0 wlan0 br0 lo
 +
</code>
  
 
=== /etc/hostapd/hostapd.conf ===
 
=== /etc/hostapd/hostapd.conf ===

Revision as of 19:11, 16 March 2016

Version Status Date Updated Updated By
710 Unknown N/A N/A
810 relevant 20th Sept 2010 phenigma
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

Introduction

This tutorial describes how to add Access Point functionality to your LinuxMCE Core/Hybrid. The Core/Hybrid will then act as a WiFi access point permitting wireless devices to connect to the core, the internal network and the Internet. The drivers you choose will depend on your specific hardware. Setting up an Access Point on your core allows you to use wireless orbiters such as the WebDT 366 or Nokia N800/N900 without installing a separate wireless access point on your network.

Using nl80211 drivers (from back-ports)

Hardware

A lot of modern hardware works. Look up your device at http://wireless.kernel.org/en/users/Devices to determine which driver your card uses. The driver needs to support AP, you can check that the driver has this support at http://wireless.kernel.org/en/users/Drivers/. If the driver does not have AP support then you will not be able to operate the card as an Access Point.

Two Wireless-N adaptors that are known to work:

  • Atheros Communications Inc. AR928X Wireless Network Adaptor (PCI-Express) (rev 01)
    • This was pre-installed on a Zotac IONITX-A-U Atom N330 1.6 Ghz
    • Uses the ath9k driver
  • Atheros AR9280 MAC/BB Rev:2 AR5133 RF Rev:d0
    • This is a D-Link DWA-522 Extreme N PCI Adaptor
    • Uses the ath9k driver
  • LinuxMCE 0810 BETA - Snapshot DVD 25289
  • Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)
    • Uses the brcmsmac driver


Overview

  • -> eth0 connects to internal network LMCE
  • -> eth1 connects to the internet
  • -> wlan0 is the wireless card

Install required packages

Install hostap and the network bridge utilities.

$ sudo apt-get install bridge-utils hostapd

Config Files

/etc/network/interfaces

Make a backup of your original interfaces file:

$ sudo mv /etc/network/interfaces /etc/network/interfaces.bak

The interfaces file shown here is based on the setup described in the overview above.

  1. Loopback interface

iface lo inet loopback

  1. xDSL PPPoE interface

iface dsl-provider inet ppp

       pre-up    /sbin/ifconfig eth1 up
       up /etc/wide-dhcpv6/dhcp6c-ifupdown start
       down /etc/wide-dhcpv6/dhcp6c-ifupdown stop
       provider dsl-provider
  1. IPv4 network interfaces
  1. --- External NIC ---
  1. --- Internal NIC ---

iface eth0 inet manual

iface wlan0 inet manual

iface br0 inet static

        post-up /usr/sbin/hostapd -B /etc/hostapd/hostapd.conf
        post-up service isc-dhcp-server restart
        bridge_ports eth0 wlan0
        address 192.168.80.1
        netmask 255.255.255.0
         # DNS Settings for Internal Net
        dns-nameservers 192.168.80.1
        dns-search LinuxMCE
 #####
 # Activating interfaces
 #####
 auto dsl-provider eth0 wlan0 br0 lo

/etc/hostapd/hostapd.conf

Edit /etc/hostapd/hostapd.conf and verify/change the following:

interface=wlan0
driver=nl80211
ssid=yourssidhere
hw_mode=g
ieee80211n=1

/etc/default/dhcp3-server

Configure the dhcp server to respond to request from devices on the bridge instead of the wired connection alone.

$ echo 'INTERFACES="br0"' | sudo tee /etc/default/dhcp3-server

Security/Encryption

All security/encryption related settings are in /etc/hostapd/hostapd.conf. Edit this file as needed. A good starting point for a wpa & wpa2 enabled access point is:

macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=YourPassPhrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

(from: http://linuxwireless.org/en/users/Documentation/hostapd#Authentication_and_Encryption )

Restart Networking

Restart the networking engine, or reboot.

$ sudo service networking restart

or (in case the above didn't work)

$ /etc/init.d/networking restart

Using madwifi drivers

WORK IN PROGRESS

Hardware setup

  • Dell Optiplex Gx620
  • WiFi card with Atheros chipset (using madwifi drivers)
  • Linux MCE 810 alpha2

If you install LMCE from scratch make sure that your wifi card is NOT inserted prior to installation so that LMCE doesn't use it as the internal network interface. After LCME installation has finished, insert the wifi card.

Overview

the idea is to combine or bridge eth1 and ath0 to a new virtual interface called br0.

  • -> eth0 connects to my ADSL modem (192.168.1.0)
  • -> eth1 connects to my internal LAN switch (192.168.80.0)
  • -> ath0 connects the wireless part of my internal network (192.168.80.0)

Needed packages

  • hostapd
  • bridge


Config files

/etc/network/interfaces

We'll make a copy of /etc/network/interfaces in case something goes wrong before we edit it.

mv /etc/network/interfaces /etc/network/interfaces.bck
joe /etc/network/interfaces
auto lo eth0 eth1 br0

automatically initialise eth0 (external interface) eth1 (internal LAN) and br0 (our bridge interface). Keep ath0 out of this for now, we'll initialise it separately.

iface lo inet loopback
# Internet Interface
iface eth0 inet static
       address 192.168.1.2
       netmask 255.255.255.0
       gateway 192.168.1.1
       dns-nameservers 192.168.1.1

Fill in your own settings here, in my case 192.168.1.1 is the ADSL modem. Alternatively you can use dhcp to get the adress details from your ADSL modem.

# LAN interface
iface eth1 inet manual
  up /sbin/ifconfig eth0 up
  down /sbin/ifconfig eth0 down

The internal interface, note that it doesn't get an adress assigned.

# Wireless interface
auto ath0
iface ath0 inet manual
  up /sbin/ifconfig ath0 up

The wireless interface, again no adress details here.

iface br0 inet static
   address 192.168.80.1
   network 192.168.80.0
   netmask 255.255.255.0
   broadcast 192.168.80.255
   pre-up /usr/sbin/brctl addbr br0
   pre-up /usr/sbin/brctl addif br0 eth1

The fun part. Finally we assign the adress for the internal LAN to the bridge interace br0 (I'm sticking here with the standard LMCE network 80.0). The pre-up will create a bridge and add the eth1 interface to it.

   pre-up /sbin/wlanconfig ath0 destroy
   pre-up /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode ap
   pre-up /sbin/iwconfig ath0 channel 3

This part is necessary as the atheros interface has some issues to switch ino access point mode (master mode)

   pre-up /usr/sbin/brctl addif br0 ath0

After firing up the wireless interface we add it to the bridge as well.

   post-down /usr/sbin/brctl delif br0 eth1
   post-down /usr/sbin/brctl delif br0 ath0
   post-down /usr/sbin/brctl delbr br0

Just some lines to define how to cleanly shut down the bridge: remove both interfaces and then remove the bridge interace itself


We need to set the bridge (which contains eth1 and ath0) as the new interface for the dhcpd server. Edit /etc/default/dhcp.conf as followed:

   INTERFACES="br0"

/etc/default/dhcpd3/dhcpd.conf

wireless configuration

We'll use hostapd to manage the wireless part as it provides WPA encryption. I suggest that you first try to setup your network without encryption, make sure it works and then enable encryption.

Enable WPA encryption

  • edit the /etc/hostapd

Set static IP adresses

It is possible to set static ip adresses manually instead of using LMCE.