Networking
 Basics
 Wireless
 Troubleshooting

Index
 Introduction
 Using OpenBSD
 The Desktop
 Advanced Use
 Networking
 Administration
 Appendices

Complaints?
complain > /dev/null




 

Wireless

An Example

The following is an example, understand that the ips, the ranges, channel, nwid, the domain and even the card itself don't matter, if you're having trouble, read a man page.

Say you want your Nintendo DS-lite to have a wireless connection to your router/firewall machine, that way you can make use of the Nintendo Wi-Fi Connection and play Diddy Kong Racing with all your buddies, so you plug a USB wireless card, in this case, the Nintendo Wi-Fi USB Connector, into the USB port and BAM! Instantly dmesg is updated with a new bit:

ural0 at uhub1 port 1
ural0: Nintendo Nintendo Wi-Fi USB Connector, rev 2.00/0.01, addr 2
ural0: MAC/BBP RT2571 (rev 0x05), RF RT2526, address 00:0d:0b:ed:84:fb


Why hello there friend! Let's just configure you up with a nice IP address, shall we? How about something simple, a /24, since we're working with private IPs it doesn't matter how many we waste in a block. In /etc/hostname.ural0 type:

inet 172.30.50.1 255.255.255.0 NONE

Now, that's a start, but a wireless nic needs more than just an IP, and a Nintendo DS needs some special bits, so we'll set the media type to what a DS likes, 802.11b DS 2Mbps, or DS2 and mode 11b. A DS will also want the card in HostAP mode, making it an Access Point, which requires we set the mediaopt to, you guessed it, hostap. Every good Access Point needs something to identify it, so we'll set it's network id to be ARK, and since there is a lot of noise in the lower end of the spectrum here, and Nintendo suggests it, we'll set our Access Point to channel 11. We end up with:

inet 172.30.50.1 255.255.255.0 NONE media DS2 mediaopt hostap mode 11b nwid ARK chan 11 -nwkey

Run sh /etc/netstart ural0 to have the shell script parse the config file and ifconfig then displays:

ural0: flags=8843 mtu 1500
        lladdr 00:0d:0b:ed:84:fb
        media: IEEE802.11 DS2 mode 11b hostap (autoselect mode 11b hostap)
        status: active
        ieee80211: nwid ARK chan 11 bssid 00:0d:0b:ed:84:fb 100dBm
        inet6 fe80::20d:bff:feed:84fb%ural0 prefixlen 64 scopeid 0x7
        inet 172.30.50.1 netmask 0xffffff00 broadcast 172.30.50.255


In order to get your new AP to hand out IPs, you then configure dhcpd via the /etc/dhcpd.conf and /etc/dhcpd.interfaces files, in this case setting the latter with ural0 and the former with the following:

shared-network LOCAL-NET {
        option domain-name "my-balls.com";
        option domain-name-servers 172.30.50.10;
        subnet 172.30.50.0 netmask 255.255.255.0 {
                option routers 172.30.50.1;
                range 172.30.50.2 172.30.50.6;
        }
}


Now, start her up! dhcpd should be running in the background just fine and giving IP addresses to any random person who tries to connect to your new access point. You'll note the range is between 2 and 6, this is because Nintendo advises only 5 DSes connected to it's Wi-Fi Connector, you could make it more if you wanted though.

Now, enter into your DS's WFC and set it up to use this new connection, set the SSID to be ARK, as we've done with the nwid. Leave Auto-obtain IP Address to yes and then everything will take care of itself.

Wait a second, any random person? That's not a good thing, is it now? We'll have to enable WEP and try to make it harder for strangers to take bandwidth you don't want to give away. Just change -nwkey to nwkey balls and reconfigure your Nintendo WFC settings to use the new key, "balls," and you're set.

Now, let's see what ifconfig -M ural0 says:

ural0: flags=8843 mtu 1500
        lladdr 00:0d:0b:ed:84:fb
        media: IEEE802.11 DS2 mode 11b hostap (autoselect mode 11b hostap)
        status: active
        ieee80211: nwid ARK chan 11 bssid 00:0d:0b:ed:84:fb nwkey balls 100dBm
                lladdr 00:17:ab:ae:21:d8 20dB 2M privacy,short_preamble assoc
        inet 172.30.50.1 netmask 0xffffff00 broadcast 172.30.50.255
        inet6 fe80::20d:bff:feed:84fb%ural0 prefixlen 64 scopeid 0xd


Hey! There's a DS now! arp -an:

? (172.30.50.2) at 00:17:ab:ae:21:d8 on ural0

Now, if we want all of this to happen each time we plug in our USB wireless card, there is a simple mechanism for it, hotplugd. First, we shall enable hotplugd to do the job, by editing the /etc/hotplug/attach file, this file has the controls for what you want done whenever any hot-swappable device is jacked, or removed. So, we look to the man page for hotplugd and observe it's example configuration, it explains that for a network card like this, we're looking to check to see if the first variable is a 3 or not, based on the example we create our file like so:

#!/bin/sh
DEVCLASS=$1
DEVNAME=$2
case $DEVCLASS in
   3)
      sh /etc/netstart $DEVNAME
   ;;
esac


We will also want to modify our /etc/hostname.ural0, adding !dhcpd to a newline after the nic's initial configuration options. That way, when hotplugd runs the configuration file for our Nintendo Wi-Fi USB Connector, it will also begin giving out IPs without any additional commands.

Then, to our /etc/rc.conf.local we add hotplugd_flags=, setting hotplugd to start at boot time.



This site and it's contents, however incomplete and poorly made, are copyright © 2005 - 2017 Nathan Montague and contributors. See the Appendix for details on licence and usage. This site is not affiliated with OpenBSD in any way, it is an unofficial reference which is available as an altruistic gesture. Server, bandwidth and assistance generously provided by Sirius Hosting.