LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Wireless connection at logon (https://www.linuxquestions.org/questions/linux-newbie-8/wireless-connection-at-logon-4175534922/)

Adman49 02-24-2015 01:22 AM

Wireless connection at logon
 
I'm a Newbie and I'm wanting to know if it's possible to have a automatic script to connect to my home wireless connection after it has failed to locate an ethernet connection (and before logon).

If so, what details should be in the script and where should the script be placed?

Thank you for any assistance you may provide.

fatmac 02-24-2015 03:59 AM

Depends on your distro, but basically you need to set it up before you can connect to the internet. Look for an application, usually under network in your menu, to help you get it set up. You may also need some firmware to be able to use it.

Adman49 02-24-2015 01:07 PM

Thank you for your response.

My Bad. In the future I will start my message with my distro: Slackware Linux 14.1.

Hardware:

No name laptop with 8GB RAM,512GB SSD partitioned for Windows 7, two NTFS drives, one swap drive and Slackware drive with LILO boot screen.

Network Adapter: Realtek PCIe GBE Family Controller
Network Adapter: Atheros AR9002WB-1NG Wireless Network Adapter

The "Realtek PCIe GBE Family Controller" I presume to be the ethernet adapter and the "Atheros AR9002WB-1NG Wireless Network Adapter" would be the one that requires the script.

Now, I'm confused about whether I should modify "/etc/rc.d/rc.wireless", "/etc/rc.d/rc.wireless.conf", "/etc/rc.d/rc.inet1", "/etc/rc.d/rc.inet1.conf" or some other file...

allend 02-24-2015 05:33 PM

The use of "/etc/rc.d/rc.wireless"and "/etc/rc.d/rc.wireless.conf" is deprecated in Slackware 14.1.

You specify that you want to do this before login, which is a little unusual. Most people are happy to login and then set the network interface that they want to use using NetworkManager or wicd (or the command line equivalents nmcli or wicd-client).

To achieve your aim, I would add the configuration options for the wired and wireless interfaces to /rc/rc.inet1.conf and then edit /etc/rc.d/rc.M and specify the wired interface as the one that you want to start.
Code:

# Initialize the networking hardware.
if [ -x /etc/rc.d/rc.inet1 ]; then
  . /etc/rc.d/rc.inet1 eth0_start
fi

I would then add code to /etc/rc.d/rc.local to test if the wired interface was connected, and if not, then start the wireless interface. The following code is not tested, but should give you some ideas.
Code:

if ! ifconfig | grep -q eth0 ; then
  if [ -x /etc/rc.d/rc.inet1 ]; then
    . /etc/rc.d/rc.inet1 wlan0_start
  fi
fi


Adman49 02-25-2015 10:29 AM

Thank you for your response.

It appears to work but when I run Firefox, any website that I try to connect with just display the "whirling circle" in the tab...

I think I will abandon this road and be content with using the wicd-client.

allend 02-25-2015 05:20 PM

The "whirling circle" suggests that the browser is not able to resolve addresses. You may need to run 'dhcpcd' so that DNS resoulution is properly setup.
You should check the contents of /etc/resolv.conf.

Adman49 02-25-2015 06:20 PM

Thank you for your response.

I've already restored the script files to their original versions and trashed my edits. I would like to thank you for your time and effort but I think I will go with your suggestion: "NetworkManager or wicd (or the command line equivalents nmcli or wicd-client)."


All times are GMT -5. The time now is 12:43 AM.