You are viewing [info]gothgems's journal

Jem

Recent Entries

10/29/11 11:59 pm - Setting up a wireless router in Ubuntu Server 11.10

I just spent all day figuring this out because none of the howto guides got it exactly right for my setup. I wanted to replace my unreliable wireless router with a PC running Linux. I needed two wired ethernet ports (one for WAN, one for LAN) and a wireless network adapter. Here's the kit I used, but of course there are other choices:

CPU/Mobo - Intel E5700, Shuttle XG41
WiFi - Half Mini-PCI Atheros AR9287

The most useful guide was from the Voyage Linux network setup page because it was very close to what I was trying to do. Robert Heywood's blog post was very helpful too - cheers, Robert!


I installed Ubuntu Server 11.10, and used apt-get to install the isc-dhcp-server package since I was replacing the existing DHCP server on my LAN. I also installed hostapd to provide the wireless access point function.

sudo apt-get install isc-dhcp-server hostapd

The magic incantations need to be stored in the following files:

/etc/hostapd.conf - this is the configuration for hostapd, where you set up the WPA parameters. It failed to set up the bridge, though, which is where I had problems. I put this in /etc but you can put it where you like as long as you include the path in your hostapd command.

/etc/network/interfaces - network interface parameters, and also a useful place to kick off the DHCP server and hostapd. I also needed to add the bridge configuration as a post-up command (none of the howto guides mentioned this).

/etc/dhcp/dhcpd.conf - set up the scopes for serving DHCP addresses and options

/etc/default/isc-dhcp-server - tells Ubuntu which subnets the DHCP server operates on (you'd think this would be in dhcpd.conf, wouldn't you?).

/usr/local/bin/firewall.sh - a firewall configuration script I modified from the Voyage Linux howto page. This script also sets up IP Forwarding, so if you want to set up the router without a firewall you might want to do this as a post-up command in /etc/network/interfaces:

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


So, here's what I put in those files:

/etc/hostapd.conf

#Tell hostapd whch interface to operate on
interface=wlan0

#For ath9k (AR9287), use the nl80211 driver
driver=nl80211

#Set up the SSID, channel, wifi mode, and WPA parameters
ssid=my_ssid
channel=3
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=secret_key
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
rsn_pairwise=CCMP



/etc/network/interfaces

iface lo inet loopback

#Set up the WAN interface to use DHCP to get its address from the ISP
auto eth0
iface eth0 inet dhcp

#Set up the wired LAN interface to manual
auto eth1
iface eth1 inet manual

#Set up the bridge so that wireless and wired LAN are on the same subnet
auto br0
iface br0 inet static
# Assign your IP address, subnet and mask, broadcast address
address 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
# add eth1 to bridge, wlan0 will be added later
bridge_ports eth1
#after the bridge is up we can start dhcp and the firewall
post-up /etc/init.d/isc-dhcp-server restart
post-up /usr/local/bin/firewall.sh

#Set up the wireless LAN interface
auto wlan0
iface wlan0 inet manual
up iwconfig wlan0
# run hostapd using the hostapd.conf config file we made earlier
hostapd /etc/hostapd.conf
# hostapd is supposed to add wlan0 to the bridge but it didn't work for me, so I do it here
post-up brctl addif br0 wlan0



/etc/default/isc-dhcp-server

#Just need to tell the server it's on the bridged network
INTERFACES="br0"


/etc/dhcp/dhcpd.conf

ddns-update-style none;

option domain-name "some.domain.com";
#These are the OpenDNS servers, but feel free to use whatever DNS servers you prefer
option domain-name-servers 208.67.222.222, 208.67.220.220;

default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.149;
option routers 192.168.0.1;
option ip-forwarding off;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
}


/usr/local/bin/firewall.sh

Get this from Voyage Network Setup and modify it as you need to.

Reboot (or at least restart networking with /etc/init.d/networking restart) and it should work OK.

1/29/10 11:59 pm - Diabetes control

Having some trouble with blood glucose control this week and not really sure why. Insulin dose has been the same each evening, and quantity of carbs in the meals has been pretty consistent. Last night my blood glucose was 11.3 before bed (unusually high for me), but tonight it was 3.1 (unusually low). We have take-out about once a week and my late night highs seem to be related to eating take-out food. I think it must be due to the fat content. Fat slows down the conversion of food to glucose, so if I've eaten a pizza or curry the short-acting insulin wears off before all the glucose gets into my bloodstream, so I get highs. Less fat in the home cooked food means glucose gets into my blood quicker so if I take too much insulin I get lows.

So, I'll try this simple rule of thumb for a while. If I'm eating take out I'll take insulin AFTER the meal and probably take a little extra. If I'm eating home-cooked, low-fat food then I'll take it before the meal but probably a little less.

Interestingly enough, eating a sugary desert has a negligible impact on my blood sugar. I had the same desert on the night I had the high as I did tonight. In fact, tonight I had a little more but my blood sugar was low. There seems to be some kind of inverse correlation with the amount of sugar (insulin working harder so causes lows?) so I'll bear that in mind for the future too.

Anyway, I've eaten a bowl of cereal (slow burn carbs should keep me on a level all night) now so I'm back in normal range at 6.7. I'm guessing it'll still be about 6.7 in the morning. I usually wake with blood glucose about the same level it was when I went to bed, despite not eating all night. Never have been able to work that one out...

Anyway, roll on the DAFNE course in April. I have much to learn.

9/2/09 11:18 am - 07/08/09

09

Tags:

9/2/09 11:18 am - Stockholm statues

Stockholm statues

Tags:

9/2/09 11:18 am - 06/08/09

09

Tags:

8/6/09 05:12 pm - 06/08/09

09

Tags:

8/6/09 05:09 pm - 06/08/09

Marianne and Stina
Tags:

8/6/09 12:24 pm - Horsedrawn tour of Gamlastan

Horsedrawn tour of Gamlastan

Tags:

8/5/09 02:43 pm - Abi

 Abi

Tags:

8/5/09 02:40 pm - Splash!

Liam splashing Emily.
Splash!

Tags:
Powered by LiveJournal.com