Smokes your problems, coughs fresh air.

Author: halfgaar (Page 16 of 26)

Halfgaar is Wiebe. Wiebe is a contributing author on this weblog. He also has a lot of stuff (such as long, in-depth articles) on his personal website.

Wiebe's day job is as a senior software developer and system administrator at YTEC.

In his free time, he built the free, open-source FlashMQ software. Together with Jeroen and Rowan, he is now building a managed MQTT hosting business around his open masterpiece.

Setting a custom greeting for an Asterisk voicemailbox

By default, Asterisk always plays its own vm-intro as voicemail intro. To enable the user to record their own message, the entry in extensions.conf which sends a caller to the voicemail should be:

exten => _0123456789,n,Voicemail(1@<context>|s,u)

The s is to skip the default greeting. The u is for the unavailable message. You can also say b for busy message.

‘show application voicemail’ shows usage information and all the options you can give.

Making a port forwarded machine available from within the LAN

When you forward a port to an internal machine on the network, you still can’t access that host using your WAN-IP from within the LAN. This article explains it well. In short, it’s because the reply the machine your connecting to makes, goes to the LAN IP directly, and not back through the router.

To fix it, we need to add a SNAT rule for that port forward as well. In the example that we want to forward port 80 to 10.50.0.4 on our 10.50.0.0/16 LAN and 10.50.0.1 is our router, these two rules are necessary:

iptables -t nat -A PREROUTING -d WANIP -p tcp --dport 80 -m comment --comment "Forward www to 10.50.0.4." -j DNAT --to-destination LANIP
iptables -t nat -A POSTROUTING -p tcp --source 10.50.0.0/16 --dest 10.50.0.4 --dport 80 -j SNAT --to-source 10.50.0.1 --match comment --comment "Allow our LAN to access port 80 from the WAN side as well."

Normally when forwarding, I would not use -d WANIP, but –in-interface eth0, but that won’t work here, because the LAN requests are not on eth0.

Also, the –source in the second rule is not strictly necessery, but if you don’t specify this rule, it will also match incoming requests for the internet, which is ugly, especially if you have logging rules.

Disabling related after current tab open

I don’t like that firefox nowadays opens new tabs after the current tab. When I open stuff, I remember in which order I opened it and I don’t want that order changed by having tabs inserted.

Change:

browser.tabs.insertRelatedAfterCurrent

to false.

Burning media with wodim

Every time I want to burn media, I have to look up again what the syntax is. So, for future reference, this post.

CD ISO image:

wodim dev=/dev/sr1 -eject  ubuntu-10.04-server-amd64.iso

For DVD’s it’s different. If you mimick the above command, you will have a DVD with the ISO file on it. I don’t know exactly, but you have to specify /dev/dvd=image.iso or something. When the next time I burn a DVD ISO arrives, I’ll update this post.

Configuring a Debian exim server for internet delivery

I wanted an Exim server which could send mail on its own without the use of another SMTP server.

First see this for some general explantion.

I used this config file:

# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file
 
dc_eximconfig_configtype='internet'
dc_other_hostnames='existingdomain.com'
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

Also remember to put that existingdomain.com in /etc/mailname.

Customizing displayed headers in Mozilla Thunderbird

For some reason, the new Thunderbird 3 thought it was useful to show me the content_encoding header per default, below the addressee and stuff. This header had such a long name that it disrupted the layout. Luckily, you can change what headers it displays by editing “mailnews.headers.extraExpandedHeaders” in the configuration editor.

I just removed the content_encoding header and it worked.

Aligning partitions with RAID and LVM on drives with 4 kB sectors

Hard disks are being released that abandon the long-established standard of 512 byte sectors. I just got two Western Digital WD15EARS ones, which uses 4 kB sectors. Western Digital Refers to this as “Advanced Format”. This poses some serious problems. I will describe those, and what I did to ‘solve’ it.

This article is as much for myself as for other people correcting me. So, if you see faults, let me know 🙂

First, you may want to read this IBM article and this LWN article. Reading these articles is important to understand this issue. Too summarize a bit, hard disks can’t really have 4 kB sectors, because then BIOS, bootloaders, operating systems, partition software and who knows what will just go beserk. So, they still report a sector size of 512 bytes. This emulation presents certain performance issues (explained in the links), which can only be avoided by aligning the filesystems on disk, which the IBM article explains well. In short, I configured fdisk to 224 heads and 56 sectors. This aligns the partitions properly. Do remember, however, to start at cylinder 2 for your first partition, otherwise there isn’t enough space for the bootloader.

Now, what happens if you don’t put a file system on your partition, but make a software RAID1+LVM out of it? It gets a lot more complicated to align the filesystem blocks this way, because of all the layers. I did the following:

First I created the aligned partition with fdisk on two disks. Then I made a RAID1 array out of it. Luckily, Linux MD has the ability to store the RAID superblock at the end of the partition. It can also store it at the beginning, but you shouldn’t do that! The RAID superblock is 256 bytes + 2 bytes per drive long, which means one logical sectors, which in turn means that the start of the MD partition is in the middle of a 4 kB sector on disk. You can use metadata format 1.0 or 0.9 to put the superblock at the end of the disk (see mdadm man page).

Then it’s time to create the logical volume. When preparing the RAID1 partition for use in the volume group, give pvcreate the –dataalignment 4096 option. Then, with “pvs -o +pe_start”, you should be able to see where the first PE (physical extent) starts. I accidentally created mine with alignment 8, but the first extent is at 136.00 kB (139264 bytes), which is divisable by 4096.

Then, I created the volume group with an extent size of 4MB. 4 MB is also divisible by 4096. Logical volumes are created as multiples of the extent size, so you can now create them at will, and they will be aligned.

When creating a RAID array that deals with striping, be sure to make the stripe size a multiple of 4 kB. I guess this also applies to logical volumes with striping.

What I still would like to know, is whether the file system journal is also made up of 4 kb blocks. Also, the RAID array’s write intent bitmap (if you have one) is also still unclear to me. Where is that stored? Does it write in multiples of 4k?

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑