msgbartop
Adam Palmer MBCS CITP, Linux, PHP Programmer, MySQL Developer, Embedded Hardware, Security Consultant
Did my blog help you? Please link to me!
  dns test
 
RSS Feed
msgbarbottom

28 Feb 09 Linux and the Huawei HSDPA 3G E220 modem for mobile broadband

Installing the Huawei E220 modem under Linux is so so easy. Probably easier than running through the Windows XP Setup tool actually!

Prerequisites:

1. Kernel version equal to or greater than 2.6.20 (There are workarounds availble for older kernels)
2. wvdial (You can use any serial dialer I guess)
(more…)

Tags: , , , , , , , ,

22 Jan 09 DNS based Load Balancing

There are two main options for DNS based load balancing. The first and most simple is the round robin option. We can use this for ‘A (alias) records’ and ‘MX (Mail-eXchanger) records’.

We can specify a priority for MX records. If we specify the same priority for multiple MX records, the querying client will toss a coin and ‘randomly’ decide which to use. The same applies to A records. This should provide with a reasonable split between your various records however provides no mechanism for server loads or using any kind of intelligence to route queries.

Another option is to return a record based on intelligence. Assume we are trying to balance load between web servers. The two popular methods we can use are to return a record based on knowledge of the load of the web servers, or alternatively return a record based on originating IP (location) of the requesting client.

This is all well and good however there are a number of considerations, specifically that DNS was not intended to be operated in this way.

  1. You can set your records expire time to as low as you like, it will still be cached in circumstances by the browser and/or the resolver. This method will not account for ‘downed’ or ‘overloaded’ servers, they will still receive traffic.
  2. Due to caching, should your browser or resolver hold on to the record, it will blindly access the same IP next time the host name is requested, without requerying the DNS server and ignorant of the changed network conditions.

Tags: , ,

18 Jan 09 Linux IP Address Configuration Static or DHCP

It’s simple really..

You can define a static IP as follows:

ifconfig <interface> <ipaddress> netmask <mask> broadcast <broadcast>
e.g. ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255

You can then define a route out to the internet:

route add default gw <router>
Which has the same effect as: route add -net 0.0.0.0/0 <router>
i.e. route add default gw 192.168.1.1

Or if you’d like to acquire an address via a local DHCP server:

dhclient <interface>
e.g. dhclient eth0

That’s all there is to it! Now.. these settings won’t stick on reboot, you’ll have to refer to your distro’s startup files. On debian you want /etc/network/interfaces

A sample stanza for the above configuration:

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

All done!

Tags: , , , , , ,

16 Dec 08 Simple POP3 Communication HOWTO

POP3 is an incredibly simple protocol, and with the most basic commands, you can access your POP3 server ‘by hand’ with this POP3 HOWTO without the need for a client. You can find the entire POP3 RFC here http://www.ietf.org/rfc/rfc1939.txt

Now, down to business. I have created a temporary test account:  test@adamsinfo.com – please don’t try and access this as by the time you see this, it’s already been removed! I’ll use telnet to access the service, and send simple plain text commands. I’ve sent myself a test email, which I will also retrieve and then delete. Conversation as follows, I have highlighted my own commands in bold:

(more…)

Tags: , , , , , , , , ,

15 Dec 08 A BIND9 zonefile and commentary

I’m often asked for a copy of various zone files for Bind, that other users may use as a template. Here’s the zonefile for www.adamsinfo.com:

$TTL 604
@       IN      SOA      adamsinfo.com. root.adamsinfo.com. (
2008101023        ; Serial
172800         ; Refresh
900         ; Retry
1209600         ; Expire
3600 )       ; Negative Cache TTL
;
IN      NS      ns3.apnichosting.com.
IN      NS      ns2.apnichosting.com.
IN      MX      10      mail3.apnicsolutions.com.
IN      MX      100     mail2.apnicsolutions.com.
IN      MX      1000    backup-0.l3.apnicservers.com.
IN      A       217.10.156.197
*                       CNAME   adamsinfo.com.

I’ll now cover each type of record briefly, and explain the ellusive decimal point.

The SOA or “start of authority” record indicates the domain name “adamsinfo.com” and the email address of the domain administrator “root@adamsinfo.com”, replacing the at symbol with a decimal point (this decimal point does not have the same meaning as those later on). There is only one SOA record allowed per domain. Contained within the SOA record is also a serial number, refresh, retry, expiry and TTL. The serial number is the ‘version’ of the zone. This is generally incremented each time the zone is updated. The refresh is used by the slave or secondary DNS server as an instruction on how often to update in seconds. The ‘retry’ is the length in seconds that the slave DNS server should wait before retrying to contact an unreachable primary DNS server. The expiry specifies how long until the slave DNS server stops responding to requests for this domain name, should the primary DNS server remain unreachable. If the primary DNS server becomes available again, the timer is reset. Lastly, the Negative TTL or ‘time to live’ value indicates how long the server will cache a NAME ERROR (NXDOMAIN) record. The longest permitted is 3h (10800 seconds).

On to the more simple records…
(more…)

Tags: , , , , , , , , , , ,

24 Oct 08 rsync over SSH, SSH key login, public keys, automated backups

This tutorial will cover how to set up a simple backup job between two machines using rsync and ssh. You will need HOST A and HOST B, whereby HOST B is your target backup service.

On HOST B:

ssh-keygen -t rsa  # Press enter to accept the default options.
mv ~/.ssh/id_rsa ~/.ssh/identity
cat ~/.ssh/id_rsa.pub

(more…)

Tags: , , , , , , , ,

19 Oct 08 Linux on a Mikrotik 532a , Part 5 Final – OpenWRT and Custom Scripts

Follow on from: http://www.adamsinfo.com/linux-on-a-mikrotik-532a-part-4-customization-debian-scripts-shaping-firewall-nat-picolcd/

Discuss this article here

I’ve used OpenWrt previously to this project to build some firmwards for the Linksys Router WRT54 range. OpenWrt is an incredibly powerful and small Linux distro. Although debian is probably better suited to the reasonably powerful hardware, I wanted to give OpenWrt a go anyway.

Unless you’re running a MIPS 4Kc processor on your host which I’m guessing you’re not, you’ll either need to cross compile your binaries, or just compile them natively on the device itself. Compiling on the device works fine as long as you have the relevant packages, however if I was going to build a 2.6 kernel, I’d rather do it on an x86 quad core intel host, rather than waiting a week for the device to do it. I also wanted to minimize the writes on the CF card.

OpenWrt comes with a nice buildroot environment which you can read about and download from www.openwrt.org using Subversion.

Here http://downloads.openwrt.org/kamikaze/docs/openwrt.html#x1-310002 is a great HOWTO on getting the build root environment set up on your x86 host.

Also, see: http://wiki.mikrotik.com/wiki/RB500_Linux_SDK – this is a very complete HOWTO, which is why I’ve not covered most of the installation process and just detailed customizations.

You’ll need to select the RB5xx target for the kernel. Also, run:

make kernel_config

In your build root top directory, and add USB support (as my one is modded for USB which is not RB5xx default.

While you’re there, browse to the networking options and make sure you have everything you want, specifically the schedulers for traffic shaping.

Here is my precompiled image:

http://www.adamsinfo.com/download.php?file=apnicbox-openwrt-151008.img.bz2
MD5: aa3df2923b31afe2ae94fc04f65d80be

(more…)

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

11 Oct 08 Linux on a Mikrotik 532a, Part 4 – Customization, Debian Scripts, Shaping, Firewall, NAT, picoLCD

Follow On From: 05 Oct 08 APNIC Box – Linux on a Mikrotik 532a, Part 3 – Installing Debian, Prebuilt Disk Image

Following on from the previous article, I’ve written some scripts which you’ll find in the /root/scripts/ directory of the prebuilt image. I’ve attached and commented them here, as they could also be useful elsewhere.

bridge.sh #For setting up a simple bridge
(more…)

Tags: , , , , , , , , , , , , , , , , , , ,

05 Oct 08 APNIC Box – Linux on a Mikrotik 532a, Part 3 – Installing Debian, Prebuilt Disk Image

Follow on from 01 Oct 08 APNIC Box – Linux on a Mikrotik 532a, Part 2

The device runs a 2.4.30 kernel on a debian woody (mipsel) environment. If anyone can contribute anything for 2.6.x and debian etch, that would be great.

In this part, I’m going to provide a download link to a prebuilt image which you can write directly onto your own CF card with dd or similar tool. I’m also going to provide a step by step to installing debian yourself without my prebuilt disk image.

Prebuilt image is here:

The prebuilt image also contains a number of scripts and tools that I’ll comment on and come to in later parts.

Now installation instructions:
(more…)

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

01 Oct 08 APNIC Box – Linux on a Mikrotik 532a, Part 2 – Hardware Modifications

Follow on from 01 Oct 08 APNIC Box – Linux on a Mikrotik 532a, Part 1

Custom Hardware Modifications

Here’s a labelled image of the inside of the device. You can also look towards the bottom left of the image for my simple solder modifications. Enlarge the image to see the labels.

APNIC Box Image 2

APNIC Box Image 2

1. External 2.4GHz/5GHz antenna. Same on opposite side.
2. 5V solder point
3. 5V connector for miniPCI USB card
4. 2x 2USB Headers. 1 Header in use providing 2x USB interfaces, one to regular host connector for mass storage or other usb connection. Other port for picoLCD on top
5. 512MB CF card
6. miniPCI USB controller

On the underside of the board there is a single miniPCI socket which houses an Atheros 5212 802.11a/b/g miniPCI card. It has two antenna outputs which run under the board and two the two external antennae. I haven’t taken a picture of this but if anyone really wants to see it, I will power down the device, get a picture of it and post it here.

(more…)

Tags: , , , , , , , , , , , , , , , , , ,