You are not logged in.

#1 2008-02-12 15:55:24

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

How can I connect to Wireless in terminal?

For example, I have a wifi network with essid "MWM", with key "1234567890", and I want to connect to it using an static IP:

IP: 192.168.1.5
MASK: 255.255.255.0
IP Gateway: 192.168.1.1

What commands I must use to connect to that wifi with the previous information? Only commands, i don't want to modify rc.conf.

Greetings


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#2 2008-02-12 16:11:32

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: How can I connect to Wireless in terminal?

Davigetto wrote:

For example, I have a wifi network with essid "MWM", with key "1234567890", and I want to connect to it using an static IP:

IP: 192.168.1.5
MASK: 255.255.255.0
IP Gateway: 192.168.1.1

What commands I must use to connect to that wifi with the previous information? Only commands, i don't want to modify rc.conf.

Greetings

If it is WEP, you could try:

iwconfig essid MWM key 1234567890
ifconfig <interface> 192.168.1.5 netmask 255.255.255.0 up
route add default gw 192.168.1.1

Offline

#3 2008-02-12 16:21:14

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: How can I connect to Wireless in terminal?

I assume that the wifi network is WPA encrypted.

1) Install wpa_supplicant (probably they are already inshttp://bbs.archlinux.org/post.php?tid=43818talled).
2) Generate a wpa_supplicant.conf for your network:

wpa_passphrase MWM 1234567890 > /etc/wpa_supplicant.conf

3) Run wpa_supplicant:

wpa_supplicant -B -i eth1 -Dwext -w

Obviously this is right if eth1 IS your wireless interface (you can identify it with iwlist scan) and if wext is the right driver (some wireless clients require a different wpa driver)
4) Run ifconfig

ifconfig eth1 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.0.255 up

5) Define the gateway

route add default gw 192.168.1.1

With the netcfg2 package you can automatize all this to a single command. Look in /etc/network.d/examples/ for details. You do not need to modify anything in /etc/rc.conf, it will be enough to do:

netcfg2 <nameoftheprofileyouhavecreated>

Last edited by patroclo7 (2008-02-12 16:36:01)


Mortuus in anima, curam gero cutis

Offline

#4 2008-02-12 16:33:46

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: How can I connect to Wireless in terminal?

Splendid, patroclo7. Excellent tip. I never used WPA, but I might try it now that you have simplified it so.
My example works for me with WEP.

Offline

#5 2008-02-12 16:35:14

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: How can I connect to Wireless in terminal?

Yes, your example was fine, but I have seen it only when I had already written mine; sorry for the duplication of effort.


Mortuus in anima, curam gero cutis

Offline

#6 2008-02-12 16:57:07

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: How can I connect to Wireless in terminal?

patroclo7 wrote:

Yes, your example was fine, but I have seen it only when I had already written mine; sorry for the duplication of effort.

No, no apology necessary. Thank you for the info. big_smile

Offline

Board footer

Powered by FluxBB