Archive

Archive for August, 2006

Enabling hardware sensors in Ubuntu 6.06 Dapper Drake

August 26, 2006 Leave a comment

This procedure is adapted from here.

sudo su
apt-get install lm-sensors
cd /usr/bin
gedit mkdev.sh

paste this into the file:

#—-cut here—-

#!/bin/bash

# Here you can set several defaults.

# The number of devices to create (max: 256)
NUMBER=32

# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600

# This script doesn’t need to be run if devfs is used
if [ -r /proc/mounts ] ; then
if grep -q “/dev devfs” /proc/mounts ; then
echo “You do not need to run this script as your system uses devfs.”
exit;
fi
fi

i=0;

while [ $i -lt $NUMBER ] ; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i || exit
chown “$OUSER:$OGROUP” /dev/i2c-$i || exit
i=$[$i + 1]
done
#end of file

#—-cut here—-

*** Make sure you change curly quotes from WordPress into regular quotes. Curly quotes will break the script. There are only six of them.

Close and save the file.

chmod 755 mkdev.sh
./mkdev.sh

Run sensors-detect, and Answer YES to all the questions, except for the one about adding lines to /etc/modules automatically. Answer NO to that one. Using ISA or smbus depends on your configuration.

sensors-detect

In this example I ended up with the following text:

#—-cut here—-
# I2C adapter drivers
i2c-i801
i2c-isa
# I2C chip drivers
it87
eeprom
#—-cut here—-

What you need to do is add those drivers in reverse order to /etc/modules:

gedit /etc/modules

insert this at the end: (eeprom is not needed)

# I2C chip drivers
it87
# I2C adapter drivers
i2c-i801
i2c-isa

Close the file.

modprobe each of the modules, and update:

modprobe i2c-i801
modprobe i2c-isa
modprobe it87
depmod -a
update-modules

Now you can test the sensors:

sensors

You should get a bunch of sensor readings.

Categories: DIY, ubuntu

Network monitoring using VMWare Server on Ubuntu

August 25, 2006 Leave a comment

VMWare server is an excellent way to optimize your hardware usage. One powerful server can replace several others, and provides a very flexible test environment. VMWare server is free, and runs very well on Ubuntu. You do need more horsepower this way than you would to do the same thing natively, but not as much more as I expected. The ability to save snapshots as backups is wonderful, and making servers as portable as files requires a new way of thinking about upgrades. If you pair it with a good SAN, it takes you up even another notch.

Here is a good procedure for installing it at howto forge. It’s pretty easy to do, but it helps you answer some of the questions that pop up during the install properly.

I am going to use it for network monitoring, asterisk testing and eventually to replace most of the other servers.

VMWare has a nice directory of submitted “appliances” as they call them. Unfortunately it relies on bit torrent for most of them, which alienates a lot of firewalled potential users. I did find an excellent VMWare network monitoring appliance hosted via http that I am already using. Thanks to Rich Trezza for that. It is a fully functioning nagios installation that works as soon as you turn it on. Nagios is more than a little difficult to set up from scratch.

Local network Ubuntu repository

August 25, 2006 1 comment

If I would have realized how easy this is to do, I would have done it a long time ago. For the price of ~12 GB of disk space, you can easily keep your own mirror of the ubuntu repositories. That takes a significant load off your Internet connection, and greatly speeds up software installations.

This is adapted from here, and here. Replace any reference to “username” with your username.

sudo aptitude install debmirror

Create a directory for the repository:

mkdir /home/username/repos
sudo gedit /bin/repoupdate

Insert the following:

#!/bin/bash -x

/usr/bin/debmirror –nosource -m –passive –host=archive.ubuntulinux.org \
–root=ubuntu/ –method=ftp –progress –dist=dapper \
–ignore-release-gpg –section=main,multiverse,universe,restricted \
–arch=i386 /backups/ubuntu/

Save and close it, then make it executable:

sudo chmod +x /bin/repoupdate

Kick off your update by doing:

sudo repoupdate

It takes a long time to download all the files.

Now you can access it on the same machine by modifying your apt sources.list:

sudo gedit /etc/apt/sources.list

replace:

deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

with:

#deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

deb file:///home/username/repos/repos dapper main universe multiverse restricted

To use it for other machine on the LAN, you’ll need to make it accessible to Apache. Make a symbolic link in the web server directory to your user folder:

cd /var/www/
sudo ln -s /home/username/repos repos

Modify the privs of the user folder:

cd /home/
sudo chgrp www-data username
chmod 770 username

Now you should be able to browse to the directory from http://<ip of computer>/repos

Now you can access it by modifying your apt sources.list:

sudo gedit /etc/apt/sources.list

replace:

deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

with:

#deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

deb http://<ip address>/repos/repos/ dapper main universe multiverse restricted

If you ever mess up your sources.list or just want to start fresh, source-o-matic is a great tool for building a new file.

Categories: DIY, Software, ubuntu

IAX2 Trunking Two Trixbox Servers

August 16, 2006 7 comments

Here is the method I am currently using to connect two trixbox servers. This is all done using freePBX.
Dialing 5XXX on either server reaches extension XXX on the other. This can be modified as needed.

Use find & replace in a text editor to change the actual values:

Server1 : Name of Server1 (arbitrary)
Server2 : Name of Server2 (arbitrary)
Server1IPAddress : ip address of server 1
Server2IPAddress : ip address of server 2
Server1User : user acct for server 1 (arbitrary)
Server2User : user acct for server 2 (arbitrary)
Server1Secret : password for server 1 (arbitrary)
Server2Secret : password for server 1 (arbitrary)

Then you can cut & paste the sections into the proper forms.


Server1 Configuration

Create new IAX2 Trunk: Trunk Name: Server2

Peer Details:
context=from-internal
host=Server2IPAddress
qualify=yes
secret=Server2Secret
type=peer
username=Server2User

User Context: Server1User

User Details:
context=from-internal
host=Server2IPAddress
secret=Server1Secret
type=user

Create outbound route:
Dial Patterns: 5|XXX
trunk Sequence: IAX2/Server2


Server2 Configuration

Create a new IAX2 Trunk: Trunk Name: Server1

Peer Details:
context=from-internal
host=Server1IPAddress
qualify=yes
secret=Server1Secret
type=peer
username=Server1User

User Context: Server2User

User Details:
context=from-internal
host=Server1IPAddress
secret=Server2Secret
type=user

Create outbound route:
Dial Patterns: 5|XXX
trunk Sequence: IAX2/Server1


UPDATE: I have added a post for trunking two trixbox pro servers.

Categories: Asterisk

Firewall Addons for ipcop

August 15, 2006 Leave a comment

The addons server for ipcop is the best way to install dansguardian content filtering. It is called copplus in this context. There are many versions of danguardian installers available on the Internet, and installing an improper version can cause serious compatibility problems with ipcop.

To install, get the Addons installation file to /tmp on the ipcop machine.

From an ssh terminal (the version number in the file name may change):

cd /tmp

tar vxzf addons-2.3-CLI-b2.tar.gz

cd addons

./addoncfg -i

Download the copplus installation file to your local computer. On the IPCop administration page, click on the ADDONS tab, and choose ADDONS. In the bottom section, click on Choose File and choose the copplus file you downloaded, and click Upload. Copplus is > 10MB, so it will take a while. Be patient. It says a reboot is not required, but it was for my system to begin working properly.

Now the kids are safe from google!

Categories: DIY, networking

Asterisk (Trixbox) and NAT

August 13, 2006 Leave a comment

I’ve run into this several times. If an asterisk server is behind a firewall using NAT, you need to modify sip.conf for sip clients to work properly. Without it audio can be one-way or broken altogether.

You’ll need the external hostname of the asterisk server (e.g. asterisk.company.com) external ip of the asterisk server (e.g. 123.123.123.123), and the internal network addressing (e.g. 192.168.1.x with subnet mask of 255.255.255.0)

from a ssh session in terminal:

nano /etc/asterisk/sip.conf

replace contents of file with this:

; Note: If your SIP devices are behind a NAT and your Asterisk
; server isn’t, try adding “nat=1” to each peer definition to
; solve translation problems.

[general]
externhost = asterisk.company.com
externip=123.123.123.123 ; the ip address your ISP gives you
localnet=192.168.1.0/255.255.255.0
nat=yes
port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all ; Modify these to meet your codec needs
allow=ulaw
allow=alaw
allow=g729
allow=gsm

; If you need to answer unauthenticated calls, you should change this
; next line to ‘from-trunk’, rather than ‘from-sip-external’.
; You’ll know this is happening if when you call in you get a message
; saying “The number you have dialed is not in service. Please check the
; number and try again.”
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
tos=0x68

; #, in this configuration file, is NOT A COMMENT. This is exactly
; how it should be.
#include sip_nat.conf
#include sip_custom.conf
#include sip_additional.conf

[control-x to exit, Y to save the file]

amportal stop

amportal start

The last two commands will stop and start your server quickly (and rather rudely to users), so restart asterisk in whatever way makes sense.

For NAT to work for external phones, the extension will need to have nat=yes specified, and the phone will have to have it specified as well. The procedure for different types of phones varies.

Categories: Asterisk, networking

Upgrading Trixbox

August 13, 2006 Leave a comment

First of all, upgrading Trixbox is so easy to do it is amazing. To update from Trixbox 1.0 to 1.1.1 you go to an ssh terminal window and type the following:

rpm -del zaptel-modules-2.6.9-34.EL
rpm -del zaptel-modules-2.6.9-35.EL
yum -y update
trixbox-update.sh
trixbox-update.sh update
reboot
rebuild_zaptel
modprobe wcfxo [if you have zaptel hardware]
modprobe wcfxs [if you have zaptel hardware]
genzaptelconf
reboot

That being said, I have run into a few problems during upgrades.

  1. Music on hold. This is pretty minor, and based on a customization I did, so I am not surprised. The config file got replaced with the default one, so my high quality music was reverted back to the default MP3s. It had to be changed back to the custom version. No big deal.
  2. Content / Virus Filter. If you have a firewall based filter that screens out .sh files (those files can be dangerous), then this method will not work. When the trixbox-update.sh script runs, it first updates itself, and that part can be broken by the filter. Make sure the asterisk machine is exempt from this kind of filtering.
  3. Zaptel and unused T1 card. This one drove me crazy for a few hours. I followed the nerdvittles guide and rebuilt zaptel after running a yum update. Everything seemed fine, until test calls revealed there was no audio. It turns out an unused T1 card caused a configuration problem that ended up with no timing source for calls. I had to disable the drivers in zapata.cong and run genzaptelconf again. Then it was happy. Whew.
Categories: Asterisk, VoIP