Testing voice circuits in Cisco IOS

The easiest way to test outbound calls is to build a simple plain old telephone service (POTS) dial-peer on the voice gateway. For example:

!
dial-peer voice N pots
 destination-pattern 9T
 port X/Y/Z
!

You can use the csim start dialstring hidden command to initiate simulated calls to whichever real-world E.164 number is desired. This allows you to determine whether you can properly go offhook from the router to the PSTN, send digits, and complete a call to the destination phone. You can modify the POTS dial-peer appropriately to account for long-distance access codes and other prefixed digits as necessary. In the example above, the POTS dial-peer can match on any string of digits starting with “9”, and all digits that follow the “9” are played out voice-port X/Y/Z.

On POTS dial-peers, destination-patterns with wildcards have all exact digit matches stripped off. That means on:

!
dial-peer voice X pots
 destination-pattern 1234....
 port 1/0:0
!

when “12345678” comes into the router, it matches with the dial-peer, but only “5678” gets passed onwards to the PBX since the “1234” are exact digit matches and get stripped off. Depending on what your PBX is looking for to be able to route a call, this may be a problem.

Refer to these commands as workarounds:

Any of these now sends the entire string “12345678” off to the PBX:

!
dial-peer voice X pots
 destination-pattern 1234....
 port 1/0:0
 forward-digits all
!

or:

!
dial-peer voice X pots
 destination-pattern 1234....
 port 1/0:0
 no digit-strip
!

or:

!
dial-peer voice X pots
 destination-pattern 1234....
 port 1/0:0
 prefix 1234
!
11 Mar 2010

.bashrc functions to do repetitive tasks

A cool thing to do if you find yourself doing something LOTs of times: Edit your ".bashrc" (in your home directory) and create your personalised script as follows:
wch()
{
sudo chmod 774 $1 $2 $3 $4;
sudo chown www-data.www-data $1 $2 $3 $4;
}
Then you can execute the command "wch" with parameters to execute the commands you want. Very cool...
31 Jan 2010

Using ImageCache and positioning in node output (Drupal)

See "Joe's" comment here: http://drupal.org/node/139915 Go to [Content management] > [Content types] > [Manage fields] and make sure yiour image field is LIGHTER than [body] eg -2 this will force the image above your teaser but not yet inline then go to modules > system > defaults.css and add
.field-type-image img {
float: right;
margin-left: 1em;
border: 0px solid red;
}
Note: my CCK image field is called "image" and I choose to float it right, adjust yours to suit your tastes.
31 Jan 2010

Enabling TELNET in Windows 7

It turns out that by default TELNET was not packaged with Windows 7. Apparently this was also true for Windows Vista. Telnet is known to be insecure and so by default, Microsoft now DISABLES any likely security holes. Whenever you can, you should always use SSH. That being said, you can enable Telnet this way:

  1. Start
  2. Control Panel
  3. Programs And Features
  4. Turn Windows features on or off
  5. Check Telnet Client
  6. Hit OK

After that you can start Telnet via the "CMD" - Command Prompt.

27 Jan 2010

how to build a DRUPAL Ubuntu Server from scratch

Fantastic writeup of how to build a DRUPAL Ubuntu Server from scratch:
http://2bits.com/articles/installing-a-dedicated-server-or-a-vps-with-ubuntu-server-804-lts-hardy-heron-drupal-6x.html

Besides its success on the desktop, Ubuntu has become a popular server distribution as well. With the release of Hardy Heron 8.04, Canonical is making this release a Long Term Support (LTS) version, with 5 years support on servers.

Many hosting companies offering dedicted and virtual private servers (VPS) offer Ubuntu as an option. That is not a surprise, because Ubuntu provides all the benefits that Debian provides: community maintained, vast repository of software packages, and superior dependency management, with more up to date packages.

Drupal runs best on the LAMP stack (Linux, Apache, MySQL, PHP). This article describes how to setup Ubuntu Server 8.04 LTS for use with Drupal, making sure all the required software is configured, with special tweaks for performance and development.

The article assumes that this is either a dedicated server, or a VPS. The usage of the server can be either a live server, or a development machine.

Installing Ubuntu Server

If you are on a VPS provided by a hosting company, they would have installed Ubuntu for you from images they maintain. Therefore, you can skip this section if you are using a VPS.

Install Ubuntu normally using the installation instructions on Ubuntu's web site.

When you reach the stage of selecting a Package Task, only select OpenSSH server. Do not select LAMP server nor Mail server. We will do those manually later, in order to control exactly what gets installed.

Configuring a Static IP address

Note: If you are on a VPS, skip this section. In fact, you can lose access to your server inadverently if you make a mistake here.

When the system reboots, you need to assign a static address to it if it is a live server.

Edit the file /etc/network/interfaces to be as follows. Replace the IP address in the address and gateway with the correct values.

auto eth0
iface eth0 inet static
address 192.168.0.240
netmask 255.255.255.0
gateway 192.168.0.1

Restart the networking stack.

# /etc/init.d/networking restart

If this is a remote server, with no console access, then it is best if you double check the settings and reboot instead of restarting the network.

Update to the latest packages

If you are installing from a CD, then the repository would have updated packages that are more recent than the ones on your CD. Before we install any software, let us make sure that we have the latest packages

# aptitude update && aptitude dist-upgrade

If the upgrade includes new kernel versions, we need to reboot now, so that we don't have to do it later.

# shutdown -r now

Install Apache, MySQL and PHP5

We now proceed with installing Apache, MySQL and PHP5 (the AMP part of the LAMP software stack).

For a mail server, we first install postfix as a personal preference. Ubuntu provides exim4 by default. If you are more comfortable with exim4 as a mail server, then skip this step. Ubuntu will install exim4 as part of the LAMP stack automatically.

# aptitude install postfix

When prompted, select "Internet site".

Then we install Apache2:

# aptitude install apache2 apache2-threaded-dev

After that we install the MySQL database server:

# aptitude install mysql-server

When asked for a root password for MySQL, just hit Enter.

And then we follow that by PHP5, PHP5's image handling (gd) and its connection to MySQL:

# aptitude install php5 php5-gd php5-mysql

Finally, we install a few packages that would allow us to install things from PHP's PECL and PEAR repositories. This would make installing apc and xdebug far easier than doing that from source.

# aptitude install php5-dev php-pear make

Optional: Install APC

If this is a live server, it is recommended that you install APC to boost PHP's performance.

# pecl install apc

Create a config file for it named /etc/php5/conf.d/apc.ini

Put the following lines in it:

extension=apc.so
apc.shm_size=40

Optional: Install XCache

Alternatively, you can use the XCache op-code cache.

# aptitude install php5-xcache

For more details check our article on configuring XCache.

Optional: Install Xdebug

If this is a development server, you may want to install Xdebug if you are using a development environment that supports it.  It helps with debugging and profiling PHP applications.

Different IDEs like Komodo, Eclipse and even vim have support for Xdebug.

# pecl install xdebug

We have an article on using vim and Xdebug for debugging Drupal that you may want to check.

Increase the memory for PHP

Ubuntu has changed the default for PHP's maximum memory size for scripts often. It used to be 8MB, then was pushed to 128MB with 7.10, and now with 8.04, it is back to 16MB. While this is adequate for Drupal's core, installing several contributed modules will often exhaust that. So start with 32MB by editing the file /etc/php5/apache2/php.ini and change the memory_limit line to:

memory_limit = 32M

Configure Apache's mod_rewrite

Drupal's Clean URLs are a very useful feature. It requires the Apache mod_rewrite.

First, enable the Apache module by executing this command:

# a2enmod rewrite

Then, edit the file /etc/apache2/sites-enabled/000-default, and change this section:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

So the line will be:

AllowOverride All

More Apache Configuration

There are a few Apache modules that are not really needed. We better disable them to save some memory.

# a2dismod cgi
# a2dismod autoindex

We may also get better performance if we compress the HTML before we send it to the browser. For this we enable the deflate module.

# a2enmod deflate

Finally, restart Apache

# /etc/init.d/apache2 restart

Download and Extract Drupal

First download Drupal by doing this:

# cd /tmp/
# wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-6.2.tar.gz

Then extract the tarball

# cd /var/www/
# tar xzvf /tmp/drupal-6.2.tar.gz

Move the files to the web root of the server

# mv drupal-6.2/* /var/www

And don't forget the hidden file ...

# mv drupal-6.2/.htaccess /var/www

Remove the file index.html, so Drupal's index.php will be the one that is executed by Apache

# rm index.html

Then change the permissions of the directory to the user that Apache runs as: www-data

# chown -R www-data:www-data /var/www

Create the Drupal database

The following command will create a database for Drupal:

# mysqladmin create db

Then grant privileges to it:

# mysql
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
ON databasename.*
TO 'username'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

Installing Drupal

We are now ready to install Drupal.

Point your browser to the server (e.g. http://example.com) and you should be greeted by Drupal's installer.

You will need to use the following values:

  Database name: db

  Database user name: user

  Database password: something

Enjoy ...

20 Jan 2010

Microsoft SQL Server version checking

You can run the following SQL Query to determine the running Version of SQL Server 2005: "SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')"
Release	Sqlservr.exe
RTM	2005.90.1399
SQL Server 2005 Service Pack 1	2005.90.2047
SQL Server 2005 Service Pack 2	2005.90.3042
SQL Server 2005 Service Pack 3	2005.90.4035
If you get an error message that "Agent XPs" have not been enabled, you can execute these commands in the SQL Management Studio: You can enable Agent Xp's in sql server 2005. Run the below query in management studio to enable agent xp's. sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Agent XPs', 1; GO RECONFIGURE GO
10 Jan 2010

DNS Event ID 6702

I get these errors regularly in the Windows Server 2003 Event Log: Event Type: Error Event Source: DNS Event Category: None Event ID: 6702 Date: 12/31/2009 Time: 4:37:05 PM User: N/A Computer: XXXX Description: DNS server has updated its own host (A) records. In order to ensure that its DS-integrated peer DNS servers are able to replicate with this server, an attempt was made to update them with the new records through dynamic update. An error was encountered during this update, the record data is the error code. If this DNS server does not have any DS-integrated peers, then this error should be ignored. Note that this particluar server IS standalone, so according to the above, the message should be ignored. Start -> run -> regedit -> HKEY_LOCALMACHINE/SYSTEM/CurrentControlSet/Services/Netlogon/Parameters/DnsRefreshInterval -> set the value 86400 -> Exit
05 Jan 2010

RFC 1918 - Private IPV4 Addresses

The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets:
  • 10.0.0.0 - 10.255.255.255 (10/8 prefix)
  • 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
  • 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
13 Dec 2009

BGP Prefix List (for route filtering)

To filter routes 41.0.0.0 and 42.0.0.0 from bgp route declarations outgoing from RTR_SYDNEY :
RTR_SYDNEY(config)#ip prefix-list FILTER1 deny 41.0.0.0/8
RTR_SYDNEY(config)#ip prefix-list FILTER1 deny 42.0.0.0/8
RTR_SYDNEY(config)#ip prefix-list FILTER1 permit 0.0.0.0/0 le 32
RTR_SYDNEY(config)#router bgp 777
RTR_SYDNEY(config-router)#neighbor 172.12.123.1 prefix-list FILTER1 out

RTR_SYDNEY#clear ip bgp * soft
13 Dec 2009

IPV6 Address Space - It's BIG

I thought this was an interesting analogy for the IPV6 Address Space: From: http://www.cedmagazine.com/ipv6-a-catalyst-for-service-growth.aspx Putting the contrast into perspective, if one IPv4 address was one picometer (one trillionth of a meter) long, the entire IPv4 address space would be approximately 4.3 millimeters long–the length of an average-sized ant. If an IPv6 address were one picometer long, the length of the entire IPv6 address space would be approximately 3.4 billion trillion trillion kilometers, or 36 billion light years. The farthest visible object in the universe from the Earth is estimated to be 30 billion light years away. That's a very long distance; that's a great many IP addresses.
07 Dec 2009
Subscribe to