I'm new to this forum but it looks like it's gonna be very helpful.
This semester at university I've studied UNIX and learnt a lot.
Even that way we never saw about wireless settings (cuz my teacher says we'll rarely use it to configure servers, thing I understand, but by now I can't be sitting by the router all day long ).

I have not found a full guide on the internet so I'm asking for help here.

I've used the following commands:

My wifi card is BWI0, whose firmware package I had to install. It does work (or I consider so) because the LED does lit when I ifconfig up.

#ifconfig bwi0 nwid obeid nwkey key

I also have a hostname.bwi0, but it contains the same thing as my wired connection (that does work). I have not found elsewhere what must I put in that file.

Reading ifconfig(8) and hostname.if(5) would be advisable, after you authenticate with your WEP network you would typically use dhclient to negotiate additional network settings like the IP address, routing information, and DNS servers.

I edited the hostname.bwi0 file accordingly and ran sh netstart.
It didn't work well. After the sh netstart I got a bwi0: no link ..... sleeping.

After that I typed dhclient bwi0 and got the same output.

Three thoughts.

The kernel will deposit what devices are identified into dmesg(8) output. Confirm that the chip found there exactly matches the information found in the bwi(4) manpage.

Assuming the chip is supported, simplify the environment by taking DHCP out of the picture. Assign a static IP address to the interface. More information can be found in hostname.if(5) & Section 6.2.1 of the FAQ.

The primary file used by bwi(8) is src/sys/dev/ic/bwi.c. This file has not changed since August 2010. You haven't mentioned which version of OpenBSD is being used, but OpenBSD 4.9 was tagged mid-February 2011. This suggests that installing -current will not show different functionality, but src/sys/dev/ic/bwi.c isn't the only file found in this driver either. Installing -currentmight show different behavior, but nothing can be said conclusively at this point.

Instead of /etc/hostname.ral0 name the file as follows /etc/hostname.bwi0.
Edit the file accordingly with the name of your network and nwkey. Reboot the damn thing
and you should have the wireless connection "protected by WEP".

By the way I have experience with bwi0 driver on my wife's DeLL laptop and works rock solid.

Do you think that if I switch to WPA encryption my problem could be solved?!

When having a problem like this, it's often useful to find the simplest possible setup which reproduces the problem.

With that in mind, I'd not go to more complex encryption, but get rid of encryption entirely. Try to see if you can get it to connect as an open network. If/when that succeeds you'll be sure the hardware is working and the driver and interface is properly configured, and you can try to layer on some encryption.

When having a problem like this, it's often useful to find the simplest possible setup which reproduces the problem.

With that in mind, I'd not go to more complex encryption, but get rid of encryption entirely. Try to see if you can get it to connect as an open network. If/when that succeeds you'll be sure the hardware is working and the driver and interface is properly configured, and you can try to layer on some encryption.

+1

Setting WPA (WPA2), WEP and unprotected wireless on any *BSD is trivial. Wireless can be protected on at least 5 additional ways on *BSDs some of which are not available on any other OS. You are getting some seriously good advices which you are ignoring. Short of you paying a BSD consultant who will actually configure your wireless network for you I do not think that anybody can help you here.

You are getting some seriously good advices which you are ignoring. Short of you paying a BSD consultant who will actually configure your wireless network for you I do not think that anybody can help you here.

I don't know if i get your comment, but if you suggest me dropping my network's encryption I can't.

If i drop encryption then I'd provide free internet for some of my neighbors and this would not be pleasant. Even if it would work that way I can't do it.

I don't know if I am doing something wrong, but if I am my point is to learn about it.

Secondly.... I'm not in the need of paying a consultant to do it for me. It's a school project of which I want to learn.

Most of this thread has followed the pattern of you asking for help, various people making suggestions, followed by you stating that you have either already tried this & it still doesn't work. If we were standing behind you, we could verify your actions. As it is with some in this thread nearly half a world away, we can only take your word. Little hard evidence has been presented.

At least twice you have been asked to test a simplified configuration. Even if this isn't what you ultimately want as a working solution, it may help illuminate the fundamental problem(s). Troubleshooting situations where n variables are at play may become obvious when the number can be reduced to n - 1, or n - 2. etc. Rarely does attempting to configure a sophisticated configuration work on first try. Especially if one isn't familiar with the software/hardware. This is one of the reasons I asked you to take DHCP out of the picture. Since you never mentioned this in subsequent responses, I have absolutely no idea whether you did or didn't.

You are invited to read an older thread on what information can & should be considered useful when seeking support over the Internet: