Re: Adding Wireless support to existing network

From: Peter Mueller (nnn79_at_gmx.NOSPAM.net)
Date: 05/31/04


Date: Mon, 31 May 2004 13:36:33 +0200


"Mike Gleason Jr Couturier" wrote:

> Can I assign IP 192.168.1.2 to the wireless adapter on my FreeBSD
> gateway and tell dnsmasq to serve (DHCP/DNS) on the wi0 interface too
> ? Then I would need to bridge for the wireless clients to be able to
> ping/access
> wired clients.. is that it ? I just want wireless client and wired
> client all act
> like if it was a wired only network...

Yes, you need bridging.

> I found tutorials on the net about creating an access point for
> wireless clients but not with hybrid configuration...
>
> I'm little confused ! Is there someone patient enough to explain me
> what I sould do / look for ?

What you want is already done by me (same wifi card and same FBSD
version) :-).

I created my script with the help of the great sites:
http://www.unixcircle.com/features/802.11b_freebsd.php
http://stevenfettig.com/mythoughts/archives/000072.php

You can generate your not-so-easy-to-crack ESSID with:

  # openssl rand 16 | hexdump -e '"%02x"'

And your four not-so-easy-to-crack wep keys with:

  # openssl rand 13 | hexdump -e '"%02x"'

If you want to try the script for testing purposes first without
encryption, set "WLAN_WEP_ENABLED=0" in the script.

This is my working hostap start script:

#!/bin/sh
#
#
# ----------------------------------------
# /usr/local/etc/rc.d/host_ap.sh
# ----------------------------------------

# ----------------------------------------
# Configurations.
#
#
IFCONFIG="/sbin/ifconfig"
WICONTROL="/usr/sbin/wicontrol"
SYSCTL="/sbin/sysctl"
WLAN_INTERFACE=wi0
WLAN_MEDIA=DS/11Mbps
WLAN_MEDIAOPT=hostap
WLAN_MAC="00:09:5b:xx:xx:xx"
WLAN_ESSID=8dddddddddddeeeeeeeeeeefffff004
WLAN_WEP_KEY1=aaaaaaaaaaaaaaaaaaaaaaaaaa
WLAN_WEP_KEY2=bbbbbbbbbbbbbbbbbbbbbbbbbb
WLAN_WEP_KEY3=cccccccccccccccccccccccccc
WLAN_WEP_KEY4=dddddddddddddddddddddddddd
WLAN_WEP_ENABLED=1
WLAN_WEP_WHICH_KEY=1
WLAN_CHANNEL=11
WLAN_STATION_NAME="FreeBSD_WLAN"
ZERO_IP="0.0.0.0"

# --------------------
# Set the port type.
#
# (1=BSS, 3=ad-hoc, 6=Host AP)
#
# !!!!!! We need type "6"! !!!!!!
#
WLAN_STATION_TYPE=6

# --------------------
# Set the LAN interface.
#
LAN_INTERFACE=rl0

# ----------------------------------------
# The script.
#
case "$1" in

start)

   # ----------------------------------------
   # Configure the WLAN access point mode.
   #
   # GENERATING ESSID:
   #
   # # openssl rand 16 | hexdump -e '"%02x"'
   #
   # EXAMPLE:
   #
   # Configure the access point mode and call it my_wifi as
   # the network name (ssid):
   #
   # ifconfig wi0 inet up 0.0.0.0 ssid my_wifi media DS/11Mbps \
   # mediaopt hostap
   #
   # !!! The following "$IFCONFIG $WLAN_..." should be ONE LINE !!!
   #
   $IFCONFIG $WLAN_INTERFACE inet up $ZERO_IP ssid $WLAN_ESSID media \
   $WLAN_MEDIA mediaopt $WLAN_MEDIAOPT

   # ----------------------------------------
   # Setting the MAC.
   #
   #
   $WICONTROL $WLAN_INTERFACE -m $WLAN_MAC

   # ----------------------------------------
   # Define four 128-bit WEP keys.
   #
   # GERNERATING WEP-KEYS:
   #
   # # openssl rand 13 | hexdump -e '"%02x"'
   #
   #
   $WICONTROL $WLAN_INTERFACE -k 0x$WLAN_WEP_KEY1 -v 1
   $WICONTROL $WLAN_INTERFACE -k 0x$WLAN_WEP_KEY2 -v 2
   $WICONTROL $WLAN_INTERFACE -k 0x$WLAN_WEP_KEY3 -v 3
   $WICONTROL $WLAN_INTERFACE -k 0x$WLAN_WEP_KEY4 -v 4

   # ----------------------------------------
   # Turn on WLAN Wired Equivalent Privacy (WEP).
   #
   #
   $WICONTROL $WLAN_INTERFACE -e $WLAN_WEP_ENABLED

   # ----------------------------------------
   # Specify WEP key to be used to encrypt transmitted packets:
   #
   #
   $WICONTROL $WLAN_INTERFACE -T $WLAN_WEP_WHICH_KEY

   # ----------------------------------------
   # Choose the used WLAN Channel.
   #
   # (Non-overlapping channels are: 1,6,11)
   #
   #
   $WICONTROL $WLAN_INTERFACE -f $WLAN_CHANNEL

   # ----------------------------------------
   # Define WLAN station name.
   #
   #
   $WICONTROL $WLAN_INTERFACE -s $WLAN_STATION_NAME

   # ----------------------------------------
   # Using Infrastructur mode (BSS mode).
   #
   #
   $WICONTROL $WLAN_INTERFACE -p $WLAN_STATION_TYPE

   # ----------------------------------------
   # Bridge WLAN to ethernet world.
   #
   #
   $SYSCTL net.link.ether.bridge=1
   $SYSCTL net.link.ether.bridge_cfg="$WLAN_INTERFACE $LAN_INTERFACE"
   $SYSCTL net.link.ether.bridge_ipfw=1
   echo ' WLAN: Started. '
   ;;

stop)

   # ----------------------------------------
   # Disable the WLAN access point mode.
   #
   $SYSCTL net.link.ether.bridge=0
   $SYSCTL net.link.ether.bridge_cfg=""
   $SYSCTL net.link.ether.bridge_ipfw=0
   $IFCONFIG $WLAN_INTERFACE down
   echo ' WLAN: Stopped. '
   ;;

restart)

   $0 stop
   $0 start
   ;;

*)

   echo ""
   echo "Usage: `basename $0` { start | stop | restart}"
   echo ""
   exit 64
   ;;

esac
# ----------------------------------------

AFTERWARDS:

  # chmod 0700 /usr/local/etc/rc.d/host_ap.sh

START:

  # /usr/local/etc/rc.d/host_ap.sh start

CHECK:

  # wicontrol

Okay, HTH.

>
> Thank a lot !
>
> Mike
>

-- 
greets
Peter
nnn79 __at__ gmx.net


Relevant Pages

  • Re: Netgear WGPS606 <-> Netgear WGT624
    ... * Put your WLAN with a unique SSID on one channel. ... Configure DHCP in the two wireless routers for different ... The wireless client bridge will properly bridge traffic back and ... forth between the two networks. ...
    (alt.internet.wireless)
  • Re: Adding Wireless support to existing network
    ... Mike ... > If you want to try the script for testing purposes first without ... > This is my working hostap start script: ... > # Configure the WLAN access point mode. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Small Network Setup with Debian Router
    ... wireless clients. ... allow only certain (DHCP per mac ... address assigned) IP's to access the LAN from the WLAN and let others ... exposing my wired file and print server for public access. ...
    (Debian-User)
  • Re: Wifi war driving / use of unprotected wifi networks
    ... Whenever my home WLAN crashes or loses its ISP connection, ... wireless clients in the house automatically connect to the nearest ... unprotected WLAN in a neighbour's house, ...
    (uk.legal)
  • Re: Ethernet Bridge - Confusion
    ... > An access point can typically be used as AP, client, or bridge (bridge ... > wireless card, bridge, or similar AP (in client or bridge mode). ... I too have a very similar problem: myself new to this WLAN ... LAN in the private address range. ...
    (comp.os.linux.networking)