Chapter 2: Maximizing Knoppix Internet Tools


The Internet has been central to the growth of Linux — after all, Linus Torvalds could not have marshaled the enthusiasm and work of thousands of people all over the world without it. That's also true for Knoppix. Klaus Knopper is German, but people all over the globe have helped build Knoppix into the exciting, innovative product it is today. This chapter explores the many ways you can combine Knoppix and the Net.

Accessing the Internet

Before you use all the really cool Internet tools that are introduced in the second half of this chapter, you first have to get on the Internet. Most of the time, this isn't a problem: You just boot your computer with the Knoppix CD inserted, and at the end of the boot process, you're connected. Things grow complicated, however, if your hardware isn't recognized or you still can't access broadband.

Connecting via Your Modem

If you're still using dial-up to access the Net, don't despair — you can still use Knoppix. However, the same caveats applicable to modems used with any Linux distro apply to Knoppix: internal modems may or may not work (if it's a WinModem, probably not), external modems are more likely to work. If you're using a laptop, the built-in modem probably is a no-go, but a PCMCIA modem is most likely OK.

In other words, if Knoppix detects your modem, great. Things are looking good, and you should be able to get online. If Knoppix doesn't detect your modem, you have to decide how much time and energy you want to put into getting your modem to work. You can look around on the Knoppix forum, but don't expect very much, frankly. That's why I always keep spare PCI and PCMCIA modems around; I know they work with Linux, and especially Knoppix. Here's the hardware I rely on:

  • PCI: USRobotics 3CP5610

  • PCMCIA: USRobotics Megahertz XJ1560

To set up your modem, open the Knoppix menu and select Network/Internet /dev/modem Connection Setup. You'll be given five options: Serial, USB, IrDA, Bluetooth, and Winmodem. Choose Serial, USB, or Winmodem — whichever matches your hardware — and see whether Knoppix can get your modem working.

Let's assume that Knoppix recognizes your modem. (If it didn't, you'll have checked out PCI or PCMCIA modems and gotten one working yourself.) Now it's time to get connected.

First you have to set up your dial-up account. From the Knoppix menu, choose Network/Internet Modem Dialer. Once the Modem Dialer window opens, click Configure, which opens the KPPP Configuration window (yes, you're using KPPP, the KDE PPP tool), as shown in Figure 2-1.

image from book
Figure 2-1: Configuring your dial-up connection with KPPP

On the Modems tab, select your modem and click Edit. In the Modem window, select the Modem tab and click Query Modem. You should see a string of text go by indicating that Knoppix and KPPP have detected your modem and that it works. This is just an easy way to remove one big item from your troubleshooting list if you find that your modem isn't working.

Return to the Accounts tab and click New. The window that opens asks whether you want to use the Wizard or Manual Setup; if you live in the U.S., don't bother with the wizard, because there's nothing in it for you. Instead, just click the Manual Setup button, which opens the New Account window, shown in Figure 2-2.

image from book
Figure 2-2: Enter details about your dial-up account.

In the Connection Name field, enter something meaningful to you, such as Earthlink or Panix. Click Add to enter the phone number. Enter only the digits — no spaces, parentheses, or hyphens. That's probably all that you'll have to do in the entire window. If your ISP has given you other stuff to configure, go ahead and do it; otherwise, click OK to close the New Account window, and you're back at the KPPP Configuration window.

To try out your dial-up connection, click OK to close the KPPP Configuration window so you're back at the KPPP window. Enter a Login ID and Password, check Show Log Window so you can tell what the heck is going on (more troubleshooting help), and click Connect. If all is well, the sound of two modems communicating should fill the air, and you are connected eventually. Then you can start enjoying the Internet at 56 Kbps (or worse!) speeds.

Getting Broadband Working

The category of broadband includes DSL, cable, and even ISDN, the original broadband. No matter what you use, you really must have a router/firewall sitting between your network (even if it's only one computer) and the big bad Internet. Don't agonize over this issue: Routers are cheap nowadays (you can get a good Cable/DSL router for $35 or less at Amazon, for example), they're super easy to set up and use, and they do a good job protecting your network. Therefore, no excuses — get one, set it up, and use it.

You'll find that there's an additional benefit as well: virtually every SOHO router/firewall acts as a DHCP server (Dynamic Host Configuration Protocol — for more info, see http://en.wikipedia.org/wiki/DHCP), which means that booting a Knoppix machine on such a network is as smooth as silk. Basically, you start up the computer with the Knoppix disk inserted, allow Knoppix to do its automatic detection thing, and soon enough you're connected to the Internet. It's really, really easy.

If you're not using a router (please go buy a router) and you have a direct ISDN connection, then from the Knoppix menu select Network/Internet ISDN connection. Make the necessary configurations, and away you go.

If you're not using a router and you have DSL with PPPoE (please go buy a router), go to the Knoppix menu and choose Network/Internet ADSL/PPPOE configuration. Fill in the required data and you should be online. Your first stop will be some online store to buy a router, right?

Cruising Wirelessly

Wireless is wonderful when you can get it and it performs correctly, but it can sometimes be a pain to get it going. If you're using an 802.11b card, you'll probably have few problems because most B cards work with Knoppix. A laptop using Intel's Centrino technology, however, may or may not work even though it's based on 802.11b; it was only recently that Intel released the necessary info to open-source developers so they could get Centrino working with Linux. G cards are a different story. Few work natively in Linux at this time, although that's changing; in the meantime, you can try using the ndiswrapper software, which enables you to use Windows drivers to power your G cards under Linux. When ndiswrapper works, it's great; when it doesn't, forget it. Drop back to a B card if you can.

Tip 

Earlier I noted I always keep both PCI and PCMCIA modems around because I know they work with Linux. I do the same thing with 802.11b. My card of choice is the Lucent Orinoco Gold, which has worked beautifully for me for years. If you can pick one up on eBay, you really should — and the older the card you can get, the better, because wireless card manufacturers keep messing around with their cards' chipsets.

If Knoppix recognizes your card when you boot, you're in wireless heaven. By default, it uses DHCP to get an IP address and all the other needed data for accessing a network. The only hitch may be that the wireless network to which you're attempting to connect uses WEP or WPA to encrypt traffic. If so, you will not connect at first. Instead, from the Knoppix menu select Network/Internet Wavelan configuration.

A dialog box opens, informing you that you're about to change the parameters of your wireless card: eth0 or eth1, for instance. Click OK. If you want it to work with any wireless access point no matter what the ESSID is, just leave the ESSID text box blank; otherwise, enter the ESSID. Either way, click OK when you're ready to move on.

Next, you're asked for the NWID, or cell identifier. If you need to set the network ID, which helps separate logical networks, enter it, but most of the time you can just leave this blank and click OK.

Set the mode for your card. If you leave it blank, you're choosing Managed; otherwise, enter one of the other listed options (most likely Ad-Hoc if you're not using Managed). Here's what the different modes mean:

  • Managed: Also known as Infrastructure, in this mode a wireless access point (such as a SOHO wireless router, for example) is used to link a wireless network with a wired one.

  • Ad-Hoc: If you want to connect two or more wireless machines together without a central hub or switch, use this mode.

  • Master: Your machine is acting as an access point for other wireless devices.

  • Repeater: Your machine simply forwards wireless packets.

  • Secondary: Your machine is either a backup master or a backup repeater.

  • Auto: Knoppix makes the best choice it can determine, which most likely means Managed.

Make your choice — probably Managed or perhaps Ad-Hoc — and click OK.

Most of you should just leave the Channel Number box empty, which allows Knoppix to automatically select the one it detects. If you know that you're supposed to use a specific channel number — they range from 0 to 16 — go ahead and enter it. When this dialog is correct for your network, click OK.

It's best to leave the card frequency box blank, so that it's automatically entered for you, but if you really must enter something, make sure you enter the correct number:

  • 802.11a: 5.15-5.825 GHz, entered as 5.825G, for instance

  • 802.11b: 2.412-2.462 GHz (for the US; other countries vary), entered as 2.412G

  • 802.11g: 2.412-2.462 GHz (for the US; other countries vary), entered as 2.412G

Note 

To learn more about the exact frequencies your hardware supports, read your vendor's product detail pages, available on the company's Website or included with your wireless card.

Click OK. The next dialog asks for the encryption key — the WEP (Wired Equivalent Privacy) key. If your access point isn't using WEP, leave the box empty; otherwise, enter the 64-bit or 128-bit key. Click OK.

Enter any additional parameters for your wireless card, if you need any (you probably won't have any). Click OK.

Tip 

All of these dialog boxes are constructing options for the iwconfig command, so if you know that command well, you can skip the entire configuration process and just use the command line, with sudo.

You're almost finished. The next dialog asks for any additional parameters for iwspy, which helps gather wireless statistics. Leave it empty (unless you really know what you're doing) and click OK. Then you're asked whether you have any additional parameters for iwpriv, which is for settings specific to your particular wireless card driver. Again, leave the text box empty, and click OK. The dialog box closes, you see several settings flash by in the open terminal window, and then — bam! — that window closes, and your wireless card should be working.

Tip 

If you ever have problems with a working wireless card, make sure your wired connection isn't currently on (run sudo ifconfig to see your list of connections). If it is, take down the wired connection (let's say it's eth1) with this command: sudo ifconfig eth1 down.

If you have a G card and you have to use ndiswrapper, you have another adventure ahead of you. ndiswrapper is undeniably cool, but it can be a bear to set up.

Note 

For the details about ndiswrapper, check out the project's home page at http://ndiswrapper.sourceforge.net. Even more useful is the project's wiki, at http://ndiswrapper.sourceforge.net/phpwiki/index.php/.

Open the Knoppix menu and select Network/Internet ndiswrapper configuration. The dialog warns you that you're going to need the .inf and .sys files for your G card's drivers. That is where the fun often begins. If you still have the CD with the original drivers, you're probably not going to tear your hair out. If you don't have that CD, get the necessary driver from the vendor's Website, put it on a USB flash drive or burn it onto a CD, and mount the device onto your Knoppix box. If you can't find the driver, head to the ndiswrapper project's Web page that lists supported cards and drivers (http://ndiswrapper.sourceforge.net/phpwiki/index.php/List) to try to find the one you need.

The ndiswrapper configuration script walks you through the process. You locate your .inf and .sys files, and set up those drivers. Unfortunately, you must now configure your wireless card by hand, not that it's a big deal. Here's how:

  1. Enter the following on the command line:

     $ sudo iwconfig 

    That verifies that your system recognizes that it has a working wireless NIC.

  2. Ensure that your card sees an access point by running the following:

     $ sudo iwlist eth0 scan 

    The results of this command tell you that your card is working and can interact with your local access point.

  3. Assuming that Knoppix saw a wireless card at eth0, the following key commands can be used:

    • $ sudo iwconfig eth0 essid essidname: Sets your ESSID. Change essidname to the actual name you need to use. To connect to any ESSID, use any for essidname.

    • $ sudo iwconfig eth0 mode modetype: Sets your mode. Substitute modetype with Managed, Ad-Hoc, and so on.

    • $ sudo iwconfig eth0 key restricted wepkey: Sets your WEP encryption key. Replace wepkey with the actual key.

You can, of course, combine all of these on one line, as follows:

 $ sudo iwconfig eth0 essid home mode Managed key restricted 1234-1234-1234-1234 

In the end, it all comes down to your time and your circumstances. If you can use a B card that you know works with Knoppix, use it. If you have to use a G card, make sure you have the drivers handy. Finally, practice using ndiswrapper before you find yourself under the gun. ndiswrapper is just a bit tricky, and it would be better for you to have some experience configuring it before you're trying to recover data on a machine that's crashed.

Tip 

Knoppix also supports the use of cell phones and even Bluetooth devices for wireless Internet access. If you keep your expectations low, you may just be surprised and happy when it works. To set up your device as a modem, open the Knoppix menu and select Network/Internet /dev/modem connection setup, and make the necessary choice. After that, use KNOPPIX Network/Internet GPRS connection.

Setting a Static Address

DHCP (Dynamic Host Configuration Protocol) is a great technology, and it certainly makes the lives of network admins a lot easier (and, yes, you too are a network admin if you have a home network, even of just two computers, and you manage them), but a dynamic address is not always desirable. For example, what if you're trying to use your Knoppix machine as a server? In cases like that, dynamic addresses are a nuisance, and a static IP address is needed. It isn't hard to set up Knoppix to use a static IP address.

To begin, you need to know what your system is using currently, so enter the following simple, yet incredibly informative, command:

 $ ifconfig 

Here are example results from a laptop using a wireless 802.11b card, and you'll probably see something similar:

 eth0 Link encap:Ethernet HWaddr 00:02:2D:2B:E7:34  inet addr:192.168.1.5 Bcast:255.255.255.255 Mask:255.255.255.0  inet6 addr: fe80::202:2dff:fe2b:e734/64 Scope:Link  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1  RX packets:20209 errors:53 dropped:53 overruns:0 frame:53  TX packets:15684 errors:12 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:1000  RX bytes:18936569 (18.0 MiB) TX bytes:3570323 (3.4 MiB)  Interrupt:3 Base address:0x100 lo Link encap:Local Loopback  inet addr:127.0.0.1 Mask:255.0.0.0  inet6 addr: ::1/128 Scope:Host  UP LOOPBACK RUNNING MTU:16436 Metric:1  RX packets:86 errors:0 dropped:0 overruns:0 frame:0  TX packets:86 errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:0  RX bytes:5314 (5.1 KiB) TX bytes:5314 (5.1 KiB) 

This tells you that the network's DHCP server assigned eth0, the wireless card, the IP address of 192.168.1.5. Before changing the IP to a static address, you first have to make sure that the address isn't in the DHCP pool of assignable addresses, and that requires a question to the network admin. In this example, the DHCP pool ranges from 192.168.1.2 to 192.168.1.50, so anything greater than .50 and less than .255 should be safe. To change the card's IP to a statically assigned address, you'd run the following command:

 $ sudo ifconfig eth0 inet 192.168.1.100 

Use the same command to change the network mask or broadcast address. Here's an example:

 $ sudo ifconfig eth0 netmask 255.255.255.0 broadcast 192.168.1.255 

Note 

Yes, you can also hardcode your IP address and other data by opening the Knoppix menu and selecting Network/Internet Network Card Configuration, but it's faster to just use the command line, and it doesn't hurt to know what the Knoppix config dialog is really doing behind the scenes.

That should get you on the network, but you may not be able to get to http://www.google.com or your email server. Why not? DNS (Domain Name Server). To configure DNS, you need to edit /etc/resolv.conf. As root, open /etc/resolv.conf with your favorite text editor and add any required DNS addresses. For instance, here's what my resolv.conf file looks like when I'm teaching at Washington University in St. Louis:

 search artsci.wustl.edu nameserver 128.252.120.1 nameserver 128.252.135.4 

The search line isn't really that important, but you need at least one nameserver line, or DNS won't work for you. Ask your network admin what you're supposed to use, and you'll be up and running in no time.



Hacking Knoppix
Hacking Knoppix (ExtremeTech)
ISBN: 0764597841
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net