Setting Up Network Manually On Xandros

guessnet, ifplugd, and waproamd

Wouldn't it be nice just to pick up your laptop, plug it in at work, and be connected to the network without having to do anything other than connect the cable? Or to take a WiFi laptop to school, have it recognize the hotspot there and set up the appropriate WEP key*? Well, with the help of a couple of programs and some configuring this can become a reality.

What exactly are we doing? It's actually quite simple. We are going to set up multiple logical interfaces for a single physical interface. Next, we are going to help the computer recognize what network it is on and bring up the appropriate logical interface. Finally, we will show the computer how to recognize that it is connected to a network and have it trigger the network recognition

* Yes, WEP is insecure. But some security is better than none, as long as you recognize that it is weak security.

Before we begin

A few quick things things to note. First, this assumes that you have root access on the machine you are using. Second, this was written with Debian systems in mind, so theoretically, this should work with any Debian-based distribution. Things are likely very different in other distributions, especially Red Hat-based distributions. Distributions such as Knoppix, Morphix, Xandros and Lindows may be similarly configured. A guide to doing something similar in Red Hat is in the works. Finally, be sure to make a back up before you make any changes. If something bad occurs a backup will allow you to restore your network settings, which is better than no networking at all.

First things first . /etc/network/interfaces

If you know what's in /etc/network/interfaces already and know how to use ifup and ifdown, you can skip this section. Otherwise, read on.

Layout

/etc/network/interfaces is where the configuration of your network is stored. A basic interfaces file might look like this:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# This is a comment

# Set up the looback (lo) interface
iface lo inet loopback

# Use dhcp to configure eth0
iface eth0 inet dhcp

# Use a static configuration with eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

# Automatically bring up lo and eth0
auto eth0 lo

What do all those lines mean?

  • iface lo — sets up the loopback interface (127.0.0.1)
  • iface eth0 inet dhcp — use dhcp to configure the first physical interface
  • iface eth1 inet static — Set up a static interface for the second card based on the lines below it
  • auto eth0 lo — automatically bring up the loopback interface and the first interface

how to use the information in /etc/network/interfaces

In order to make use of the information in this file, you use the ifup and ifdown commands. To use the second card and not the first card you would use the following commands (you will probably need root access to execute them):

ifup eth1
ifdown eth0

Using multiple configurations for an single interface

Okay, that's great. But what if you want to have a different configuration for work and home and you only have one card? The interfaces file can handle that, too. You don't have to name the logical interface based on the physical interface. For example,

# Use dhcp to configure work
iface work inet dhcp

# Use a static configuration at home
iface home inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

The only problem is that ifup doesn't know what to do with those configs. When you want ifup now, you need to tell it what config to use. All you do is use

ifup = 

An example:

ifup eth0=work
ifdown eth0
ifup eth0=home

Notice that you don't have to tell ifdown which config to use; it already knows which is being used.

Discovering which configuration to use . guessnet

All that is well and good, but we don't want to have to tell the computer where we are. This is step one of automatic configuration. The interfaces file allows you to do a couple of neat things. There is a special stanza that allows you to plug in a script to determine where you are. This stanza is the mapping stanza. First, we add the following lines:

auto eth0
mapping eth0
script

iface home inet dhcp
iface work inet dhcp
The script stanza specifies what command/script to run. It is passed the interface name (eth0) in this case. It is expected to echo a logical interface name (home or work). Basically the mapping command will run the script and the run ifup eth0=

Comments

  1. Anonymous4:22 AM

    If you want to do this on Xandros, you just use the graphical connection system and it does it all for you. Nice little meter showing available access points and signal strength and all that stuff.

    ReplyDelete
  2. by the way thanxs very much for ur nice command, but some times we angry if we loose the origin taste of the cute linux behavior ;)

    ReplyDelete
  3. Anonymous12:14 PM

    I think if you want to run your program you have to find your theklek firstly and then you can eat dodol.......

    ReplyDelete
  4. Anonymous8:58 PM

    [sok] RAK MUDEEEENGGG...

    lha mbok nulis sing bahasa manusia wae, ojo boso mesin ditulis.
    iki blog'e menungso opo blog'e mesin??

    hueheuheuheuheue

    ReplyDelete
  5. Anonymous7:24 PM

    puyeng

    ReplyDelete

Post a Comment

Popular Posts