NSLU2 Linux Gateway

by Walter Rudametkin     linux   nslu2   work-in-progress  

Posted 2010.07.29 — Rennes, France
Work in progress

It's easy to setup additional IP addresses on Debian Linux. This is particularly useful for the NSLU which doesn't have a display so you need to remotely connect to it.

Having more than one virtual network interface allows us to have both a DHCP address and a static IP address, making the NSLU2 accessible pretty much always.

On the nslu

I'm supposing you have somekind of IP address already setup. Also, you should have a working DNS, although this shouldn't impact any of the following.

Once you can ping the gateway machine, the gateway must be added so that the nslu knows that he can attain addresses that are beyond his own network.

Command is

route add default gw

Then the /etc/resolv.conf must be edited to the same nameserver as the other box. Note that nslu should be able to ping this nameserver once the gateway is setup.

For setting up the gateway we must enable ip forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Additional virtual network interface

If we want to setup alias cards, we can do something along the lines of bash ifconfig eth0:N address netmask

However, it's probably easier to just edit the /etc/network/interfaces file by adding something like this

iface eth0:0 inet static
        pre-up echo "*** Starting eth0:0 alias ***"
        post-up echo "*** Alias eth0:0 started ***"
        #post-up route add -net dev eth0
        #post-up route add -host dev eth0:1

This allows us to have a static IP address in addition to whatever other configured addresses we might have. I used it to have both a DHCP assigned address and a static local network address, allowing me to always get access to the NSLU2, even if it's not getting an address through DHCP.

Finally, must set up iptables to the correct rules!!!

I found and change a script to setup the tables to allow

'Tis me blog matie

Sorry, no comments enabled for now because I'm using a simple static site generator (maybe I'll try out disqus another day).

But if you like what you see, send me an email.