Thursday, December 31, 2015

RFC 952 The structure of IP address v4

I have required to taken some time to read and understand some of the RFCs and today I read RFC952 and found an interesting fact of IP addressing pattern/method. For full document http://www.ietf.org/rfc/rfc952.txt

I have some experience during the early days when working on projects for factory automation, the project involve quite a number of hardwares from camera, actuator, motion controllers, barcode scanners, IOs, PLCs etc. The newer ones connected to each other with IP address. Not only that, in our home also we connect various devices thru our home routers; they are our computers, phones, tablet, TV, water heaters, aircon, some power point, lights etc.

But until only today I got to understand why our IP addressing pattern sticks to 10.x.x.x, or 172.x.x.x or 192.x.x.x. I believe you have seen these in the IP settings before. After read to a point in the RFC952 document, I realize that they have reason for that.

IP address numbering maximum goes up to 255.255.255.255 only is because each sets was designed to 8 bit binary. When you convert decimal number 255 to binary it will gives you 1111 1111.


3. If the first bit of the first octet of the address is 0 (zero),
then the next 7 bits of the first octet indicate the network number
(Class A Address). If the first two bits are 1,0 (one,zero), then
the next 14 bits define the net number (Class B Address). If the
first 3 bits are 1,1,0 (one,one,zero), then the next 21 bits define
the net number (Class C Address) [See RFC-943]. This is depicted in the following diagram:
 
+-+------------+--------------+--------------+--------------+
|0| NET <-7-> | LOCAL ADDRESS <-24-> |
+-+------------+--------------+--------------+--------------+ +---+----------+--------------+--------------+--------------+
|1 0| NET <-14-> | LOCAL ADDRESS <-16-> |
+---+----------+--------------+--------------+--------------+ +-----+--------+--------------+--------------+--------------+
|1 1 0| NET <-21-> | LOCAL ADDRESS|
+-----+--------+--------------+--------------+--------------+
 
4. The LOCAL ADDRESS portion of the internet address identifies a
host within the network specified by the NET portion of the address.

Class C Address

From the table illustrations and notice that the first 3 bits actually determine how many device you could connect within your network. For example if you setup a local area network in your home or office or for a project, and if your address pattern is 192.x.x.x, which is 110 for the first 3 bits, then you could only connect up to maximum 255 devices within your network. This is because the first 3 sets (Y.Y.Y.x) is your net address, the x could use from 1 up to 255. You could set any number starts with 192 ~ 223 to fulfill 110 for the first 3 bits criteria. 

The first 3 sets 192.1.2.x is your network number/name. If you set one of the device to 192.1.3.x, then this device is consider in other network and they would not see each other.


Class B Address

For this class, the first 2 bit has to be 1 0 to determine a Class B address. So the address range for the first sets started with 127 up to 191. With this pattern of address, it has to configure (Y.Y.x.x). The first 2 sets (Y.Y.) is your network name/number. The x is your node address. With this class, you could connect up to 255x255=16516350 devices. Which I think its a huge one for a local area network.


Class A Address

This is the INTERNET addressing we are using currently.


And now I have a bigger question. When we go to whatsmyip.org, it show 202.x.x.x on my mac, and my phone ip is 123.x.x.x. I still can ping each other and realize that my Mac falls under class C address and my phone falls in Class A address.



  

Monday, December 28, 2015

Tuesday, December 22, 2015

Test carried out of self build bind9 within own network

Own built intranet


This is how the intranet being layout for the test


The own-built DNS server

First setup zone file and index file in the DNS (bind9) server. The file path is at:

Index file in  /etc/bind/named.conf.local.
This file act as a index, where this file tells the system where to find the zone file when it needs to resolve names requests. We manually add in the entries into the file as below.





Zone files stores in /etc/bind/zones. 
Exactly the file path where the index file listed.



Open up one of the file, as we can see the ipaddress is saved there. These entries also inserted manually.




Below is the screenshot of check bind9 service status.






----------------------------------- END OF DNS SERVER PORTION -----------------------


THE CLIENT SIDE

We have to configure DNS server settings in the Network Settings. We set our above DNS server IP at 192.168.1.105, so all the clients within the network has to configure DNS setting in the network settings manually to point to our own-built DNS server. If we do not do that, the client will not get the name resolve in our own-built DNS server. 


We run terminal app, and run the command nslookup. This command can be run on mac as well as windows and Linux. Below is the screenshot of the test.



With nslookup command, we could resolved names from the dns server locally.



The macbook has configured to run apache for this test. So when connect to the macbook website, it actually successful load up the webpage.


Monday, December 21, 2015

Capability of NicTool

Found this article from http://hackersome.com/p/Theosis/NicTool


NicTool is a free DNS management suite that takes the headaches out of managing DNS data. NicTool works great for managing one zone or millions of them. It works well with one nameserver or dozens of them.

NicTool is not a DNS server. NicTool exports sanitized and validated DNS data to authoritative DNS servers such as tinydns, BIND, PowerDNS, NSD, and MaraDNS.

NicTool is Open Source, you can fork it on GitHub: https://github.com/msimerson/NicTool

NicTool includes:

  an attractive web interface for users, admins, and clients
  validation of all DNS data before acceptance
  fine grained permissions for users and groups
  delegatation of zones and zone records to users and/or groups.
  logging of all DNS changes (who did what & when)
  RDBMS data storage
  a mature API for automation and integration

NicToolServer is the server component of NicTool. It connects to the database where the DNS information resides. All changes to DNS data (zones, records, nameservers) and managers (users and groups) is validated by NicToolServer before insertion.

NicToolServer functions as a web service. It provides a SOAP or RPC-XML server for applications. The format of requests is defined in the reference API at http://www.nictool.com/docs/api/. The API and NicToolClient both connect to NicToolServer via this web service.

NicToolClient is a CGI application. It is what you see in the browser. It provides a web interface for managing DNS data. NicToolClient has customizable HTML templates and a CSS style sheet.

The NicTool API is a mature and full featured API for connecting to NicToolServer and managing DNS data. There are many scripts written against this API and it is stable.

Usage Examples: 

    ColocateUSA.net (2012-): Custom scripts for web services (billing, orders, CP) to set & reset rDNS, and CLI scripts to update forward and rDNS for IPv4 and IPv6 addresses.

    Spry/VPSlink (2007-2010): We wrote Control Panels that allowed clients to manage virtual machines. We provided a custom DNS manager so our clients could manage their domains and the rDNS for their IPs, supported by the NicTool API.

    Layered Tech (2005-2007): DNS management was limited to internal staff and was updated as needed. Which meant, lots of old poorly maintained data. I wrote a number of scripts for common tasks like "reset the rDNS for these IPs" or "delegate this block of IPs to these NS".

    Lightrealm/HostPro/Interland/Web.com (2000-2003): In 1999, Lightrealm's DNS was managed on Sun servers running BIND 4. DNS team members used a shared login for access and editing of the zone and named.conf files. We had 120,000 zones and reloading BIND took about 12 hours, so it was done once a day. If someone made an error, it might take 10 hours before BIND encountered it and croaked, sometimes extending the time-to-publish of DNS data to days.
    With the pending merger of Lightrealm, Vservers, and HostPro, our zone count was going to almost triple. We needed a better solution and found NicTool. We deployed a system that elegantly managed 400,000 zones, millions of zone records, and published changes in under a minute. NicTool remained in use at Web.com for many years thereafter.

Friday, December 18, 2015

Download / Install Eclipse, Doxygen, Eclox into Ubuntu Desktop

Navigate to http://www.eclipse.org/downloads/ and below is the page.



Select eclipse type


Select system


Download from the server

Then it would download the file into the /home/user/Download/ folder. 

In the download folder, double click the .gz file it will open Archive Manager, then drag the folder name eclipse out and put any folder it doesn't matter.








Open up the folder and double click Eclipse to run




Install Doxygen onto linux


Install this one is a bit tricky, but it can be done. I refers to this site http://www.stack.nl/~dimitri/doxygen/download.html

Pay very careful attention here, I follow the below steps in GIT repository (below) and I encounters a few errors when doing 


GIT repository

The GIT repository for doxygen is hosted on GitHub. In this repository you can be find the latest "bleeding edge" version of doxygen.
If you have GIT installed, you should do the following to get the initial copy of the repository:
git clone https://github.com/doxygen/doxygen.git
cd doxygen
After that you can use
mkdir build
cd build
cmake -G "Unix Makefiles" ..


The errors I got were 

found missing FLEX
apt-get install FLEX

after that continue with cmake -G "Unix Makefiles" ..
found missing BISON
apt-get install BISON

after that continue with cmake -G "Unix Makefiles" ..
found unsuitable Qt version

apt-get install qt-sdk

this qt-sdk could take up long long time. 200+ MB

after that continue with cmake -G "Unix Makefiles" ..


cmake -G "Unix Makefiles" ..
make

To force a fresh build after an earlier check-out simple remove the build directory and redo the steps above.
After the binaries have been built, you can use
make install
to install them.
Public access to the GIT repository is read-only at the moment. So it is not possible to commit changes, but you can send me patches (use diff -u) if you think they should end up in the mainline, and I'll review and include them.

Doxygen was installed in /usr/local/bin/doxygen



Install Eclox

The same method used in windows and Mac.

Launch the eclipse app...



Go to Help > Install New Software menu


Enter http://download.gna.org/eclox/update into the works with text box and click Add button
Select eclox in the center box and click next to proceed to next screen.




Accept the terms of the license agreement and click finish and its will process the installation.

Then go to Window > Preference, select Doxygen at the left hand side panel




Then click Add button...

Browse to /usr/local/bin/doxygen and done.
















Tuesday, December 15, 2015

Download Eclipse on Mac El Capitan

Navigate to http://www.eclipse.org/downloads/ and below is the page.






Then select mirror site to download



After download and double click on the eclipse-cpp-mars-1-macosx-cocoa-x86_64.tar.gz file, and that will decompress the file and then move eclipse into application folder to complete installation.


Tool for writing software reference documentation - Doxigen

More info refer to https://en.wikipedia.org/wiki/Doxygen

Download link http://sourceforge.net/projects/doxygen/files/



After download, extract it and keep it in Application folder.

Doxygen is a standalone software by itself, hence next we have to link both software with Eclox.



Setup a bridge to connect both Doxygen with Eclipse - Eclox 


Go to http://home.gna.org/eclox/



Then go to Eclipse Help Menu > Install new software...








Let it download and you will be ask for permission to allow it to install after download. Then restart Eclipse.


Refers to https://code.google.com/p/tonatiuh/wiki/InstallingDoxygenForMac to finish the linking of Doxygen and Eclipse.


  • Go to Eclipse->Preferences.
  • Go to Doxygen and push "Add..." button.
  • Select in the file dialog the doxygen installation path: /Applications/Doxygen/Contents/Resources.
  • Apply changes before finish.






Monday, December 14, 2015

Netbeans 8.1 on El Capitan

Simply go to https://netbeans.org/downloads/ and select C++ to download.



Then it would bring to download page. The webpage will automatically download the correct version based on the system you use to download.



Then after download and run the installer and it will download necessary component in the process of installations.