Thursday, January 3, 2013

VNC Server

I setup a VNC Server just in case I needed GUI tools when remotely testing the router.

vnc4config
Edit .vnc/xstartup with:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/mate-session
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

vnc4server

[Unresolved] DynDNS

I tried to setup Dynamic DNS updates using inadyn, which was blocked by DynDNS.org. I then settled for ddclient (as a Linux Mint 14 package), which would work if I forced an update (by changing the IP in the cache file but would not work otherwise.

I couldn't get automatic DynDNS updates working correctly, and decided to just go with a DynDNS official client for Windows on one of the Windows clients on the network.

Setting up routing

First off, I had to enable routing by uncommenting the following line in /etc/sysctl.conf

net.ipv4.ip_forward=1

I then had to set up IPTables for NAT with the following lines

sudo iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface wlan0 -j ACCEPT

Finally, Linux Mint had an iptables-save package for persisting the rules defined in IPTables.

I saved the IPTables rules using: sudo service iptables save
and I verified that they were in there by looking at the file /etc/iptables/rules.v4

Setting up DHCP

I installed udhcpd, which is available as a package for Linux Mint 14.

Editing the /etc/udhcpd.conf file is simple with the included comments.

I set the IP range as follows

start 192.168.254.20
end 192.168.254.100

I  set the interface to listen for DHCP requests on with

interface wlan0

I then set the DHCP options as follows

opt dns 8.8.8.8
option subnet 255.255.255.0
opt router 192.168.254.1

Setting up the wireless network interface

I used the /etc/network/interfaces file to setup the wireless NIC to accept WEP adhoc connections with the following:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
wireless-mode ad-hoc
wireless-channel 4
wireless-essid xxxxxxxxx
wireless-key xxxxxxxxxx

wireless-power off

I'm still not sure if that last line disables power management, since I'm using the iwl3945 driver, which supposedly already has power management disabled in recent kernels.

Setting up the PPPoE connection

Setting up the PPPoE Internet connection was really simple with the pppoeconf command line utility.

I had to stop using Network Manager for the PPPoE because it would not re-connect whenever the PPPoE connection failed.

pppoeconf adds the following lines into /etc/network/interfaces automatically:

iface ppp0 inet ppp
provider ppp0

auto ppp0

auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
provider dsl-provider

auto eth0
iface eth0 inet manual

The Software

I have Linux Mint 14 Nadia setup on the laptop. I chose Mint 14 because it is a derivative of Ubuntu 12.10 but without the overhead of using Unity as it only has an Intel display adapter.

The Hardware

My old WiFi router went bonkers so here I am, setting up a WiFi router with an old laptop.

My laptop is an IBM Thinkpad T60. It has an Intel Core processor, 3GB RAM, and an Intel wireless 3945 network adapter.

It connects to the Internet through a PPPoE connection that goes into the wired Ethernet port, and connects to LAN clients through the wireless network interface.