niedziela, 26 grudnia 2010

Knoppix: Boot problems on Amilo L6820

Today I was to repartition the harddrive on a FujitsuSiemens Amilo L6820 laptop (completely remove the partitions containing some old linux) and needed to boot from the Knoppix boot DVD. Unfortunately boot with the default options ended with a black screen (no response from the OS). After some googling I found a very useful page that describes the boot options available for Knoppix.

At first I took the advice from the Tips&Tricks section marked as helpful for laptops:
boot: knoppix acpi=off pnpbios=off noapic noapm
However this did not solve all my problems - I mean the start up was much better namely I was able to see the prompt (bash shell) but still while booting the X windows server the OS hung.

Since I was able to see the prompt I decided to start the Knoppix only in the text mode as below:
boot: knoppix 2 acpi=off pnpbios=off noapic noapm
2 - stands for the Runlevel 2, Textmode only

With these settings I have succesfully started the Knoppix and was able to proceed to my real tasks ;) Actually the settings did not solve the X window problems but I did not need it...

Ruby: Mocks and stubs

Recently I was looking for a description on how to execute unit tests in Ruby with mocks and stubs and was not able to easily find a helpful answer. First of all I wanted to mock the access to the database (ActiveRecord) and stub methods for accessing/finding the data.

Mocks

Ruby provides support for mocking with the rspec:mocks module. Below I enclose an example how to mock access to the db for a simple activerecord object:
  1. ActiveRecord object is defined as follows:
    class Ipv4Stats < ActiveRecord::Base
    has_one :ipregistry
    end
  2. Mock the Ipv4Stats object in spec file as below:
    new = mock(:ipv4stats,
    { :registry_id => reg_id, :date1 => date1, :date2 => date2,
    :ipv4_sum => ipv4_sum, :prefix_ipv4 => ipv4_prefix })

The newly created new object will contain the mocked version of the Ipv4Stats.

Stubs

In the same module (rspec:mocks) Ruby provides means for stubbing. Below I enclose an example how to stub a find method - I still have not found a way to stub the find method with parameters:

  1. The ActiveRecord object is defined as below:
    class IpRegistry < ActiveRecord::Base
    belongs_to :ipv4stats
    end
  2. The stub looks like:
    IpRegistry.stub!(:find).and_return(0)
It is also possible to give more criteria for stubs like in the examples below:

1. Different return values based on the parameters:

@stub_handler.stub!(:getRegistryById).with(1).and_return(@rirs[0])
@stub_handler.stub!(:getRegistryById).with(2).and_return(@rirs[1])

2. Number of expected invocations with specific parameters:
drawer.should_receive(:insertChartDataForRegistry).with(g,0).exactly(registries.size).times

As soon as I make or get to the tests where the database find access based on the argument is required I will extend this article.

sobota, 30 października 2010

Network: IPv4 statistics - end of October summary

I have checked the assignments in all registries again today and it seems that comparing to the previous post the number of /8 networks was increased by 1 for: apnic, arin and afrinic (in total 3 new /8 subnets are assigned since August 2010). The total number of available /8 networks has decreased to 29. The current statistics are presented on the pie chart below:

I have also compared the forecasts (against the exponential trend line from this post) and the result has been presented on the figure below. The date is still 1Q 2013 (shortened by 8 days since last estimation).

niedziela, 12 września 2010

Solaris 10 u9 - jumpstart flash installation

  1. Creating flash archive

  2. For creating the flar archive for the root filesystem one should reboot the system into single user mode or if not possible disable as much application as possible (to avoid changes on the filesystem done during archive creation). The command below create the flar archive in the /export/flash directory. The archive is to be compressed (-c), without /export/flash directory (-x):

    # mkdir /export/flash
    # cd /export/flash
    # flarcreate -n flash_all -c -R / -x /export/flash inst_x86


  3. Copy flar image to the jumpstart server
  4. Configuring jumpstart

  5. The initial configuration of the jumpstart server has been described in my previous post. The only configuration change is referred to the profile:

    # cat x86-class
    install_type flash_install
    archive_location nfs 192.168.1.135:/export/home/install/flash/inst_x86
    partitioning explicit
    filesys mirror c1t0d0s0 c1t1d0s0 5120 /
    filesys mirror c1t0d0s1 c1t1d0s1 2048 swap
    filesys mirror c1t0d0s4 c1t1d0s4 6656 /var
    filesys mirror c1t0d0s5 c1t1d0s5 6656 /usr
    filesys mirror c1t0d0s6 c1t1d0s6 10240 /export
    filesys mirror c1t0d0s7 c1t1d0s7 free /u01
    metadb c1t0d0s3 count 5
    metadb c1t1d0s3 count 5


    Please double check if the flar archive directory is available via NFS otherwise the client will not be able to access it during jumpstart installation.

  6. Start the client machine
Now the automatic installation from the flar archive should be started. As far as the time is concerned - in my case it took about 30 minutes for the same installation as in the jumpstart article and 30 minutes for creating the archive. I will summarize both methods in separate article - right now I have to go to sleep ;)

Solaris 10 u9 Jumpstart

I had to do some investigation on installation procedures for installation of Solaris 10 on multiple machines and therefore wanted to refresh my knowledge on jumpstart and flash installation procedures. Since I do not own too much hardware to be sacrifaced for such experiments I decided to use virtualized one.


  1. Installation of virtualized jumpstart server - using standard installation from DVD using Core installation. In order to setup the jumpstart server one needs to install following additional packages:

    • bash (SUNWbash)

    • zsh (SUNWzsh)

    • java (SUNWj5rt, SUNWj6rt)

    • man+doc (SUNWdoc,SUNWman)

    • dhcp server (SUNWdhcsu, SUNWdhcsr, SUNWdhcm - optional)

    • install software e.g. chkprobe (SUNWinst)

  2. Mount installation DVD - in my case the cdrom was available as c0t0d0s0 and I mounted it under /cdrom (previously created) using:

  3. # mount -F hsfs -o ro /dev/dsk/c0t0d0s0 /cdrom

  4. Setup install server

  5. #cd /cdrom/Solaris_10/Tools
    #./setup_install_server /export/home/install


  6. Add client machine for installation


  7. Now you need to add client definition:

    # cd /export/home/install/Solaris_10/Tools
    # ./add_install_client \
    -d \
    -e 00:0c:29:04:b8:63 \
    -s 192.168.1.135:/export/home/install \
    -c 192.168.1.135:/export/home/config \
    -p 192.168.1.135:/export/home/config/ i86pc


    Very important is to leave the path to the sysidcfg without the file itself (last parameter) - otherwise it will not be used during jumpstart. Of course you need to adapt the IP addresses and MAC address of the client machine to your needs.
    It is important to store the info that will have to be used for the boot configuration:

    Boot server IP (BootSrvA) : 192.168.1.135
    Boot file (BootFile) : 01000c2904b863


  8. Set up sysidcfg

  9. Create the sysidcfg file for the client. Below I enclose the content of my file - the most important is the new property introduced in the Solaris 10 update 9: auto_reg. On the basis of this property the decision will be made if to send registration info to Oracle about the product and the user. I decided to completely disable this feature.

    # cd /export/home/config
    # cat sysidcfg
    keyboard=US-English
    nfs4_domain=dynamic
    system_locale=en_US.ISO8859-1
    timezone=US/Pacific
    timeserver=localhost
    terminal=vt100
    name_service=NONE
    security_policy=NONE
    service_profile=limited_net
    root_password=
    network_interface=e1000g0 { dhcp
    protocol_ipv6=yes
    }
    auto_reg=disable

  10. Configure DHCP

  11. Set up the DHCP server:
    # dhcpconfig -D -r SUNWfiles -p /var/dhcp
    Created DHCP configuration file.
    Created dhcptab.
    Added "Locale" macro to dhcptab.
    Added server macro to dhcptab - voyin.
    DHCP server started.
    # svcs dhcp-server
    STATE STIME FMRI
    online 14:16:10 svc:/network/dhcp-server:default

    Enable the PXE boot:
    # dhtadm -A -m 01000c2904b863 -d ':BootFile="01000c2904b863":BootSrvA=192.168.1.135:'

    Configure the static IP address to be assigned to the client machines:
    # pntadm -C 192.168.1.0
    # pntadm -A 192.168.1.45 \
    > -f PERMANENT \
    > -i 01000c2904b863 \
    > -m 01000c2904b863 \
    > -s 192.168.1.135 \
    > 192.168.1.0
    # pntadm -P 192.168.1.0
    Client ID Flags Client IP Server IP Lease Expiration Macro Comment
    01000C2904B863 00 192.168.1.45 192.168.1.135 09/12/2010


  12. Configure NFS

  13. You need also to share the direcotries with the configuration and installation packages via NFS so that all these will be available to the client machines during jumpstart installation:

    # vi /etc/dfs/dfstab
    ..
    share -F nfs -o ro,anon=0 /export/home/install
    share -F nfs -o ro,anon=0 /export/home/config
    # shareall
    # share
    - /export/home/install ro,anon=0 ""
    - /export/home/config ro,anon=0 ""

  14. Fine tune settings for GRUB

  15. The grub menu for client machines can be found in the/tftpboot/menu.lst.. In order to make the installation fully automatic one needs to add the install keyword to the kernel line. Additionally I have provided nowin option which indicates that the installation should be done in text mode. Below you can find the content of my grub menu file:

    default=0
    timeout=5
    min_mem64 1024
    title Solaris_10 Jumpstart
    kernel$ /I86PC.Solaris_10-1/multiboot kernel/$ISADIR/unix install nowin -B install_config=192.168.1.135:/export/home/config,sysid_config=192.168.1.135:/export/home/config/,install_media=192.168.1.135:/export/home/install,install_boot=192.168.1.135:/export/home/install/boot
    module$ /I86PC.Solaris_10-1/$ISADIR/x86.miniroot


  16. Configure rules & profile

  17. Now you need to specify the rules for the client machines. I decided to define only one general rule for x86 systems. The type of installation is initial with explicit partitioning (own mirrors defined). The set of packages to be installed is SUNWCuser (End User System Support).

    # cd /export/home/config
    # cat rules
    any - - x86-class -
    # cat x86-class
    #
    # Sample profile for an x86 machine. Installation will
    # provide default partitioning on a standalone system
    # with the end-user cluster.
    #
    # "@(#)x86-class 1.2 94/01/25"
    #
    install_type initial_install
    system_type standalone
    partitioning explicit
    filesys mirror c1t0d0s0 c1t1d0s0 5120 /
    filesys mirror c1t0d0s1 c1t1d0s1 2048 swap
    filesys mirror c1t0d0s4 c1t1d0s4 6656 /var
    filesys mirror c1t0d0s5 c1t1d0s5 6656 /usr
    filesys mirror c1t0d0s6 c1t1d0s6 10240 /export
    filesys mirror c1t0d0s7 c1t1d0s7 free /u01
    metadb c1t0d0s3 count 5
    metadb c1t1d0s3 count 5
    cluster SUNWCuser
    # cp /export/home/install/Solaris_10/Misc/jumpstart_sample/check .
    # ./check
    Validating rules...
    Validating profile x86-class...
    The custom JumpStart configuration is ok.


  18. Boot client machine

Boot the client machine via PXE and the jumpstart installation will begin. In my case in the virtualized environment (destination was also a virtual image) the installation took about 30 minutes (full installation of Solaris 10 update 9 without any additional patches).

sobota, 4 września 2010

Fedora: Package utilities - yum-utils

Using Fedora I encountered a problem, namely how to check which list files that belong to a specific package, how to check the package for a specific file from the filesystem, get the installation date of a package etc. (all these functionalities I found very useful while I was using Solaris operating system). The plain yum utility of Fedora seems to be very limited in that area but fortunately Fedora provides its extentions in the package called yum-utils, which can be installed as follows:

#yum install yum-utils

I did not have the opportunity to use all the utilities that come with this package but one that was extremely useful for me is called repoquery. Utility queries the YUM repositories in a similar way that the rpm does that. The example how to list the file for a specific package is presented below:

# repoquery -la yum-utils
/etc/bash_completion.d
/etc/bash_completion.d/yum-utils.bash
/usr/bin/debuginfo-install
/usr/bin/find-repos-of-install
/usr/bin/needs-restarting
/usr/bin/package-cleanup
/usr/bin/repo-graph
/usr/bin/repo-rss
/usr/bin/repoclosure
/usr/bin/repodiff
/usr/bin/repomanage
/usr/bin/repoquery
...
/usr/share/man/man8/yum-complete-transaction.8.gz
/usr/share/man/man8/yumdb.8.gz
#

The same utility cane be used also to check the name of the package for a specific file (one remark here -> the location with symbolic links did not work in my case):

#repoquery -af /etc/rc.d/init.d/rpcbind
rpcbind-0:0.2.0-5.fc13.i686
rpcbind-0:0.2.0-4.fc12.i686

For more options you can check the manual. So far I have not found any other way to display the installation date of a package than using the rpm:

# rpm -qa --last
...
# rpm -qa --last grep rpcbind
rpcbind-0.2.0-5.fc13 Sat 04 Sep 2010 05:01:39 PM CEST

niedziela, 29 sierpnia 2010

Fedora: Adding services to the startup sequence

Today I was wondering if there is a utility that allows you to control the services that are loaded at the startup (e.g. I wanted to add vsftpd/sshd/mysqld to the automatic startup sequence). I found a command line utilities: chkconfig and ntsysv. I briefly checked the first (I will describe it later on) but actually used the ntsysv (but it seems that at the end it uses chkconfig to add the service to a current runlevel) to add the startup services - you can see what does it look like on the attached screenshot. If you would like to use the ntsysv for a specific runlevel:

[root@krystianekb init.d]# ntsysv --level 5 -> for runlevel 5
[root@krystianekb init.d]# ntsysv --level 235 -> for runlevels 2,3,5

For a services that come with the Fedora, like vsftpd, mysqld, sshd etc. it is only a matter of marking the service to be started or not started during boot. However I have created my own service (for starting the JBoss), which I was able to control with the service command but it was not seen by the ntsysv and was not compatible with the chkconfig. I found in the man page of chkconfig about one cool feature, namely that one can specify within the service (own script in the init.d directory) for which level this service could be available with what start and stop priorities. So I have added the following line to the top section of my startup script:

# chkconfig: 235 90 15

The first column identifies the runlevels: 2,3,5, second column the start priority: here 90 and the last one the stop priority: here 15. The following sequence of command demonstrates how to add a service for runlevels 2,3,5 and how does the ntsysv and chkconfig work together:

[root@krystianekb init.d]# chkconfig --add jboss
[root@krystianekb init.d]# chkconfig --list jboss
jboss 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@krystianekb init.d]# ntsysv --level 235
[root@krystianekb init.d]# chkconfig --list jboss
jboss 0:off 1:off 2:on 3:on 4:off 5:on 6:off


sobota, 28 sierpnia 2010

Fedora: Setting up FTP server

At work I heard about a utility called systemtap (a similar tool to DTrace but for Linux OS) and I wanted to check it on the similar to the production environment (RHEL). I decided to use Fedora as the closest one to the RHEL (RHEL was only available as 6.0 Beta when the article was written). The installation on the vmware went without any problems -> these came afterwards. First thing that came to me was that I need a FTP server in order to upload things onto my Fedora system but out of the box my Fedora 13 installation did not have it enabled. I would divide the procedure into two major steps:

1) installation and firewall setup - follow instruction on wiki page. To summarize - one needs to install the package (yum install vsftp) and setup the firewall rules so that the traffic is passed to the ftp port

2) configuration of access rights - in my case step 1 was still not enough. Each login access attempt as a normal user ended up with error:

500 OOPS: cannot change directory

In order to solve it I needed to change the SELinux boolean value of ftp_home_dir:


# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> off
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
# setsebool -P ftp_home_dir on

# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> on
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
#

Afterwards I was able to login/create directories/upload files via FTP as a normal OS user ;)

czwartek, 26 sierpnia 2010

JEE : JBoss 5.1.0 GA and JDK 1.6

The recommended JDK for the standard downloadable JBoss 5.1.0 GA binaries is JDK 5. So if you have strange exception while invoking the SOAP WS (as I got - enclosed below) you probably forgot to check the releaseNotes and did not do the follow the guidelines from there:

from 5.0.0.GA
JBossAS 5.0.0.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/client directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
jbossws-native-saaj.jar
jbossws-native-jaxrpc.jar
jbossws-native-jaxws.jar
jbossws-native-jaxws-ext.jar


The files are locatedt in the common/lib/ subdirectory. After copying them to lib/endorsed and of course restarting JBoss the presented below exception was gone:

2010-08-26 23:11:34,073 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] (http-127.0.0.1-8080-2) SOAP request exception
java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage

at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
at org.jboss.ws.core.soap.SOAPMessageImpl.(SOAPMessageImpl.java:87)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:215)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:193)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:455)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)


There is also a jdk6 version available for download on the sourceforge.

Java - JSR181 and jaxws-api maven problem

Today I tried to create a WS that would be used for a purpose of mass provisioning operations. The ideas was to transfer the file as the attachement to the normal SOAP message (to avoid xml tag overhead) - in my case I decided to check MTOM (Message Transmission Optimization Mechanism) and JBoss as the runtime environment (version 5.1.0 with Tomcat web container). I found a manual describing howto enable the MTOM for a WS in JBoss and decided to start the implementation. For that purpose I used EclipseIDE + maven for building the packages and here the first problem occured namely it seems to be a dependency problem between jsr181-api (WebService, SOAPBinding annotations) and jaxws-api (BindingType annotation). In my case I was able to use the first one in version 1.0 MR (MaintenanceRelease) while the jaxws-api in version 2.1-1 required the 1.0 version, which led to the following problem:

Missing artifact javax.jws:jsr181:jar:1.0:compile


The problem basically is that there is no packaging available for this artifact - probably due to some licensing restrictions.

1) Fortunately there is a workaround that helped in my case - to use the geronimo-jaxws_2.1_spec instead of jaxws-api :) And it solved my compilation problems.

2) I found another solution to the previously described problem:
- I added the http://download.java.net/maven/2 repository
- I increased the version of jaxws-api 2.2.1

Moreover the version 2.2.1 comes with JSR224 annotations, which contain the @MTOM annotation for web services supporting the MTOM.

środa, 25 sierpnia 2010

Network: IPv4 address space utilization forecasts - part 2

I decided to find some time slot today to continue on the forecasts issue and indeed as expected the exponential trend line seems to be much closer to the data allocation one. The "doom" date for the IPv4 address space using this trend line is about one year earlier than in case of linear approximation - 1st of March 2013. However the same remarks apply as for the linear trned line (see Linear Trend Line forecasts).

Approximation/trend line fitting was based on the least squares fitting algorithm (taken from: http://mathworld.wolfram.com/LeastSquaresFittingExponential.html). The chart comparing two trend lines is presented below:

Network: IPv4 address space utilization forecasts

Today I have found to extend my Ruby scripts to make some forecasts about the "doom" date - the date in which there will be no IPv4 prefixes available for allocations. The trend line has been approximated using the y=ax+b line (using the formulas from http://www.fourmilab.ch/hackdiet/www/subsubsection1_4_1_0_8_4.html) and extended until the total number of available prefixes is reached. The forecasted date is actually in the near future, namely end of February 2014. As one can see the approaximation is not perfect (probably the exponential approximation would fit better here) since recently the allocation line goes much higher than the trend line but this was for me the starting point. I will still observe the allocations from different registries over time and publish the results on the blog (with possible corrections to the forecasts).

One only has to take into account few things like:
  • the current growth is above the trend line (mainly due to the contribution from the APNIC registry, for which the number of allocations is recently grownig much faster than in the past - one has to observe the progress in the future) - which might mean that the IPv4 prefix exhaustion date might be even closer
  • there is still some number of prefixes currently reserved for the IANA but that might be released for allocations in the future
  • the number of broadcasted prefixes in BGP is much lower than the allocated ones (the chart has been prepared on the basis of the number of prefixes allocated by each registry)

niedziela, 22 sierpnia 2010

Network: BGP vs RIR IPv4 assignments

I have compared the values obtained from each registry against the prefixes announced in BGP (BGP potaroo IPv4 stats) and the results are presented on the chart. As far as the biggest registry is concerned (ARIN) the number of "active" prefixes (broadcasted in BGP) is significantly lower (at level of 60%) comparing to the number of assigned prefixes. Utlization rate of the other rirs is on a quite high level (for the smallest ones there are one or two prerfixes not announced in BGP). In the article I enclose the chart and the table presenting the values.
Registry BGP announced Allocated Percentage
Afrinic 1 2 50%
Apnic 34 43 79%
Arin 59 97 60%
Arin 59 97 60%
Lacnic 5 7 71%
Ripencc 32 40 80%

Network: IPv4 vs IPv6 statistics

In my master thesis I did some research on the usage of the IPv4 address space and decided to continue check that topic right now. I have created a ruby application that parsed the statistics published by each RIR and calculate the overall number of /8 being assigned to each of them. Additionally a group of special purpose addresses reserved by IANA has been identified and placed on the charts.
The chart enclosed on the left presents the distribution of /8 prefixes (status on 22.08.2010). As expected the biggest number of /8 assignment is to the ARIN registry (~40% of the total number of IPv4 /8 prefixes). The numbers of prefixes for APNIC and RIPE are very closed together - although last year RIPE was ahead of APNIC. The important information is that there is still 13% (32 prefixes) available to be assigned for further IPv4 development.



A very valuable information
is how the utilization of the IPv4 prefixes looked over time. There is a figure, which shows the statistics retrieved from the RIRs from th 2003 till now (22.08.2010). One can easily notice that for all RIRs the number of assigned IPv4 prefixes increases. As far as the biggest contributor ARIN is concerned, the increase is very small. The highest increased in the last months can be identified for the APNIC RIR, which last year was still below RIPE and from beginning of this year has overcome it and became number two RIR in terms of /8 prefix utilization.

Figure presenting the total number of prefixes used shows the overall IPv4 /8 prefix statistics (including the reserved space for IANA) over time. As one can see the number is constantly increasing and it seems righ t now that eventually it will reach the total number of available IPv4 /8 prefixes. The author thinks that based on this chart the date of the exhaustion of the IPv4 address space could be estimated (one of the next steps for the author).

NEXT STEPS:
1. Approximate the total IPv4 prefix utilization to make an estimate of the possible date of the exhaustion of the IPv4 address space
2. Verify the number of assigned prefixes against the broadcasted ones (BGP) - hopefully statistics from http://bgp.potaroo.net could be used

piątek, 20 sierpnia 2010

Ruby - sending mails with attachements

Recently I have worked on the ruby script that would do some processing and afterwards would send an email containing the results nad charts (generated with gruff).

At first I tried the plain Net:SMTP and it was sufficient for my needs until I reached the attachements part. With the low level API it was very difficult to make it working (I reached the state that the attachements were sent with the email but they were corrupted). Fortunately I found on the web mailfactory gem (http://rubyforge.org/projects/mailfactory/, can be installed using gem install mailfactory) that helps the programmer to construct the content of the email that will be send with the Net:SMTP mechanisms later on. I really recommend it for its simplicity and ease of use. Below I enclose some example to show show to construct basic message with attachements:

def createInitialMail(subject, msg, from, to)
mail = MailFactory.new
mail.to = to
mail.from = from
mail.subject = subject
mail.html = msg
return mail
end

mail = createInitialMail subject, msg, from, to
mail.attach filename

...

Net::SMTP.start(host, port, host, account, password, :plain) do smtp
to_address = mail.to
smtp.send_message mail.to_s, from, to_address
smtp.finish
end


The createInitialMessage method is used in the example to build the main mail object. I marked with green colour the place how add attachements to the message. At the end there is an example how to send the previously constructed message using the Net::SMTP.

Ruby - rmagick gem on windows

I have been using Ruby 1.9.1 and unfortunately the precompiled binary rmagick-win32 gem is available only for 1.8.6. In order to use it on windows one needs to recompile the sources and install the gem. Fortunately after checking several different proposals on how to do that I found one that worked for me - it can be found here: http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/

My configuration is:

identify -version
Version: ImageMagick 6.6.3-7 2010-08-14 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]


The OS in my case is Windows 7, 64-bit.

Please do not forget (as I did) to replace the types (xml file from imagemagick), otherwise you will experience problems with the examples from the rmagick gem (e.g. watermark.rb).

środa, 16 czerwca 2010

VMware player 2.5.4 - Linux Ubuntu 2.6.32

Experiencing trouble in installing the vmware player 2.5.4 on ubuntu with kernel 2.6.32? This short guide should help you in solving the problem.

The problem that I experienced with the VMware 2.5.4 (and also 2.5.3) installer was that it hung at the end of the installation process (no progress in /tmp/vmware-/setup-.log file). The last line in the setup-.log file was:

Jun 16 20:30:01.280: app| Building module with command: /usr/bin/make -C /tmp/vmware-root/modules/vmnet-only auto-build SUPPORT_SMP=1 HEADER_DIR=/lib/modules/2.6.32-22-generic/build/include CC=/usr/bin/gcc GREP=/usr/bin/make IS_GCC_3=no VMCCVER=4.4.3

The problem is that there are wrong header files included by the module source code files that come with the vmware player. A workaround is pretty simple:

1) Install vmware player 2.5.4 as follows:

# ./VMware-Player-2.5.4-246459.i386.bundle --ignore-errors

2) Build and configure

a) Unpack the modules into the tmp directory:

# cd /tmp/vmware-/
# mkdir modules
# cd modules
# tar xf /usr/lib/vmware/modules/source/vmnet.tar
# tar xf /usr/lib/vmware/modules/source/vmci.tar

b) Replace the included header files:

# cd vmnet-only/
# sed -i "/vnetInt.h/ a\#include \"compat_sched.h\"" vnetUserListener.c
# cd ../vmci-only/include
# sed -i "/compat_page.h/ a\#include \"compat_sched.h\"" pgtbl.h

c) Replace the original tar archives:

# cd ..
# cd ..
# tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
# tar cf /usr/lib/vmware/modules/source/vmci.tar vmci-only

d) Configure/compile the modules:

# vmware-modconfig --console --install-all
...


Afterwards the compilation of modules should go fine and the installation of vmware is finished properly.