Newbies can script! Script to connect to the internet with WPA.

Assuming you have wpa_supplicant set up:
#!/bin/bash
# A simple script to ease your life.
echo First, please type in the name of your wireless adapter "(normally wlan0)".
read INTERFACE
echo Please enter what DHCP client you want to use "(dhcpcd or dhclient)"
echo Not sure? Type dhcpcd.
read CLIENT
echo Putting $INTERFACE up.
sleep 1s
echo "</--------->"
sleep 1s
ip link set $INTERFACE up
echo "<//-------->"
sleep 2s
echo "<///------->"
sleep 1s
echo Getting access via WPA.
sleep 1s
echo "<////------>"
wpa_supplicant -B -Dwext -i $INTERFACE -c /etc/wpa_supplicant.conf
echo "</////----->"
sleep 2s
echo "<//////---->"
sleep 1s
echo Obtaining a address.
if [[ "$CLIENT" == "dhcpcd" ]]
then
dhcpcd $INTERFACE
else
dhclient $INTERFACE
fi
sleep 1s
echo "<///////--->"
sleep 1s
sleep 2s
echo "<////////-->"
sleep 1s
echo "</////////->"
sleep 2s
echo "<//////////>"
ifconfig $INTERFACE
sleep 1s
echo If the ping works, this means the connection is succesful!
ping -c 5 www.google.com
sleep 1s
I know there is room for improvement, but I think that's pretty good for a user that used Arch ONE week and never scripted before.
No, I didn't copy this script from other sites.
So, what can I script next?
Last edited by VOT Productions (2011-10-22 11:33:06)

WPA Internet CONNECT! 1.1
It has now a ping feature after it's done, IP info, and it takes less time!
See what I meant by newbie?
By the way, it still does time a bit of time. The reason is because I want these extra few seconds for it to connect. Sometimes you might get an IP and not connect instantly.
Last edited by VOT Productions (2011-10-22 11:32:49)

Similar Messages

  • Can't connect to the internet with airport or firewire

    I can't seem to connect to the internet with airport or firewire. I recently restored my old G4 mac mini PPC 1.42 (with airport and bluetooth) Tiger 10.4.8 with a new harddrive. I have it connected to my leopard mac pro, internet sharing is on (both computers), the systems are connected, however, the mini just can't connect to the internet. tried it also using airport, no go. network diagnosis seems to go in a constant loop.

    works ok with ethernet connection though.
    that'll work.

  • Can no longer connect to the internet with the 580...

    Hi, my PC was able to connect to the internet with my 5800 via a USB cable.  Now, I can no longer connect to the internet with the 5800 via a USB cable. 
    I had never tried connecting the computer to the internet with the 5800 via Bluetooth prior to this incident, so I tried that.  Strangely, it works.  
    My question is how come I can no longer use the 5800 via USB as a modem, but how come the 5800 via Bluetooth still works as a working modem?
    Sorry, if my sentences are confusing.  I have a terrible headache at the moment.  While the Bluetooth connection works, I just feel better using the USB connection and knowing that my 5800 has a clean bill of health. 
    BTW, my PC is on Windows 7 Professional at the moment.  I've tried uninstalling the Ovi Suite and reinstalling it, but that didn't work.  I've also tried using PC suite instead of the Ovi Suite but that didn't work either.  What other options do I have, beside hard resetting the phone?  Thanks in advance.        
    Edit: BTW, the message shown when I tried to connect to the internet with the 5800 USB modem was "failed to establish a network connection". 
    Solved!
    Go to Solution.

    Hi,
    I am so  much tierd by trying to connect my phone to pc.
    I have nokia 5800,and I used to connect my phone to PC by USB cable.
    But from last 5 days I could not able to connect it.
    The problem is that,
    when I connect phone to pc,notification comes up that phone connected via ovi suit,but within  a minute or 2,
    "porable device" icon disappears from the task bar in the right hand corner,so connection could not proceed further.
    Please help me in this asap.
    I had tried following already:
    1.format my PC
    2.Installed new ovi suit
    now please give me a proper solution on that.
    thank you.

  • Can I connect to the internet with an Ipad in Santo Domingo, DR while I'm on vacation?

    Can I connect to the internet with an Ipad in Santo Domingo, DR while I'm on vacation?

    Lots of hotels in the DR have WiFi. And there is plenty of cellular coverage in Santo Domingo (and elsewhere).
    One thing to be careful of, the WiFi networks are usually not secured and are very vulnerable to people "listening" for passwords and user names, so don't do any financial transactions online and perhaps consider setting up some temporary passwords for the trip and changing them when you get home.
    -dan

  • Powerbook G4 can't seem to connect to the internet.

    My powerbook won't connect to the internet with a good airport connection.  Access to the internet with my other macs work fine on the same network (airport). Doesn't seem to work with the hard ethernet connection either.  Not sure what to do next?

    If you have a wireless signal but get a message about being unable to find the server, reset your PRAM and PMU.
    PRAM reset:
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    PMU:  http://support.apple.com/kb/HT1431
    PS. It's really best to open your own thread for your issue, so trying to solve multiple, albeit related, problems in one discussion thread doesn't get confusing.

  • WRT 120N- Cannot connect to the internet with more than one PC at a time.

    Before I went on a three month vacation,I could connect 3 or 4 PC's either wireless or wired to my router with no problems at all.I have a desk top and a laptop computer which I use at home.After I returned,I found that I could connect to the internet with only one PC at a time.
    If I was say,connected via my laptop,my desk top would continuously keep getting disconnected and vice versa.I have been reading the suggestions from experts here and have done a few checks based on them.I also cannot get to my router page which is 192.168.1.1 I keep getting a message that says "Problem Loading Page" and this happens with both,Firefox and Internet Explorer.I am running Windows 7 - 32 bit on my desk top and Vista Home Premium on my laptop.
    I have opened the "Command Prompt" dialogue and pinged 192.168.1.1 and thereafter I typed in "ipconfig".These are the results:
    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    C:\Users\Gordon>ping 192.168.1.1
    Pinging 192.168.1.1 with 32 bytes of data:
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Ping statistics for 192.168.1.1:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    C:\Users\Gordon>ipconfig
    Windows IP Configuration
    PPP adapter Brownwolf:
       Connection-specific DNS Suffix  . :
       IPv4 Address. . . . . . . . . . . : 92.98.42.65
       Subnet Mask . . . . . . . . . . . : 255.255.255.255
       Default Gateway . . . . . . . . . : 0.0.0.0
    Ethernet adapter Local Area Connection* 22:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Wireless LAN adapter Wireless Network Connection:
       Connection-specific DNS Suffix  . :
       IPv6 Address. . . . . . . . . . . : 2002:5c62:2a41:c:35a2:8753:8832:f494
       Site-local IPv6 Address . . . . . : fec0::c:35a2:8753:8832:f494%2
       IPv6 Address. . . . . . . . . . . : 2002:5661:4cc9:c:35a2:8753:8832:f494
       Temporary IPv6 Address. . . . . . : 2002:5661:4cc9:c:a408:59a3:918e:f0ab
       Temporary IPv6 Address. . . . . . : 2002:5c62:2a41:c:a408:59a3:918e:f0ab
       Link-local IPv6 Address . . . . . : fe80::35a2:8753:8832:f494%12
       IPv4 Address. . . . . . . . . . . : 192.168.0.1
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . :
    Ethernet adapter Local Area Connection:
       Connection-specific DNS Suffix  . :
       IPv6 Address. . . . . . . . . . . : 2002:5c62:2a41:c:413:cf4f:77af:474d
       Site-local IPv6 Address . . . . . : fec0::c:413:cf4f:77af:474d%1
       IPv6 Address. . . . . . . . . . . : 2002:5661:4cc9:c:413:cf4f:77af:474d
       Temporary IPv6 Address. . . . . . : 2002:5661:4cc9:c:1591:ad9:13da:8fea
       Temporary IPv6 Address. . . . . . : 2002:5c62:2a41:c:1591:ad9:13da:8fea
       Link-local IPv6 Address . . . . . : fe80::413:cf4f:77af:474d%11
       IPv4 Address. . . . . . . . . . . : 192.168.1.100
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : fe80::35a2:8753:8832:f494%11
                                           192.168.1.1
    Tunnel adapter Local Area Connection* 7:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 11:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 14:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 15:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 19:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 20:
       Connection-specific DNS Suffix  . :
       IPv6 Address. . . . . . . . . . . : 2002:5c62:2a41::5c62:2a41
       Default Gateway . . . . . . . . . : 2002:c058:6301::c058:6301
    Tunnel adapter Local Area Connection* 23:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 24:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    Tunnel adapter Local Area Connection* 28:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
    I presume that this model is a modem **bleep** router as I do not have a separate modem with my system.I have a DSL connection and the firmware version of my router is ver.1.0.If I recall,I did upgrade to the next firmware upgrade a few months after I purchased the router but I am not sure.
    I use both my PC's to run a small business venture and I am worried that resetting the router may cause some other problems and will stop me from using the internet.
    The Command Prompt information above was taken from my laptop.
    Any help will be really appreciated.
    Gerard.
    Solved!
    Go to Solution.

    brownwolf66 wrote:
    No,I have a desk top and a laptop and I cannot access 192.168.1.1 on either of them.In my OP,I have used the Command Prompt dialogue on both computers to ping 192.168.1.1 and I have attached the results.This is what I got:
    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    C:\Users\Gordon>ping 192.168.1.1
    Pinging 192.168.1.1 with 32 bytes of data:
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Reply from 192.168.1.1: bytes=32 time<1ms TTL=111
    Ping statistics for 192.168.1.1:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    The results I obtained using ipconfig in the command prompt have already been mentioned in my OP.
    I do not know if the above result is what it is supposed to be but I still cannot access my router's home page.How do I verify if there is a proxy server and if there is one,how do I disable it in my browsers?This problem occured suddenly as a few months earlier all was well.It's getting rather frustrating.
    I suggest resetting the router. Make sure firmware is updated. You can download it here - http://homesupport.cisco.com/en-us/support/routers/WRT120N. After firmware upgrade, reset and reconfigure. Just access the link below to guide you setting up the router.
    * Setting up a Linksys router for DSL Internet connection
    http://www6.nohold.net/Cisco2/ukp.aspx?vw=1&docid=20ee1457387f40178cd5f41d4b585db4_3687.xml&pid=80&r...
    * Setting up a Linksys router with Cable Internet service
    http://www6.nohold.net/Cisco2/ukp.aspx?vw=1&docid=0ff4c94586a345d082828ec2161aaecf_3686.xml&pid=80&r...

  • How do i connect to the internet with my ipad?

    how do i connect to the internet with my ipad?

    Did you turn WiFi on in the Settings App? If WiFi is turned on, your iPad should be able to see any WiFi networks that you can connect to and you should be able to tap on one of those, enter a password if needed and then tap the join button.
    I get the feeling that you know this and the problem needs further explanation so ... Can you explain in more detail?

  • My imac and ipad2 will not connect to the internet with Windstream using an 2wire DSL modem.

    Help my brand new imac and ipad2 will not connect to the internet with Windstream using an "2WIRE" DSL modem.  Windstream tech service is useless.  i can connect with the built in router through Ethernet or wireless, but still no connecting to internet, help!  windstream said everything is working on their end, yea right.  What i do know is that both the mac and ipad work at other places and can connect with wireless connected to the internet, so i know it's not the apple products. 
    these are brand new machines with lion.
    This is my first mac, so I’m still new to how it works, which is not helping either so a detailed help would be great.  Please help before my wife losses it
    thanks

    There is a 2701HG-B, and a 2701HG-D.  If not labelled on the modem, ask Windstream which one they presently supply or how to tell the difference.
    By the way tell your wife it isn't that bad.  At least you have an ethernet DSL modem.  There were times where DSL modems had RJ-11, USB, and Ethernet, and all three were used to provide access.  At least now only the craziest DSL providers still use those modems.

  • Unable to connect to the internet with my Fujitsu ...

    Ive just got a Home Hub 4 and have connected it to my laptop, a Fujitsu Esprimo V5535. But it is only giving me Local Only Access. Which means I cant connect to the internet. The Home Hub is working fine as my netbook and other mobile devices are all connected ok but my laptop isnt.... Is there anything I can do to resolve this?

    Did it connect to the Internet with your old homehub?
    Make sure the network card drivers on the laptop are up to date using the manufacturers website rather than Windows which can be out of date. You will need to connect by Ethernet cable to download them or download them on another device and copy them over.

  • No connection to the internet with MINI

    Hello from sunny Jerusalem.
    I got a problem - my IBook connects to the internet via ethernet jack from the router in the apartment next door .
    I had unplugged the IBook and plugged the same jack in the new MINI and there is no connection.
    http://discussions.apple.com/thread.jspa?threadID=578432&tstart=0
    all the advices lead me to beleive that i am an idiot !
    Posting this from work using my MINI which i had connected here.
    Any input anyone?
    be well and safe.
    MacMini DualCore 1,66 1G RAM 100G HD   Mac OS X (10.4.7)   Original Tangerine IBook G3 300Mhz ..OS9.2.2 and still kikkin..

    Since it works on the iBook, the check the network
    settings on the mini.
    System Preferences -- open Network -- check the
    settings on the Built in Ethernet Connection. You can
    compare it to the iBook. It should be configured to
    "Using DHCP".
    If it isn't a settings problem, and it works on the
    iBook, then you probably have a bad ethernet port on
    the mini.
    Hello from sunny Jerusalem !
    possibly ,sir,...you had not read the "posts" in full?
    here it is -
    Hello from sunny Jerusalem.
    I got a problem - my IBook connects to the internet via ethernet jack from the router in the apartment next door .
    I had unplugged the IBook and plugged the same jack in the new MINI and there is no connection.
    http://discussions.apple.com/thread.jspa?threadID=578432&tstart=0
    all the advices lead me to beleive that i am an idiot !
    Posting this from work using my MINI which i had connected here.
    Any input anyone?
    be well and safe.
    MacMini DualCore 1,66 1G RAM 100G HD Mac OS X (10.4.7) Original Tangerine IBook G3 300Mhz ..OS9.2.2 and still kikkin..
    Glenn Leblanc
    Posts: 218
    Registered: 09-Sep-2003
    New! Re: no connection to the internet with MINI
    Posted: 30-Jul-2006 07:58 in response to: gennady nogin Reply Email
    Since it works on the iBook, the check the network settings on the mini.
    System Preferences -- open Network -- check the settings on the Built in Ethernet Connection. You can compare it to the iBook. It should be configured to "Using DHCP".
    If it isn't a settings problem, and it works on the iBook, then you probably have a bad ethernet port on the mini.
    PowerMac G5 1.6 Mac OS X (10.4.6)
    You'd see that there i stated that i had taken the MINI to work and had internet connection there as well, which proves that the ethernet port is fine, also i had stated that the info from TCP/IP in the IBook i copied to the MINI's...
    but my poit is that i did not need to do anything at work with my MINI- just plug the ethernet and go !
    I shall go directly to the router when there is a chance.
    be safe and well.
    MacMini DualCore 1,66 1G RAM 100G HD   Mac OS X (10.4.7)   Original Tangerine IBook G3 300Mhz ..OS9.2.2 and still kikkin..

  • How do I connect to the internet with my new IPAD ?

    How do I connect to the internet with myt new Ipad

    See here for connecting to the Internet:
    http://support.apple.com/kb/HT1695
    If you have any problems there is troubleshooting advice here: http://www.apple.com/support/ipad/wifi/

  • How do i connect to the internet with apple tv

    how do i connect to the internet with apple tv

    Ethernet cable from your router, or configure wifi in Settings.

  • Why is it that every time I try to connect to the Internet with my Mac the whole Wi-Fi system comes down and it's only when I turn on my Mac

    Every time I try to connect to the Internet my Mac always makes the Wi-Fi turned off and we have lots of iPads and iPhones and they are fine when we try to use them but as soon as I my Mac it doesn't work. When we have a PC try to connect to the Internet nothing happens but when I try to connect to the Internet with my Mac the Internet turns off

    See:
    * http://kb.mozillazine.org/Firefox_crashes
    * [[Firefox crashes]]

  • My ipod says the connection passcode for our internet is incorrect when the same passcode connects to the internet with our other electronic devices.

    my ipod has always been able to connect to the internet until this past month. i have the passcode for our internet written down but it says the passcode is incorrect. our other electronic devices work and connect to the internet with the same passcode. what should i do?

    Try the following:
    - Reset the iPOd. Nothing will be lost.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    - Reset network settings: Settings>General>Reset>Reset Network Settings
    - iPhone and iPod touch: Troubleshooting Wi-Fi networks and connections

  • Can't connect to the internet with my iPod touch 4th gen.

    So I have an iPod touch 4th gen. and have been able to get wifi from my computer with no problem but now it's not working. When I choose the network I've always used I see the 3 lines on top of the screen that show when it's connected to the internet but when I try to open iTunes, the App Store, etc. it says, "cannot connect to iTunes" or whatever it is that I'm trying to open.
    I'm so frustrated! I already restarted both my iPod & laptop, connected then disconnected the modem, and resetted the network settings but it still doesn't work.
    When i open troubleshoot problems, it says that the wireless network connection doesn't have a valid IP configuration, sorry if I'm too stupid but what's an IP configuration? How can I fix this?
    Please help me!

    Does the iPod connect to other networks?
    Do other devices now connect? ( I thin yo are say no. In that case you have a router problem.  Try powering off and then back on the router. Next try changing the security on the router. Test it with no security. The reset ther router. Last, get a new router.)
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on the router
    - Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    - Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

Maybe you are looking for

  • Bluetooth will not work with car stereo after IOS6

    I upgraded to ios6 and lost a number of Bluetooth  functions with Alpine car stereo  1. Can no longer control playback from head unit. 2. Track info no longer displayed on head unit. 3.  When head unit finds iPhone it no longer begins to play automat

  • Error in SAP Upgrade 4.6C to ECC 6.0 in CONFLICT_CHECK Phase

    Hi All, I am doing an SAP Upgrade frm SAP 4.6C SR2 to ECC 6.0 SR2. When it enters the CONFLICT_CHECK we are facing the following error. i am performing this on Production system. Your immediate help is highly appreciated. #---- MASKING file CONFLCHK.

  • Should iphone 4 receive messages when turned off and display them when switched back on

    should iphone 4 receive messages when turned off and display them when switched back on

  • Itunes screen too small

    ok i just got a new ipod nano and i downloaded the new software. when i connect it and it shows up to say register your ipod its too small to see and i can't see it say register now just register later on the left side. what should i do?

  • [ALBPM 6.0 WLS] Error when installing the Engine

    Encountered error when doing 'Install Engine EAR in the application Engine'. here's an extract of the exception in WLS: HTTP:101216]Servlet: "engineStartup" failed to preload on startup in Web application: "/albpmServices/eng60j2ee". fuego.directory.