frame relay switch – create a config

Hello,
for my new frame relay switch I was looking for a full mesh configuration. With this I could create different logical connections between the routers using frame relay just by changing the configuration.

My new frame relay switch is a Cisco 2520 router with 4 serial interface called Serial0, Serial1, Serial2 and Serial3. The configuration for 4 interfaces is not so hard, but I wanted to be flexible for the future (maybe only 3 or maybe a new router with up to 8 serial interfaces).

So I created the following perl script to create the configuration for a frame relay switch.

#!/usr/bin/perl -w
# frs_conf.pl
# 20120216 crissa for http://blog.rotten.li

use strict;

# main
{
  my $first     = 0;        # start with interface 0
  my $last      = 3;        # 4 interfaces (0 - 3)
  my $interface = "Serial"; # "Serial" or "Serial0/" or ...

  # to avoid problems with the dlci for interface 0
  $first++;
  $last++;

  print "!\n";
  print "! config created by frs_conf.pl (http://blog.rotten.li)\n";
  print "!\n";
  print "frame-relay switching\n"; # switch on frame relay
  print "!\n";

  for (my $i = $first; $i <= $last; $i++) {
    printf "interface %s%d\n", $interface, ($i - 1);
    printf " description %d0x\n", $i;

    print <<END;
 bandwidth 64
 no ip address
 encapsulation frame-relay
 no ip route-cache
 logging event subif-link-status
 logging event dlci-status-change
 clock rate 64000
 cdp enable
 no frame-relay inverse-arp
 frame-relay intf-type dce
END

    for (my $j = $first; $j <= $last; $j++) {
      next if ($i == $j); # no route to ourself

      printf " frame-relay route %d0%d interface Serial%d %d0%d\n", \
             $i, $j, ($j-1), $j, $i;
    }

    print "!\n";
  }
}
# main

# eof

And here is the output for my Cisco 2520 router.

!
! config created by frs_conf.pl (http://blog.rotten.li)
!
frame-relay switching
!
interface Serial0
 description 10x
 bandwidth 64
 no ip address
 encapsulation frame-relay
 no ip route-cache
 logging event subif-link-status
 logging event dlci-status-change
 clock rate 64000
 cdp enable
 no frame-relay inverse-arp
 frame-relay intf-type dce
 frame-relay route 102 interface Serial1 201
 frame-relay route 103 interface Serial2 301
 frame-relay route 104 interface Serial3 401
!
interface Serial1
 description 20x
 bandwidth 64
 no ip address
 encapsulation frame-relay
 no ip route-cache
 logging event subif-link-status
 logging event dlci-status-change
 clock rate 64000
 cdp enable
 no frame-relay inverse-arp
 frame-relay intf-type dce
 frame-relay route 201 interface Serial0 102
 frame-relay route 203 interface Serial2 302
 frame-relay route 204 interface Serial3 402
!
interface Serial2
 description 30x
 bandwidth 64
 no ip address
 encapsulation frame-relay
 no ip route-cache
 logging event subif-link-status
 logging event dlci-status-change
 clock rate 64000
 cdp enable
 no frame-relay inverse-arp
 frame-relay intf-type dce
 frame-relay route 301 interface Serial0 103
 frame-relay route 302 interface Serial1 203
 frame-relay route 304 interface Serial3 403
!
interface Serial3
 description 40x
 bandwidth 64
 no ip address
 encapsulation frame-relay
 no ip route-cache
 logging event subif-link-status
 logging event dlci-status-change
 clock rate 64000
 cdp enable
 no frame-relay inverse-arp
 frame-relay intf-type dce
 frame-relay route 401 interface Serial0 104
 frame-relay route 402 interface Serial1 204
 frame-relay route 403 interface Serial2 304
!

If the first router is connected to port Serial0 and the second router is connected to port 3 of the frame relay switch you have to use "1" for the first and "4" for the second router. So the "frame-relay interface-dlci" value for the first router is 104 and for the second 401. (The "0" is just a separator.)

HTH!
Bye, Tore



Posted in Cisco, General | Tagged , , , , | Leave a comment

iPhone – the fischertechnik stand

Hello,
some iPhone stands are really expensive and I was looking for one that will also work with my current and maybe also with my next iPhone. Not to forget that I use an iPhone protection case and that I want to charge and sync it while it is in the stand next to my computer.

So I used some fischertechnik parts to build a stand.

It is heavy enough for the iPhone and there is even room for the charge/sync cable.

With the stand it is more comfortable to read SMS and other notifications while it is connected to the computer. So before you consider to buy an expensive stand have a look and use some fischertechnik or Lego parts to build you own stand.
Bye, Tore

Posted in General, iPhone | Tagged , | Leave a comment

sispmctl – control a terminal server

Hello,
a terminal server is very useful in a Cisco lab. To be usefull it should be up and running, but keep it switched on 24/7 is not an option in a home lab. With a Gembird SIS-PM programmable power outlet it could be switched on when its needed and switched off if the lab is done and it is time to go to bed or to work (after a long night of configuring, testing and debuging).

This post is a followup to this three posts:

I created two scripts , one to switch the the terminal server on and one to switch it off.

#!/bin/sh
# r2511a_on
# 20120211 crissa for http://blog.rotten.li

if [ `sispmctl -q -n -g 4` == "0" ]
then
  echo "r2511a: status off"

  sispmctl -q -o 4

  echo "r2511a: switched on, booting ..."
  sleep 60

  export FTOO=1
fi

if [ `sispmctl -q -n -g 4` == "1" ]
then
  if [ `alive r2511a` == "0" ]
  then
    echo "r2511a: status on and alive!"
  else
    # echo "r2511a: status on and not alive"

    while [ `alive r2511a` == "1" ]
    do
      # echo "wait 10 sec ..."
      echo "r2511a: status on and not alive, wait 10 sec ..."
      sleep 10
    done

    if [ "$FTOO" == "1" ]
    then
      echo "r2511a: wait 30 sec ... (almost there)"
      sleep 30
    fi

    echo "r2511a: status on and alive!"
  fi
fi

# eof

The terminal server, a Cisco 2511 router, needs around 90 to 100 seconds to boot, so script sleeps for 60 seconds after the terminal server was switched on. If the terminal server is already running the script will return to the shell prompt without further delay. The router can’t be reached by telnet as soon as it is ping able, it still has some work to do, so the script sleeps for 30 seconds.

#!/bin/sh
# r2511a_off
# 20120211 crissa for http://blog.rotten.li

if [ `sispmctl -q -n -g 4` == "1" ]
then
  echo "r2511a: status on"

  CNT=`snmpwalk -v 2c -c public r2511a 1.3.6.1.4.1.9.2.9.2.1.1 | grep "INTEGER: 1" | wc -l`
  while [ $CNT -gt 0 ]
  do
    echo "r2511a: status on, $CNT user(s) connected, waiting 20 sec ..."
    sleep 20
    CNT=`snmpwalk -v 2c -c public r2511a 1.3.6.1.4.1.9.2.9.2.1.1 | grep "INTEGER: 1" | wc -l`
  done

  sispmctl -q -f 4

  echo "r2511a: switched off, wait 5 sec ..."
  sleep 5
fi

if [ `sispmctl -q -n -g 4` == "0" ]
then
  echo "r2511a: status off"
fi

# eof

Instead of just switching the terminal server off the script first checks if the terminal server is used. As long as it is used the script will check, sleep, check again, sleep again and so on. As soon as the terminal server is unused the script will switch off the terminal server.

The main reason for this scripts was to use the terminal server while I’m not at home. The terminal server is always connected to port 4 of the power outlet. I use port 3 of the power outlet to switch on and off my current lab (at the moment two Cisco 1712 routers and one Cisco 2520 router).

HTH!
Bye, Tore

Posted in Cisco, General, Linux | Tagged , , , , , | Leave a comment

Using ipcheck to update your dyndns entry

Hello,
last night my Fritz!Box router failed to update my dyndns entry and so I couldn’t reach my private network during the day. One suggestion from helpful people was to mail the outside IP address to myself. Too easy!

A script that checks the current dyndns entry and compares it with the current outside IP address of my router and that updates the dyndns entry if the IP addresses differ would be more useful. (For my example scripts I used “myip.example.local” instead of my own dyndns entry!)

1. Get the current dyndns IP address

#!/bin/sh

HOST=`host myip.example.local | awk '{print $4}'`
echo $HOST

# eof

The output of host is “myip.example.local has address 192.168.168.192″ and with awk we get the IP address “192.168.168.192″. This output is assigned to HOST for later use, in this example to echo it so the little script creates an output.

2. Get the current outside IP address of the router

#!/bin/sh

unset http_proxy
CHECKIP=`lynx -source http://checkip.dyndns.org | \
         tidy --file /dev/null | \
         grep Address | awk '{print $4}'`
echo $CHECKIP

# eof

With “unset http_proxy” the enviroment variable http_proxy is unset so lynx will not use the proxy. Otherwise we would get the IP address of the proxy as result. With tidy we get the IP address on a single line without the whole HTML stuff and finaly grep and awk extract the IP address from the output.

3. Some preparation

Before the first use of ipcheck we should create an own directory for it and we need to call it with the parameter “–makedat”.

#!/bin/sh

unset http_proxy
cd /home/crissa/tmp
mkdir ipcheck
cd ipcheck
/usr/sbin/ipcheck --makedat -l -r checkip.dyndns.org \
                  username password myip.example.local

# eof

4. Update the dyndns entry

#!/bin/sh

unset http_proxy
cd /home/crissa/tmp/ipcheck
/usr/sbin/ipcheck -l -r checkip.dyndns.org \
                  username password myip.example.local

# eof

I used “apt-get install ipcheck” to install the packet on my Debian box. I used ipcheck and not ddclient as I never used ipcheck before. With “apt-cache search dyndns” you will find this two and other packets that should be able to update a dyndns address.

5. The complet script

#!/bin/sh

if [ `alive 8.8.8.8` == "0" ]
then
  HOST=`host gasit.dyndns.org | awk '{print $4}'`
  # echo $HOST

  unset http_proxy
  CHECKIP=`lynx -source http://checkip.dyndns.org | \
           tidy --file /dev/null | \
           grep Address | awk '{print $4}'`
  # echo $CHECKIP

  if [ "$HOST" == "$CHECKIP" ]
  then
    echo "myip.example.local is uptodate!"
  else
    cd /home/crissa/tmp/ipcheck
    /usr/sbin/ipcheck -l -r checkip.dyndns.org \
                      username password myip.example.local
  fi
fi

# eof

I used alive English to check if the Google nameserver is alive. If it is not alive aka not reachable the script will do nothing. This command should be enough to check if you are online or not.

Now the script gets the current dyndns address and the outside IP address of the router and compares them. If they aren’t equal ipcheck will update the dyndns entry.

By the way, have a look into the ipcheck directory and the files in there, ipcheck is also doing some checks so it only updates the dyndns entry if the IP address has changed. So the script under “4.” should do the trick. (But I hope the rest of this article is also useful to you!)

HTH!
Bye, Tore

Posted in General, Linux | Tagged , , , | Leave a comment

Hide a Token Ring router

Hello,
my current frame relay switch is a Token Ring router (see My current lab English). Once a frame relay switch is configured there is no need to reach it any more. But what about messages on the main syslog server from the frame relay switch and the correct time on the this switch. Not so easy for a Token Ring router in an Ethernet router environment.

The solution is easy (it is always easy when you are writing a blog post about a problem that you already solved). My frame relay switch is a Cisco 2521 and this is, you will guess it, a Token Ring router. I also use a Cisco 2501 router in my lab. Both routers have an AUX port and so I connect both routers together using a (so called) rollover English cable. For the configuration that enables routing on both AUX ports see Using the AUX port to connect two routers English.

On the Token Ring router (aka frame relay switch aka 2521) we need two static routes.

ip route 192.168.1.0 255.255.255.0 Async4
ip route 0.0.0.0 0.0.0.0 192.168.1.1

The first route is a static route to my Ethernet network and the second a static route to the default gateway of this network. (The IP address 192.168.1.1 belongs to my DSL router.)

On the other router (aka 2501) we need three extra lines to hide the Token Ring router.

!
interface Ethernet0
 [...]
 ip nat outside
 [...]
!
interface Async1
 description from aux to aux r2521a
 ip address 192.168.255.253 255.255.255.252
 ip nat inside
 [...]
!
ip nat inside source static 192.168.255.254 192.168.1.254
!

Yes, it is only a simple “static nat insde” line. But this line does the trick! With this trick the Token Ring router is hiding behind an IP address that belongs to my Ethernet IP address range.

HTH!
Bye, Tore



Posted in Cisco, General | Tagged , , , | Leave a comment

My current lab

Hello,
my current Cisco lab.

On the left two 1712 routers and on the right from the top: A 2520 router, a 2511 terminal server, two 2950 switches and a 3548 switch. The 2520 is the latest addition to the lab, the plan is to use it as new or second frame relay switch.

Four 3640 routers, the three at the buttom are conncted as triangle.

From the top: A hub, two 2516 routers, a 2501 and a 2521 router. The 2521 is configured as a frame relay switch.

And two 1121G accesspoints as well as one 1720 router (not in the pictures).
Bye, Tore

Posted in Cisco, General | Tagged | Leave a comment

Using the AUX port to connect two routers

Hello,
the AUX port on a Cisco router is seldom used, but it can be useful as an extra connection between two routers in a lab environment. For this example I used two Cisco 2516 router. The first step is to configure the AUX port.

line aux 0
 modem InOut
 no exec
 transport input all
 speed 38400

The second step is two check which line number correspond to the AUX port.

r2516a#show line
   Tty Typ     Tx/Rx    A Modem  Roty AccO AccI   Uses   Noise  Overruns   Int
*    0 CTY              -    -      -    -    -      0       1     0/0       -
A    1 AUX  38400/38400 - inout     -    -    -      1       0     0/0       -
     2 VTY              -    -      -    -    -      0       0     0/0       -

On this Cisco 2516 router line 1 is used for the AUX port. Third step, configure the async1 interface on the first router (called r2516a).

interface Async1
 description from aux to aux r2516b
 ip address 192.168.255.249 255.255.255.252
 encapsulation ppp
 async default routing
 async mode dedicated
 cdp enable
end

Same AUX port configuration and same line number on the other router. The other router (called r2516b) has of course the other IP address of the /30 network that is used for the point to point connection.

interface Async1
 description from aux to aux r2516a
 ip address 192.168.255.250 255.255.255.252
 encapsulation ppp
 async default routing
 async mode dedicated
 cdp enable
end

Fourth step, check the interfaces:

r2516a#sh ip int brief | i Async1
Async1                     192.168.255.249 YES NVRAM  up                    up
r2516b#sh ip int brief | i Async1
Async1                     192.168.255.250 YES NVRAM  up                    up

Fifth and last step, ping the IP address of the other site:

r2516a#ping 192.168.255.250

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.255.250, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/80/88 ms
r2516b#ping 192.168.255.249

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.255.249, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/80/84 ms

For this example I used a slow speed on the AUX port, you could try 57600 or even 115200. I used a short (only 20 cm) rollover cable English to connect the two routers.

By the way, Cisco calls this method of connecting two routers via the AUX port a back-to-back English connection.
Bye, Tore

Posted in Cisco, General | Tagged , , , | Leave a comment

%cdp-4-duplex_mismatch

Hello,
when you use older Cisco routers together with more update routers in the same ethernet network and you are using CDP (Cisco Discovery Protocol) you maybe familiar with the following message.

000042: Jan 13 21:22:23.001: %CDP-4-DUPLEX_MISMATCH: duplex
mismatch discovered on FastEthernet0 (not half duplex), with
r2511a.arbzim.bogus Ethernet0 (half duplex).

I found this message on a Cisco 1712 router with a FastEthernet interface that saw a Cisco 2511 router with a Ethernet interface on the same Ethernet network. As not using CDP wasn’t an option and I couldn’t set the Ethernet interface on the Cisco 2511 router to full duplex and I don’t want to set the full duplex interface on the Cisco 1712 router to half duplex I searched for another solution.

Here are two commands that can’t solve the duplex mismatch problem but at least can prevent the duplex mismatch messages.

  • no cdp advertise-v2 English
  • This disables the duplex mismatch message. But it also disables the VTP Management Domain Name and Native VLAN messages. The advantage is that you only need to configure it on the router where you can’t fix the duplex setting on the interface (in my case the Cisco 2511 router).

  • no cdp log mismatch duplex English
  • This command only disables the duplex mismatch message. The advantage of this command is that you can configure it global or only on the (Ethernet) interface where you need it. The disadvantage is that you have to configure it on both routers (in my case on the Cisco 2511 router and on the Cisco 1712 router where I found the message).

HTH!
Bye, Tore

Posted in Cisco, General | Tagged , , | Leave a comment

Snow Leopard – Let’s Scan Again

Hello,
I don’t know why Apple use such names like Panther, Tiger or Leopard for their Mac OS X software. Don’t get me wrong, I like this names. But why on earth do they call one version Leopard and the next version Snow Leopard? Sometimes searching for a solution for a Snow Leopard problem isn’t easy. But sometimes life is easy …

I own a Canon LiDE 60 scanner and guess what: It didn’t work under Snow Leopard. My search for a current software started at Canon Global English. After some choosing and scrolling I found cstbosx4934ej4.dmg and lide60osx11131en.dmg. I first installed the toolbox and after that the driver. After a reboot I did some test scans without any problems. The scan buttons on the scanner still work as expected.

Here is the link: Canon U.S.A. : Support & Drivers : CanoScan LiDE 60 English.
Bye, Tore



Posted in General, Mac OS X | Tagged , , , | Leave a comment

sispmctl – light (on|off|toggle|state)

Hello,
this is a followup to the posts sispmctl English and sispmctl – using it as non root English. With this script we can switch the light on and off, toggle it and check the current state.

This shell script shows how to

  • check the parameters
  • use or with if
  • use echo without creating a new line
  • use sispmctl

Here we go:

#!/bin/sh
# light
# 20110112 crissa for http://blog.rotten.li

if [ "$#" == "1" ]
then
  if [ "$1" == "on" ] || [ "$1" == "-o" ]
  then
    if [ `sispmctl -q -n -g 1` == "0" ]
    then
      sispmctl -q -o 1
      echo "light: switched on"

      sleep 3
    else
      echo "light: the light is on"
    fi
  elif [ "$1" == "off" ] || [ "$1" == "-f" ]
  then
    if [ `sispmctl -q -n -g 1` == "1" ]
    then
      sispmctl -q -f 1
      echo "light: switched off"

      sleep 3
    else
      echo "light: the light is off"
    fi
  elif [ "$1" == "toggle" ] || [ "$1" == "-t" ]
  then
    echo "light: toggle"
    sispmctl -q -t 1
    echo -n "light: the light is "
    sispmctl -q -g 1

    sleep 3
  elif [ "$1" == "state" ] || [ "$1" == "-s" ]
  then
    echo -n "light: the light is "
    sispmctl -q -g 1
  else
    echo "light (on|off|toggle|state)"
  fi
else
  echo "light"
  echo "light on     or light -o to switch light on"
  echo "light off    or light -f to switch light off"
  echo "light toggle or light -t to toggle light"
  echo "light state  or light -s to get light state"
fi

# eof

The script checks the current state before it switches the light on or off. Why switch the light on if it is already on? At the moment I don’t know how toggle could ever be useful. But the current state is useful if you aren’t in the same room as the power outlet and the light!
Bye, Tore

Posted in General, Linux | Tagged , , , , , | Leave a comment