Techblog Technical Blog about all things computer
  • How to Setup A Wireless Bridge Router with Debian Lenny

    Filed under LINUX - Debian
    Aug 9

    How to Setup A Wireless Bridge Router with Debian Lenny 5.0

    The setup:

    My friend has a wireless router in one room and my room was far from the wireless router to run a cable to it.  I only had one wireless card and all the other computers in the room didn’t. In order to share internet connection among a few computers, I used a computer with LINUX Lenny 5.0 and made it into a router obtaining internet through its wireless card and sharing the connection through a separate Ethernet Card, already built into the motherboard.

    This is essentially a Debian gateway for the home network. The Debian LINUX computer acts as a NAT (Network Address Translation) by rewriting the destination IP address of packets intended for machines on your local network as they cross the gateway.

    Requirements:

    1 Wireless Card

    1 Ethernet Card

    1 – Computer with Debian Lenny 5.0 installed

    Assumptioin: Ethernet Card is already configured when Debian Lenny 5.0 was installed because it’s built into the motherboard.

    Setps Summary:

    1. Setup the Wireless card
    2. Setup IP Masquerading
    3. Setup dns forwarder so hostnames can be resolved to ipaddresses
    4. Setup a DHCP server so ipaddress can be dynamically issued

    Setup:

    First we need to setup the wireless card. A lot of wireless network card don’t have LINUX drivers so the best way is get them working on LINUX is by using their window’s driver through ndis wrapper. NDIS wrapper implements a Windows kerlen API allowing the windows drivers to work.

    1.) Setup ndis wrapper by installing module assistant and wireless tools

    apt-get install module-assistant wireless-tools

    2.) Build and install ndis wrappper modules package using Module Assistant

    m-a prepare

    m-a a-i ndiswrapper

    3.) Add ndiswrapper to the list of kernel modules to load at boot:

    echo ndiswrapper >> /etc/modules

    4.) Insert Ndis Wrapper Module into the Kernel

    modprobe ndiswrapper

    5.) Download Windows Driver for your network card

    You can get your driver from this link:

    http://ndiswrapper.sourceforge.net/mediawiki/index.php/List

    If you don’t see your driver, you can use the driver that comes with your network card’s CD. My network card is a Trendnet TEW228-PI so I download the driver from Manufacturer’s website.

    6.) Install the unzip package to unzip the driver files into harddrive.

    apt-get install unzip

    7.) Unzip the driver file

    unzip -a driverfile.zip

    8.) Install the NDIS driver:

    ndiswrapper -i DRIVER/sss.inf

    in my case I typed:

    ndiswrapper –i TEW228PI/rtl8180.sys

    9.) Verify NDIS driver installation, list the current installed drivers

    ndiswrapper -l

    You should see your driver name along with “driver installed”. The output for my the Trendnet TWE-228PI below:

    netr8180 : driver installed

    device (10EC:8180) present (alternate driver: rtl8180)

    Just in case you want to  uninstall, the command is below. :

    ndiswrapper –e <driver>

    e.g. ndiswrapper –e bcmw15

     

    1. Plug in your wireless card and iwconfig to see if your device an available interface. If not, install your wireless card and run iwconfig again.

    You should see the example below:

    LasVegas:~# iwconfig 

    lo        no wireless extensions.

    eth0      no wireless extensions.

    wmaster0  no wireless extensions.

    wlan0     IEEE 802.11  ESSID:”SNOWBALL”

    Mode:Managed  Frequency:2.462 GHz  Access Point: 00:1E:2A:0A:C7:5C

    Bit Rate=1 Mb/s   Tx-Power=20 dBm

    Retry min limit:7   RTS thr:off   Fragment thr=2352 B

    Encryption key:976E-00B5-46

    Link Signal level=-130 dBm

    Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

    Tx excessive retries:0  Invalid misc:0   Missed beacon:0

    If you see you r driver, it’s now time to scan for wireless networks and connect.

     

    1. Scan for an access point:

            iwlist wlan0 scan

    1. To connect to a network which you see,

    iwconfig wlan0 mode Managed

    13.)  if you use encryption put your key in here

    iwconfig wlan0 key restricted XXXXXXXX

    put your ESSID under “REPLACE ESSID
    iwconfig wlan0 essid ‘REPLACEESSID’

     

    14.)  Then to restart lan

    dhclient wlan0

    15.) Add the new interface to the interfaces file

    vi /etc/network/interfaces

    #——

    auto wlan0

    iface wlan0 inet dhcp

    wireless-essid default

    #   wireless-key XXXXXX

    #——-

     

    16.) Save and exit

    17.) Reset the connection

    ifdown wlan0 && ifup wlan0

    18.) Test the connection:

    ping www.yahoo.com

    19.) Make sure this configuration loads up during boot:

    ndiswrapper –m

    1. Reboot and then ping www.yahoo.com to make sure setup works.
    2. Now we need to create a local area network by adding this line to /etc/network/interfaces

     vi /etc/network/interfaces

    auto eth0

    iface etho0 inet static

    auto eth1

    iface eth1 inet static

    address     192.168.2.1

    netmask     255.255.255.0

    network   192.168.2.0

    22.) save and exit. This will create a Local network with 192.168.2.XXX.

    23.) To connect to this network assign an ip address to a connecting computer with the follwoing 192.168.2.XXX where XXX can be any number from 2 to 255.

    Example: 192.168.2.3

    Subnet mask: 255.255.255.0

    Default gateway: 192.168.2.1

    Perfered DNS server: 192.168.2.1

    24.) Reboot your LINUX computer. At this point, if you connect your client computer, either directly with a cross over cable to the LINUX box, or through a switch or hub, you will should be able to ping the LINUX server.

    25.) Now you need to setup IPFORWDING rules and the best way is to install the ipmasq package. It takes care of everything.

    apt-get install ipmasq

    26.) To enable all modules edit  /etc/ipmasq/modules

    ##
    # Sample to load all the ip_masq_ modules
    all
    
    26.) At  this point, you will be able to ping computers in your wireless card’s network  but unable to get to google or resolve any domain names so you need to setup a  DNS. And the best way to do this is install a dns forwarder.

    apt-get install dnsmasq

    27.) Reboot your LINUX box and you should be able to ping google.com from your client computers.

    IF YOU WANT TO SAVE YOURSELF THE TOURBLE OF MANUALLY CONFIGURING IP ADDRESS FOR CLIENT COMPUTERS WHAT YOU NEED IS A DHCP SERVER WHICH WILL DYNAMICALLY ASSIGN IP ADDRESS TO ANY CONNECTING COMPUTER.

    HOW TO SETUP A DHCP SERVER FOR YOUR LAN SO YOU DON’T HAVE TO MANUALLY ASSIGN AN IP ADDRESS TO YOUR CLIENT COMPUTER EVERYTIME YOU WANT TO CONNECT TO YOUR DEBIAN NAT ROUTER.

    28.) Install the dchp3-server using aptitude. At the end of the installation you will see an “start” failed error. Ignor this because you need to setup the configuration file to get the server to work.

    apt-get install dhcp3-server

    29.) Edit the configuration file:

    vi  /etc/dhcp3/dhcpd.conf

    30.) The file should look like below: (put your domain-name-servers

    ddns-update-style none;

    option domain-name-servers 192.168.2.1, enter.your.secondary.dns;

    default-lease-time 86400;

    max-lease-time 604800;

    authoritative;

    subnet 192.168.2.0 netmask 255.255.255.0 {

    range 192.168.0.3 192.168.0.255;

    option subnet-mask 255.255.255.0;

    option broadcast-address 192.168.2.255;

    option routers 192.168.2.1;

    }

    Explanation:  subnet is your network. Range tells dchp which ip address range you want to issue. Routers is your router ip address.

    31.) Restart DHCP server

    /etc/init.d/dhcp3-server restart

    32.) That’s it if you want to see which ipaddress is issued look at the leases file.

    vi /var/lib/dhcp3/dhcpd.leases

21 Responses to “How to Setup A Wireless Bridge Router with Debian Lenny”

  1. Can anyone recommend the well-priced Script Deployment tool for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central msp software
    ? What is your best take in cost vs performance among those three? I need a good advice please… Thanks in advance!

  2. Good blog. I got a lot of good info. I’ve been watching this technology for awhile. It’s fascinating how it keeps shifting, yet some of the core factors remain the same. Have you seen much change since Google made their most recent acquisition in the domain?

  3. Hello, great day.. Your work is incredibly striking. I never thought that it was possible to accomplish something like that until after I read your article. You certainly offered an incredible perception on exactly how this kind of whole system performs. I will always visit for more advice. Keep writing!

  4. ..

    Buygeneric pills…

  5. Buywithout prescription…

  6. Buywithout prescription…

  7. ..

    Buywithout prescription…

  8. Buynow…

  9. .

    Buynow it…

  10. Buygeneric meds…

  11. ..

    Buygeneric meds…

  12. ..

    Buynow it…

  13. ..

    Buyno prescription…

  14. .

    Buygeneric drugs…

  15. .

    Buynow it…

  16. .

    Buygeneric drugs…

  17. .

    Buygeneric meds…

  18. ..

    Buygeneric meds qmo…

  19. .

    Buygeneric drugs zfk…

  20. Buywithout prescription xiu…


  21. GENERIC PHARMACY : -==== Anti Convulsants Cure ====-

    Buy Generic Drugs Now!…

Leave a Reply