# wireless network interface setup



## hydronium (Apr 28, 2009)

hi all,
I'm new to FreeBSD and I'm trying to setup the wireless internet connection. I think I have to use ndis as explained in the handbook:  "http://www.freebsd.org/doc/en/books/handbook/config-network-setup.html". Everything works fine, but when I #kldload the .ko file generated by ndisgen, nothing happens. Isn't the device meant to show up in dmesg? Or am I missing something?

Any help would be greatly appreciated.


----------



## LateNiteTV (Apr 28, 2009)

kldload is for loading kernel modules on the fly. if you do 

```
kldload whatever
```
then run dmesg, it wont show up because dmesg shows everything thats been loaded during boot. if  you add the module to /boot/loader.conf and reboot, it will show up in dmesg. if you want to make sure that module is loaded, run kldstat.


----------



## hydronium (Apr 28, 2009)

great, thanks...but is there a way to view the created device without rebooting? Because apparently that's what dmesg should have done, according to the link above...

ps kldstat does say it's there.


----------



## LateNiteTV (Apr 28, 2009)

what do you mean by "view the created device"?
if kldstat shows that its there, then its loaded and ready for use.


----------



## phoenix (Apr 28, 2009)

Messages from the driver that was loaded via kldload will show in dmesg output.  Not all drivers output messages when they are loaded, though.

What's the output of *ifconfig* after loading the driver?


----------



## hydronium (Apr 29, 2009)

ifconfig shows two devices: re0, the ethernet cable, and lo0, the loopback address (127.0.0.1). Nothing else ... perhaps the source .inf and .sys files are corrupt? But wouldn't that show up?


----------



## nikobordx (Apr 29, 2009)

Hi hydronium (H3O+)

Add this to your kernel configuration in "/usr/src/sys/i386/conf":

```
# ndis
options         NDISAPI
device          ndis
```

Which version of FreeBSD are you using ?
Which network card do you want to use ?

Nicolas.


----------



## hydronium (Apr 29, 2009)

hey nicolas,

I'm running FreeBSD 7.1 RELEASE.
Network card is the "Realtek RTL8187B Wireless 802.11b/g 54Mbps USB 2.0 Network Adapter".

I tried changing the configuration file and rebooting, but nothing changes. If I change it, must I do something else?


----------



## SirDice (Apr 29, 2009)

hydronium said:
			
		

> I tried changing the configuration file and rebooting, but nothing changes. If I change it, must I do something else?


Yes, you will have to recompile the kernel.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html


----------



## richardpl (Apr 29, 2009)

SirDice said:
			
		

> Yes, you will have to recompile the kernel.
> 
> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html



ndisulator works with generic kernel, there are ndis/ko and if_ndis.ko modules. So recompiling is not required at al.


----------



## richardpl (Apr 29, 2009)

hydronium said:
			
		

> hey nicolas,
> 
> I'm running FreeBSD 7.1 RELEASE.
> Network card is the "Realtek RTL8187B Wireless 802.11b/g 54Mbps USB 2.0 Network Adapter".
> ...



Ndisulator on < 8.0 doesnt support USB devices.


----------



## SirDice (Apr 29, 2009)

richardpl said:
			
		

> So recompiling is not required at al.


It does when someone tells the OP to change his kernel config


----------



## richardpl (Apr 29, 2009)

SirDice said:
			
		

> It does when someone tells the OP to change his kernel config



Someone dont know(or ignores fact) that LKM are available in FreeBSD


----------



## nikobordx (Apr 30, 2009)

Hi All,



> Ndisulator on < 8.0 doesnt support USB devices.


Are you sure ?
"man ndis" said it was possible, the manual is dated "october 2006"

For hydronium:
After editing the configuration file you must recompile the kernel, type: "make buildkernel" in "/usr/src"

You can take a look at this:

```
http://www.freebsd.org/cgi/query-pr.cgi?pr=126620
```

What say "dmesg" after loading module ?

Nicolas.


----------



## richardpl (Apr 30, 2009)

nikobordx said:
			
		

> Hi All,
> 
> 
> Are you sure ?
> "man ndis" said it was possible, the manual is dated "october 2006"



It is not implemented at all on < 8.0, please just look this file for evidence:
http://fxr.watson.org/fxr/source/compat/ndis/subr_usbd.c?v=FREEBSD7

Here is original message on CURRENT about implementation:
http://kerneltrap.org/mailarchive/freebsd-current/2008/7/24/2661454

Here is message about commit to 8.0:
http://www.mail-archive.com/freebsd-usb@freebsd.org/msg04099.html
http://lists.freebsd.org/pipermail/freebsd-current/2008-December/001475.html

Here is message about ndisulator being converted to new usb stack:

http://lists.freebsd.org/pipermail/svn-src-head/2009-March/004603.html


----------



## hydronium (Apr 30, 2009)

Update: I recompiled the kernel but it still doesn't work, unfortunately. Nothing shows up in dmesg.

The manual page for ndis also mentions 

```
device wlan
```
apart from 

```
options NDISAPI
device ndis
```
So I'm trying that. It's compiling right now. Either way, thanks for the help. I'll keep you updated.


----------



## DutchDaemon (May 1, 2009)

Did you actually install the kernel, not just recompile it? In other words, did you `$ make installkernel` after `$ make buildkernel`. Oh, and did you add the KERNCONF=yourkernel bit to those make targets if you didn't edit GENERIC? (which is unadvisable anyway, always use a separate kernel config file)


----------



## richardpl (May 1, 2009)

Oh, you forgot to add "device if_ndis" and also "device rtXXX" to your kernel 

On serious side, you will get nothing recompiling/reinstalling 7.1 kernel, but little practice never hurts.


----------



## hydronium (May 1, 2009)

yeah, I edited, built, and installed a separate "MYKERNEL". But the result is the same, instead of loading kernel modules it's just built in...perhaps the network card simply isn't supported. 
ps I don't think it's a USB device, it's built in, although it has "USB" in its name.


----------



## nikobordx (May 1, 2009)

Hi,



> I don't think it's a USB device, it's built in, although it has "USB" in its name.


Honestly i don't understand this !

What say (only for your card):

```
pciconf -lv
```

You can try FreeBSD 8-Current to view if it work.
Download here:

```
http://pub.allbsd.org/FreeBSD-snapshots/i386/8.0-HEAD-20090501-JPSNAP/cdrom/
```

Nico.


----------



## hydronium (May 1, 2009)

ehm, don't worry, I'm new to all this stuff, coming from an all-automatised windows world . It is a built-in USB device (I have a toshiba), and probably it's not supported. I'll have a look at FreeBSD 8. The only thing I find strange is that if it's not supported, why don't I get an error message when ndisgen is building the kernel module?


----------



## nikobordx (May 1, 2009)

Are you sure, you are using the good driver ?

If no download here:

```
http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=1&PFid=1&Level=6&Conn=5&DownTypeID=3&GetDown=false&Downloads=true#RTL8187B
```

Ndis usb is not supported in FreeBSD 7.1, so if you want i can build the driver for 8-Current, send you by mail, and you, you try the livefs and load the module to view if it work, easy no ??!! 

Nico.


----------



## richardpl (May 1, 2009)

Nice idea, (OP doesnt need to download 1G of source code).


----------



## SirDice (May 1, 2009)

hydronium said:
			
		

> The only thing I find strange is that if it's not supported, why don't I get an error message when ndisgen is building the kernel module?


Ndisgen is just a script that uses ndiscvt(8) to convert the windows driver to something the fbsd kernel can use. It doesn't do much else.


----------



## kamikaze (May 1, 2009)

When someone tells you to compile a new kernel, this really isn't (as has already been stated in this thread) necessary in 99% of the cases. Only some very old drivers and altq (load balancing for PF) require to be built into the kernel.

Apart from slightly speeding up the loader when booting, there's not even a performance gain from having stuff built into the kernel.


----------



## hydronium (May 1, 2009)

Nico, that would be great. I did try several drivers, this is one of them, and unfortunately, it didn't work. However, if you could build it on your FreeBSD 8, and send it by email, that would be excellent.


----------



## nikobordx (May 1, 2009)

it's done!

Please, keep us informed.

Nicolas.


----------

