Team LiB
Previous Section Next Section

Hack 26. Dial Up Automatically on Startup

Save yourself from having to hand-connect to the Internet before surfing with Firefox.

This hack explains how to automatically dial up your ISP when Firefox starts. Disconnecting is more problematic. Attack that using timeout configuration items provided by the operating system. If you want Firefox to auto-dial for you, this preference must be left on:

network.autodial-helper.enabled   /* default = true */

3.6.1. Windows 95/98/98SE/ME

Dial-up technology under these Windows versions has a top layer called Dial Up Networking (DUN). To get this working without fail, make a copy of a Firefox desktop shortcut and change the copy. Change the specified firefox.exe program to run firefox.bat instead. Create that .bat file with these contents:

@echo off
start /B /MIN /W rundll32.exe rnaui.dll,RnaDial "connectoid"
firefox.exe

The string connectoid is the name of the connection icon in the Dial-Up Networking folder. It is case-sensitive. Do not use the name of a desktop shortcut that points to the connection icon. Change the name displayed on the new desktop icon to Firefox Internet or similar.

This fix always works, but there is an alternate way. Firefox has a FileWork Offline menu option. If Firefox is started in Offline mode, changing it to Online mode will instruct Firefox to always dial the ISP for you.

It is also possible to make Firefox dial the ISP if the first web page request (such as the home page) fails. In order for this to happen, extra Windows setup is required. In the Internet Options Control Panel item, in the Connections tab, choose any radio button other than the one labeled "Never dial a connection."

3.6.2. Windows NT/2000/XP

Top-level dial-up technology under these Windows versions is called Remote Access Services (RAS). It should be started automatically when any program, including Firefox, attempts to access the Internet. If that's not working for you, check that the RAS Connection Manager and RAS Auto Connection Manager services are enabled using the Services icon in the Control Panel. The rules are otherwise the same as under 95/98/98SE/Me.

If it still isn't working, make a copy of a Firefox desktop shortcut and change the copy. Change the specified firefox.exe program to firefox.bat. Create that .bat file with these contents:

@echo off
start /B /MIN /W rasdial.exe "connectoid"
firefox.exe

The string connectoid is the name of the connection icon, as described in the previous section. It is case-sensitive. Do not use the name of a desktop shortcut that points to the connection icon. To suppress the dialog that prompts for your ISP login details, try this instead:

@echo off
start /B /MIN /W rasdial.exe "connectoid" "username" "password"
firefox.exe

Beware: this saves your password as cleartext.


3.6.3. Mac OS X

Automatic PPP dial-up under OS X is handled through System Preferencesthe same as automatic Internet connection of all types. To set it up, choose System Preferences under the Apple menu and follow these steps:

  1. Click on the Network icon, in the Internet & Network group.

  2. From the Show pop-up menu near the top of the window, select your modem.

  3. Make sure the PPP tab is selected and click on the PPP Options... button near the bottom of the panel.

  4. Tick the first checkbox labeled "Connect automatically when needed."

  5. Click OK, and you're all set up.

3.6.4. Linux/Unix

To dial up before Firefox starts, just wrap the command-line call to Firefox in a shell script. Before you're ready to go, you must have the following things in place:

  • Modem hardware that's known (usually present; test with kudzu --probe)

  • Serial and PPP drivers in the kernel (usually present; test with modprobe -l)

  • Correct serial devices in /dev (usually present)

  • Software for PPP, such as pppd (usually present)

  • Software for DHCP, such as dhcpd (usually present)

For example, under Red Hat Fedora Core, much of the work is automated for you. Run this GUI tool and review the information in its help system:

/usr/bin/system-config-network

If no profile is defined for the modem, use the GUI to create one. In the DNS tab, clear all the DNS entries except for DNS Search Path. Enter the ISP's domain name here, making sure the IP address is also recorded, either in the /etc/hosts file or using the tool:

/usr/bin/system-config-bind

If dial-up access via DHCP has been started, Linux DHCP will usually overwrite the /etc/resolv.conf file, which can affect or ruin any existing DNS arrangements that you might have in place.

To configure and run dial-up by hand, configure dhcpd.conf to contain the ISP's DNS and IP Address information. Identify the tty in /dev that matches the modem, and simply run:

pppd /dev/modemtty
dhcpd

Those commands can go in the wrapper script that starts Firefox.

    Team LiB
    Previous Section Next Section