Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Jul 2014, 17:09
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to configure wifi from the commandline
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 12 of 13 [181 Posts]   Goto page: Previous 1, 2, 3, ..., 10, 11, 12, 13 Next
Author Message
Semme

Joined: 07 Aug 2011
Posts: 3578
Location: World_Hub

PostPosted: Wed 06 Mar 2013, 16:32    Post subject:  

Yeah, it's gonna be someone else. Seems I've misplaced my ndiswrapper using card and have to bail- sorry.
Back to top
View user's profile Send private message 
JamesTheAwesomeDude


Joined: 29 Jan 2013
Posts: 99
Location: Classified

PostPosted: Thu 14 Mar 2013, 12:48    Post subject:  

Ibidem wrote:
JamesTheAwesomeDude wrote:
Okay, I can't figure out what to do:

Wi-Fi adapter, wlan0
Connecting to wireless router with WPA2 encryption
Using the carl9170usb driver
Static (custom) local IP
Custom DNS settings

What do I need to type? The stupid carl9170 driver is really crashy, and I hate having to make 40 clicks every 5 minutes to repair the internet, so I'm just gonna stick a script on the desktop labeled "Kick the Wi-Fi adapter" or something like that, that will auto-reconnect everything.

Something like this (UNTESTED! CAUTION! YOU PROBABLY WILL NEED TO DEBUG AND CHANGE THIS!):
Code:
#!/bin/sh
IF=wlan0
#You probably want to change these.
IP=10.0.0.100
GW=0.0.0.0
#DNS: saved in /etc/resolv.conf, which should be static.

#modalias is a not-really-readable hw-specific ID that identifies one module.
read MOD </sys/class/net/${IF}/../../modalias
export MOD IF IP
start(){
wpa_supplicant -Dwext -B -c /etc/wpa.conf -i $IF
#I'm guessing the IP needs to be set after the interface is up.
#Really, this should be called via an action script, instead of dhcp
sleep 5
ifconfig $IF $IP
route add default gw $GW dev $IF
}
reload(){
wpa_cli -i $IF terminate
ifconfig $IF down
#Disable hardware encryption. Known to be desirable for AR9170 chips:
# http://linuxwireless.org/en/users/Drivers/carl9170
modprobe -r $MOD && modprobe $MOD nohwcrypt=1
}
reload && start

This assumes that the WPA config is in /etc/wpa.conf (probably not true for you!)

Hmm, couldn't manage to debug that ^, but I wrote this from scratch (many thanks to the Arch Linux Wiki):
Code:
#!/bin/sh
killall wpa_supplicant
rfkill unblock 0
modprobe carl9170
rm /run/wpa_supplicant/wlan0
ip link set wlan0 up
wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
ip addr add 192.168.2.64/24 dev wlan0
ip route add default via 192.168.2.1

Gets everything connected in <2 seconds, much faster then "manually" clicking through all the GUI options. It can also reconnect when carl9170 dies (I do not like carl9170 one bit. >:()

Before you can use the handy-dandy script I made, you have to do this:
Code:
wpa_passphrase "Your_Wifi_SSID" "v3ry_g00d_p@$$phr@$3" >> /etc/wpa_supplicant.conf

_________________
Version 27. Dotpet. Click here.
(SFS available too!)

Back to top
View user's profile Send private message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Sun 31 Mar 2013, 09:19    Post subject:  

I vainly trying to configure a wireless connection.
Went through the entire post and tried a lot but it does not work!
Using the Simple Network setup I can manually establish a connection but not automatically by script!
How should be a simple script?

Greetings

Wolfgang
wlan-2.jpg
 Description   
 Filesize   25.71 KB
 Viewed   880 Time(s)

wlan-2.jpg

wlan-1.jpg
 Description   
 Filesize   32.57 KB
 Viewed   908 Time(s)

wlan-1.jpg

Back to top
View user's profile Send private message 
tempestuous

Joined: 10 Jun 2005
Posts: 5218
Location: Australia

PostPosted: Mon 01 Apr 2013, 01:17    Post subject:  

der-schutzhund wrote:
I vainly trying to configure a wireless connection.
Went through the entire post and tried a lot but it does not work!

It's not necessary to go through the entire post. The complete instructions are in the 11th post on the first page of this thread - "PART 2: WPA encryption."
http://www.murga-linux.com/puppy/viewtopic.php?p=159336#159336
Summary:
- first check your wifi router to see if it uses WPA or WPA2 encryption.
If WPA, use Geany to open /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf
If WPA2, use Geany to open /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf

Add your SSID ("3210 Phone WLAN SL") and Personal Security Key (0815A31F), and save.
Assuming WPA2, you can now run a script with this -
Code:
ifconfig wlan0 up
rm /var/run/wpa_supplicant/*
wpa_supplicant -i wlan0 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf -B
sleep 15
rm -f /var/lib/dhcpcd/*.info
rm -f /var/run/*.pid
dhcpcd -t 30 -h puppypc -d wlan0
Back to top
View user's profile Send private message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Mon 01 Apr 2013, 05:18    Post subject:  

Hi tempestuous,

thanks for the information! With these lines, it works!!!

When I work with the file /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf I had to remaster it.
Otherwise I have to make entries manually every time.
How can I set up the wireless without a remaster?

Can I enter the ssid and the Personal Security Key in the script? If so how?

Greetings

Wolfgang
Back to top
View user's profile Send private message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Wed 03 Apr 2013, 04:44    Post subject:  

Hi,

to make everything in a script I'm writing a new file /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf.

This all works very well!

Greetings

Wolfgang
Back to top
View user's profile Send private message 
tannaroo

Joined: 17 Feb 2013
Posts: 23

PostPosted: Wed 03 Apr 2013, 12:15    Post subject:  

hi all,

can anyway point me in the right direction to write a script so that I can connect via GPRS modem. I've done it manually but would like an automatic script that connects automatically on startup?

cheers
Back to top
View user's profile Send private message 
Antzus

Joined: 14 Apr 2013
Posts: 5

PostPosted: Sun 14 Apr 2013, 10:51    Post subject: Editing the wpa_supplicant file  

Hi all. I've used a LOT of information (as well as PET files, etc) from these fora but I've only just now created an account, because I wanted to share something I just found out.

I'm using an old 701 4G Surf Eee PC with its onboard Atheros wireless card, and Puppeee operating system installed. I've been trying all manner of things to connect to the WEP network here at my mum's place, which is shared by a couple of siblings on wifi as well as a couple of ethernet cables. I kept getting stuck somewhere at "WPA Status: Associating" without ever getting to the next step of a DHCP handshake.

After losing my sanity for about 24 hours I stumbled across this giant wpa_supplicant file, which is something of a complete list of what is possible to include: http://www.lsi.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf
and in there I found the answer to my problem - to the relevant SSID section I added the line :
Code:
auth_alg=SHARED

That one little line made a world of difference to the supplicant file, and to me not having to sit on the floor in the corner using a 1m ethernet cable. So for anyone in the same situation, don't go downloading drivers, blacklisting modules or anything else I've been wasting my mental health on, try that line in your wpa_supplicant file.
Back to top
View user's profile Send private message 
cthisbear

Joined: 29 Jan 2006
Posts: 3391
Location: Sydney Australia

PostPosted: Sun 14 Apr 2013, 21:41    Post subject:  

Antzus:

Thanks mate ....hope this helps others out....

Cheers....Chris.
Back to top
View user's profile Send private message 
redandwhitestripes

Joined: 02 Jan 2009
Posts: 111

PostPosted: Sun 21 Apr 2013, 01:37    Post subject:  

I posted about my bizarre connection problems on the broadcom thread here:
http://www.murga-linux.com/puppy/viewtopic.php?p=698767#698767

and it was suggested I post my pdiag readout. As it's hefty, which parts of it should I post.

I will also paste here a readout after I attempted to connect from the commandline though I doubt it helps, as it still couldn't see my SSID.

Code:

# wpa_supplicant -i wlan0 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf -dd
Initializing interface ‘wlan0' conf ‘/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf’ driver ‘wext’ ctrl_interface ‘N/A’ bridge ‘N/A’
Configuration file ‘/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf’ -> ‘/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf’
Reading configuration file ‘/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf’
ctrl_interface='/var/run/wpa_supplicant’
ap_scan=1
update_config=1
Line: 5 - start of a new network block
ssid - hexdump_ascii(len=8):
     5a 79 58 45 4c 6e 65 77                           ZyXELnew       
scan_ssid=1 (0x1)
PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED]
proto: 0x2
key_mgmt: 0x2
pairwise: 0x18
group: 0x18
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 0
   id=0 ssid='ZyXELnew’
SIOCGIWRANGE: WE(compiled)=22 WE(source)=19 enc_capa=0xf
  capabilities: key_mgmt 0xf enc 0xf flags 0x0
netlink: Operstate: linkmode=1, operstate=5
Own MAC address: 00:21:00:92:85:79
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=5 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_countermeasures
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
WPS: UUID based on MAC address - hexdump(len=16): 98 74 c7 1e 86 40 58 34 9a 19 c7 75 5b f7 d1 b5
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Using existing control interface directory.
Added interface wlan0
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface ‘wlan0' added
Wireless event: cmd=0x8b06 len=8
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface ‘wlan0' added
Wireless event: cmd=0x8b1a len=40
State: DISCONNECTED -> SCANNING
Scan SSID - hexdump_ascii(len=8):
     5a 79 58 45 4c 6e 65 77                           ZyXELnew       
Starting AP scan for specific SSID(s)
Scan requested (ret=0) - scan timeout 5 seconds
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface ‘wlan0' added
Wireless event: cmd=0x8c02 len=29
WEXT: Custom wireless event: ‘Conn NoNetworks 03 00‘
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
Scan timeout - try to get results
ioctl[SIOCGIWSCAN]: Invalid argument
Failed to get scan results
Failed to get scan results - try scanning again
Setting scan request: 1 sec 0 usec
Starting AP scan for wildcard SSID
Scan requested (ret=0) - scan timeout 5 seconds
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface ‘wlan0' added
Wireless event: cmd=0x8b19 len=8
Received 0 bytes of scan results (0 BSSes)
BSS: Start scan result update 1
New scan results available
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable network found
Back to top
View user's profile Send private message 
peebee


Joined: 21 Sep 2008
Posts: 1369
Location: Malvern, Worcs, UK

PostPosted: Sun 21 Apr 2013, 02:41    Post subject:  

redandwhitestripes wrote:
I posted about my bizarre connection problems on the broadcom thread here:
http://www.murga-linux.com/puppy/viewtopic.php?p=698767#698767

and it was suggested I post my pdiag readout. As it's hefty, which parts of it should I post.

I will also paste here a readout after I attempted to connect from the commandline though I doubt it helps, as it still couldn't see my SSID.


Hi there

The output from pdiag is a .tar.gz file that you then attach to your post.

I think the significant line above could be
Code:
ioctl[SIOCGIWSCAN]: Invalid argument
which may indicate that the correct firmware isn't present, but this would mean that it is the b43 driver that is being used.

Can you run the lsmod command - is b43 or wl shown as loaded?

There are 2 links to other (maybe more up to date) b43 firmware in the "Broadcom" thread just under BACKGROUND which you may wish to try loading.

Cheers
PeeBee

_________________
LxPup-14.03 = Puppy + LXDE
Back to top
View user's profile Send private message 
johnmichaelreed

Joined: 03 Jul 2013
Posts: 11

PostPosted: Fri 05 Jul 2013, 22:36    Post subject: Easiest way to connect to public wifi via terminal?
Subject description: I'm a student trying to learn unix command stuff. How do I connect to wifi from the terminal?
 

Hey. Sorry to be jumping into this thread without reading the proceeding posts, but this is all a little confusing to me.

As part of learning Unix, I decided to try and switch over as much as possible to the no GUI linux terminal. In class I routinely write programs as text files and send them to the school server via scp and ssh to complete my homework, but that requires that I connect to the wifi. And I only know how to connect to wifi when there's a GUI and I can just click on "connect" and pick a wireless network. All this stuff about scripts and long, multi-step processes is confusing me, but I'd really like to switch over to being totally free of the GUI to get more of a feel for the unix/linux terminal environment.

Can someone explain to me in as simple terms as possible which default puppy Linux Slacko 5.5 program I have to run and what I have to type in to connect to a public (in the sense that I do not need a password to connect, I only need to type in my student ID into the school homepage before I can browse) Wifi network?

Cuz right now auto-connection only seems to work for the no GUI boot when there's an Ethernet cord plugged in before boot.

Appreciated.
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 464
Location: State of Jefferson

PostPosted: Wed 10 Jul 2013, 23:52    Post subject: Re: Easiest way to connect to public wifi via terminal?
Subject description: I'm a student trying to learn unix command stuff. How do I connect to wifi from the terminal?
 

johnmichaelreed wrote:
Hey. Sorry to be jumping into this thread without reading the proceeding posts, but this is all a little confusing to me.

As part of learning Unix, I decided to try and switch over as much as possible to the no GUI linux terminal. In class I routinely write programs as text files and send them to the school server via scp and ssh to complete my homework, but that requires that I connect to the wifi. And I only know how to connect to wifi when there's a GUI and I can just click on "connect" and pick a wireless network. All this stuff about scripts and long, multi-step processes is confusing me, but I'd really like to switch over to being totally free of the GUI to get more of a feel for the unix/linux terminal environment.

Can someone explain to me in as simple terms as possible which default puppy Linux Slacko 5.5 program I have to run and what I have to type in to connect to a public (in the sense that I do not need a password to connect, I only need to type in my student ID into the school homepage before I can browse) Wifi network?

Cuz right now auto-connection only seems to work for the no GUI boot when there's an Ethernet cord plugged in before boot.

Appreciated.

A script is nothing more than a set of commands, with a little bit of logic thrown on top.
It's exactly the same language and interpreter that you use in the terminal. If you want to learn Unix, you will need to learn shell scripting eventually.

There are two tools you can use, wpa_supplicant/wpa_cli and iwconfig.
iwconfig is more basic but easier to learn. It's a one-time command though, so connections are likely to die.
wpa_supplicant is a daemon (long-running process that provides a system service; often started by boot scripts), which you need to configure and script.

The bare bones (iwconfig) is:
Code:
iwlist scanning #note the interface that has SSIDs reported
#I'll use wlan0 as the interface and SCHOOL as SSID/essid
#change as needed
iwconfig wlan0 essid SCHOOL
iwconfig wlan0 #check if you associated
dhcpcd -h `hostname` -d wlan0   #or udhcpc -h `hostname` -i wlan0


If you want to get it to autoconnect, my scripts here are probably the most basic guide you can find:
http://www.murga-linux.com/puppy/viewtopic.php?p=673363
(Look for a post by me that starts "FYI: Debian uses a trick with wpa_cli that lets you run the DHCP client at the right time, consistently. "; I can't get it to jump to the right post).
Yes, I have tested that method since then. It's what I'm using now.

For wpa_supplicant.conf, if you use wpa_supplicant...
Code:
ctrl_interface=DIR=/var/run/wpa_supplicant
update_config=1
network={
        ssid="any"
        key_mgmt=NONE
}


And then start a browser; if you want CLI only, you may need to install one.
I suggest looking at:
-Lynx: for text mode
-Links2: for text and fast-but-ugly graphics (including in the "framebuffer" and under X)
-elinks: for probably the best straight text mode you can get (including javascript).

w3m should not be used without reading the manual first.
Back to top
View user's profile Send private message 
James186282


Joined: 08 Sep 2009
Posts: 127
Location: Minnesota

PostPosted: Sat 24 Aug 2013, 20:20    Post subject: A curious boot up problem  

I wanted to give Precise a try and have a frugal installation that I boot with a CD. I've tried all 3 of the methods to get a connection to the router. I'm using the ndiswrapper with a wg311v3 driver. *Which has worked at one time.

Hovering my mouse over the wifi icon (In the Tray) it tell me
Active interfaces: none
If I
iwconfig
I get a nice "correct" display about wlan0 being connected to the ESSID that I wanted. So I gave ifconfig a try and
only info for lo
wlan0 and eth0 are not showing up at all.
I looked into a lot of .log files. The /var/log/messages may provide a clue.

on eth0: /var/log has some odd messages at the end
dhcpcd-run-hooks PREINIT runs a again NOCARRIER

It does the same routine for wlan0
then it eth0 suddenly get carrier aqcquired *Note no wired connection
it runs the run-hooks routine and Reason NOCARRIER and then tries waiting for eth and wlan0 to get a carrier. Wlan0 announces it has one
it runs the dhcpcd-run-hooks program reason CARRIER and its lost. Now it run the run-hooks routine reason NOCARRIER and it ends with wlan0
waiting for carrier.
The final line is auth.notice su: + none root:spot

ndiswrapper -i wg311v3.inf tells me its already installed *Which is correct
lspci | grep Marvell *looks ok it has the version etc.

So.... I typed in ifconfig wlan0 up *And it worked!? I suppose I could make a one line bash script saying ifconfig wlan0 up but its making me goofy not understanding why its not working after booting up?

I just rebooted again and did the ifconfig wlan0 up trick. It goes into a series of repeated wlan0 down then requesting ip for router5 I lost count but half a dozen times. Wow its like 2 or 3 minutes of this I get the IP: 10.0.0.36 Aquired (Splexed?)
While this goes on and on I checked out things with iwconfig and saw something I've never seen before. On the last line
Encryption Key:2344.1234.etc it ends with "Security mode :restricted"
After the message about obtaining an ip address everything seems to work. My head is spinning...

Any ideas? Or things to check out that I've missed?

The computer is nothing special. Its a Gateway with a 3Ghz Pent 4. There is 1 Gig of ram.

Thanks for any ideas.

_________________
Science is what we understand well enough to explain to a computer.
Art is everything else we do.
Donald Knuth
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 4108
Location: Earth

PostPosted: Sat 24 Aug 2013, 22:06    Post subject:  

In the last couple days several members have provided help with steps to get an interface running (wlan and eth).

This is very good information and guidances. I have use the command line steps in the past as well.

Questions
  • Doesn't Puppy already have some terminal scripts that can be invoked to do what is shared, herein? Maybe even some scripts which allow parms which carry out the functions automatically?
  • Are any of the current GUIs also command line with parm utilities such that they will run standalone without X or as a GUI in X? Are there explanations, or documents, or threads which outline the actions of these GUIs when run from the console?
I do realize that, both, the Puppy distros and their versions, as well as the GUI utility versions, themselves, can impact the responses to these questions. But, the issues that are asked may be being addressed as they are basic and generic.

Thanks in advance for any information or pointers to such.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 12 of 13 [181 Posts]   Goto page: Previous 1, 2, 3, ..., 10, 11, 12, 13 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1442s ][ Queries: 13 (0.0163s) ][ GZIP on ]