May 062011
 

tuxgwDuring my tests i installed a Debian 6 Squeeze on an Old laptop with an integrated ethernet card and a PCMCIA wireless card.
Problem, after the install all works perfectly but the wireless, and installing new packages without a net is not so comfortable.
You have to search on the net for the name of the packages you need, download them and ALL their dependency put them on a USB stick and then hope that this work and resolve your problem. Naturally the first try (new kernel module for the wireless card, a rt61 + his firmware) did not solve the problem.

So I decided to use my laptop with Xubuntu as gateway, the Xubuntu has a working wireless card and a free ethernet slot.
So what I did is put a crossover-cable between them and configure the Xubuntu as a gateway, all worked fine and now the other laptop is updating the system.

This is how i did it in details.



Note: the Script come from Debian-Administration.org an how-to from 2004, but still working perfectly.

Laptop A = Debian 6 Squeeze with broken rt61
Laptop B = The Xubuntu 11.04

Cable !

Connect via a crossover cable the 2 computers.
Nothing should happen.

Setup the gateway (Xubuntu)

On my Xubuntu i’ve on eth0 the ethernet card and on eth1 the wireless.

As first step i configured the ethernet with a private IP:

sudo -i
ifconfig eth0 10.0.0.1 netmask 255.255.255.0

Now if you give the command ifconfig you should have an output like that:

eth0      Link encap:Ethernet  HWaddr 00:0d:60:12:78:bc  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20d:60ff:fe12:78bc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38622 errors:0 dropped:0 overruns:0 frame:0
          TX packets:69077 errors:0 dropped:0 overruns:0 carrier:0
          collisions:17 txqueuelen:1000 
          RX bytes:2670203 (2.6 MB)  TX bytes:102971994 (102.9 MB)
 
eth1      Link encap:Ethernet  HWaddr 00:02:8a:9f:21:34  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::202:8aff:fe9f:2134/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:160442 errors:44 dropped:0 overruns:0 frame:44
          TX packets:112360 errors:25 dropped:0 overruns:0 carrier:0
          collisions:2106 txqueuelen:1000 
          RX bytes:203342322 (203.3 MB)  TX bytes:10853667 (10.8 MB)
          Interrupt:6 Base address:0x8000 
 
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:3780 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3780 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:347468 (347.4 KB)  TX bytes:347468 (347.4 KB)

After that i created a new file called gateway.sh with my text editor (vi) and pasted the following code:

#!/bin/sh
 
PATH=/usr/sbin:/sbin:/bin:/usr/bin
 
#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
 
# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT
 
# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
 
# Masquerade.
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
 
# Don't forward from the outside to the inside.
iptables -A FORWARD -i eth1 -o eth1 -j REJECT
 
# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward

NOTE: Usually my iptables table is clean, i don’t use it on my laptop, I’ve a front-end firewall, if you have some rules you could need to re-add them manually after the script.

Than i run it from terminal:

bash gateway.sh

As output i got

Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).

But later I did not have any problem.

On the client (Debian)

On this computer we have to set up the ethernet card and the routing, we know that our gateway is 10.0.0.1; so we can use these commands:

ifconfig eth0 10.0.0.2 netmask 255.255.255.0
route add -net 0.0.0.0 gw 10.0.0.1

On my Xubuntu I run a dnsmasq as local DNS cache, so i used it as DNS server for the Debian, to do so edit the file /etc/resolv.conf and add as first line:

nameserver 10.0.0.1

If you don’t have a local DNS, just put there your normal DNS servers (you can check on your gateway the file /etc/resolv.conf if you don’t know the addresses)

Test

Now on your client you should be able to reach the net without any problem.
Try a ping www.linuxaria.com for example if it work, now you are ready to update/install do anything you need to do on your client computer.

How i solved the rt61 problem on Debian 6

I updated everything, no results.
I’ve put the squeeze backports in the lists of apt-sources and i’ve installed the kernel: 2.6.38-8-generic, it work !

If you have a wireless card like this:

debian: ~ # lspci | grep RT
06:00.0 Network controller: RaLink 802.11g PCI RT2561/RT61

Install the kernel from backports and you’ll solve your problems

Popular Posts:

Flattr this!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*