The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Installing via wireless NIC 21 May 2001
Need more help on this topic? Click here
This article has 19 comments
Show me similar articles

If you have been paying attention and reading every one of my articles (which of course, everyone does, I have no doubt) you will recall that John Van Boxtel gave me a Compaq Presario 1620 laptop. This beast has an 814MB disk, 48MB of RAM, and three spare batteries. I've also been given two Lucent Orinoco wireless cards, one Gold, and one Silver. Over the weekend, I've managed to combine the two donations and get FreeBSD installed on the laptop using wireless. Also critical to this success is David Yeske who sent me an mfsroot.flp image which contained wicontrol. Without that, installing via wireless would not have worked for me. David plans to incorporate this into the install process for FreeBSD so that wireless installs are just another install option!

What I did

I installed a wireless NIC into my desktop, configured it to act as a gateway, enabled NAT, and used that as the gateway for my laptop. The laptop then communicated with the gateway using its own wireless NIC. Together, these two boxes allowed me to do an install on the laptop using wireless. This was after I'd failed using the laptop's CD, which I now know is broken.

This article will not go into detail concerning gateway creation, NAT, or the install process. There are other articles which cover this information and are more appropriate to those task. Please refer to the Topics for help in those areas.

Configuring the desktop

My boxes have hardcoded IP addresses. I'm not using DHCP. So I added the following entries to /etc/rc.conf on my desktop box:

pccard_enable="YES" # Set to YES if you want to configure PCCARD devices.
pccard_mem="0xd8000"
pccard_ifconfig="inet 10.0.0.2 netmask 255.255.255.0"

The entries on my laptop were created by the install process. I didn't have to create them. But I'll show you what they are in the Laptop Install section

The main things you must remember to do on the desktop is to configure it as a gateway and to enable NAT. Because my desktop box was already configured with ipfilter, all I had to do was this:

  • Tell the box it's a gateway by adding this to /etc/rc.conf:
    gateway_enable="YES"
    
    To invoke the gateway without rebooting, I issued this command:
    sysctl -w net.inet.ip.forwarding=1
    
  • Create the NAT rules. I added this to /etc/ipnat.conf [Note that rl0 is the external NIC. Addresses which reach it and are in the range 10.0.0.0/16 will be translated to 0.0.0.0/32 (which is whatever IP address is on rl0)]:
    map rl0 10.0.0.0/16 -> 0.0.0.0/32 portmap tcp/udp 40000:65000
    map rl0 10.0.0.0/16 -> 0.0.0.0/32
    
  • Enable NAT. I added these entries to /etc/rc.conf:
    ipfilter_enable="YES" # Set to YES to enable ipfilter functionality
    ipnat_enable="YES"    # Set to YES for ipnat; needs ipfilter, too!
    
    To invoke the NAT without rebooting, I issued this command:
    ipnat -f /etc/ipnat.conf
    
Creating Peer-to-Peer cards

The two wireless cards are Orinoco cards from Lucent Technologies. One is a Gold card, the other is a Silver card. The primary difference between the two is the level of encryption available. They just plug into a PCMCIA slot on your laptop or into an adaptor in your desktop. I was given both an ISA adaptor and a PCI adaptor. I have yet to get the PCI adaptor to work, but the ISA adaptor works fine. I hear work is underway to get the PCI adaptor working.

These cards appears as a wi device. And the key to getting the two wireless cards talking to each other is the port type. The cards (I'm going to start calling them NICs any moment now) can talk to either an access point or another card. In ad-hoc mode, any card to speak to any other card which is also in ad-hoc mode. In BSS mode, a card can only talk to an access point. Since I have only two cards and no access point, I'll be putting both cards into ad-hoc mode. The cards can be put into ad-hoc mode with the following command:

wicontrol -i wi0 -p 3

Please refer to man wicontrol for more detail.

/etc/pccard.conf

The following is from man pccard.conf:

The pccard.conf file is the configuration file for the pccardd(8) PC-CARD
slot management daemon.  It provides information to allow card identifi-
cation, and the matching of drivers (along with driver resources) to the
PC-CARD cards.
In short, it allows the card to be connected to a driver when the card is inserted into the laptop. The default values for the cards are located in /etc/defaults/pccard.conf. Here is the entry I've created in /etc/pccard.conf based on the defaults. I found this entry by searching for "Lucent WaveLAN" and picking the one which applied to device wi:
$ more /etc/pccard.conf
# Lucent WaveLAN/IEEE
card "Lucent Technologies" "WaveLAN/IEEE"
        config  0x1 "wi" 5
#       config  auto "wi" 11
        insert  /etc/pccard_ether $device start
        remove  /etc/pccard_ether $device stop

        insert  wicontrol -i $device -p 3

Note the last line. I added this line to force the device into ad-hoc mode. This command will be executed each time the card is inserted (or when the laptop is booted and the card is already inserted). Note that $device is a placeholder for the actual device name, in this case wi0.

If you are using DHCP, there is a better solution. The above will work with DHCP, but this following method is cleaner. Gregory Shapiro said:

The hook is to create /etc/dhclient-exit-hooks (chmod 0755) with:
# Initialize the WaveLAN card with the proper parameters
if [ "$interface" = "wi0" -a "$reason" = "PREINIT" ]
then
    /usr/sbin/wicontrol -i $interface -P 3
fi
exit 0
The laptop install

The main problem with the install now is that it doesn't use the PCCARD. You need to do something extra. Namely setup the card so it works. The existing install does attempt to use the card, but it doesn't go all the way. I managed, mostly by luck, to locate David Yeske who was planning to solve this very problem. I volunteered to test what he was working on.

A couple of days later, David sent me an email directing me to his website where I found a new mfsroot.flp image. This is used on the second of the two install disks. Within this image was included wicontrol, which is what I needed in order to get the laptop wireless card functioning. I just used David's version of the image for my install disks. You can find David's files in the sample files directory. They were created for 4.4-RELEASE.

Here's an overview of the install process. This should be enough to let you know how to proceed:

  • During the install process, right after probing devices, you will be asked:
    Found PC-card slots(s), Use PC-card device as installation media?
    I selected yes. Then I selected the default free-address area (0xd0009) and IRQ 3. The install then goes into initialization mode. The box beeps, and the light comes on the wireless card. To figure out what IRQ to use, I wrote the options on paper, then looked at the results of the probing. I pressed scroll lock and used page- up/page-down to look at the IRQs which were found. I crossed off any which I saw and then tried the ones which were unused. I used IRQ 3 which seemed to work fine.
  • When I get to the /stand/sysinstall Main Menu, I went to the Fixit menu item and I started the emergency holographic shell. Then ALT-F4 to get into it, then:
    wicontrol -i wi0 -p 3
    
    I get a solid green light on the laptop card Then I did:
    ifconfig wi0 10.0.0.10 netmask 255.255.255.0
    
    From my desktop with the wireless NIC, I tried a ping 10.0.0.10 to confirm that communication between the two wireless NICs was working:
    # ping 10.0.0.10
    PING 10.0.0.10 (10.0.0.10): 56 data bytes
    64 bytes from 10.0.0.10: icmp_seq=0 ttl=255 time=2.090 ms
    64 bytes from 10.0.0.10: icmp_seq=1 ttl=255 time=2.063 ms
    64 bytes from 10.0.0.10: icmp_seq=2 ttl=255 time=2.029 ms
    64 bytes from 10.0.0.10: icmp_seq=3 ttl=255 time=2.021 ms
    64 bytes from 10.0.0.10: icmp_seq=4 ttl=255 time=2.026 ms
    64 bytes from 10.0.0.10: icmp_seq=5 ttl=255 time=2.033 ms
    ^C
    --- 10.0.0.10 ping statistics ---
    6 packets transmitted, 6 packets received, 0% packet loss
    round-trip min/avg/max/stddev = 2.021/2.044/2.090/0.025 ms
    
  • I pressed ALT-F1 and went back to the install where I did a custom install.

After that, the install just worked.... It was great!

Here are the /etc/rc.conf entries from the laptop:

pccard_enable="YES"
pccard_ifconfig="inet 10.0.0.10  netmask 255.255.255.0"
pccard_mem="DEFAULT"
pccardd_flags=" -i 3"
thanks to...

I'd like to thank the following people:

  • Matthew Turany for providing the WaveLAN cards.
  • John Van Boxtel for providing the laptop.
  • David Yeske for the disk images containing wicontrol.
  • Jim Mock for suggesting wicontrol -i wd0 -p 3.
  • Gregory Shapiro for the /etc/pccard.conf tip.

Need more help on this topic? Click here
This article has 19 comments
Show me similar articles