Pages

Monday, November 28, 2011

IPv6 Address Format


We know the IPv6 address size is 128 bits. The preferred IPv6 address representation is: x:x:x:x:x:x:x:x, where each x is the hexadecimal values of the eight 16-bit pieces of the address. IPv6 addresses range from 0000:0000:0000:0000:0000:0000:0000:0000 to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff.
In addition to this preferred format, IPv6 addresses might be specified in two other shortened formats:


Omit leading zeros
Specify IPv6 addresses by omitting leading zeros. For example, IPv6 address 2302:0000:0000:0000:0005:0000:300c:326b can be written as 2302:0:0:0:5:0:300c:326b
OR,


Double colon
Specify IPv6 addresses by using double colons (::) in place of a series of zeros. For example, IPv6 address 2302:0:0:0:5:0:300c:326b can be written as 2302::5:0:300c:326b

Mind it,
Double colons can be used only once in an IP address. So if you write the above address like below:
2302::5::300c:326b. ## This is wrong. Because of double colon appears twice here.


The loopback Address:
     IPv4 Format- 127.0.0.1/8
     IPv6 Format- ::1/128


We will discuss about the address type of IPv6 in next post.

Sunday, November 27, 2011

Introduction to IPv6


IPv6 is the next and updated version of IPv4. The future addressing system of Internet. It has some very basic differences with IPv4. Let’s see what they are…

  1. The first change is the address space. IPv4 is 32 bit and IPv6 is 128 bit.
  2. As the subnet mask will be very difficult to calculate, we can always use it with CIDR notation everywhere.
  3. It will be representing as follows with 8 slots and each slot contains 4 digits, each digit represents 4 bits of Hexadecimal value, separated with colon (:) not dot (.).

    xxxx : xxxx : xxxx : xxxx : xxxx : xxxx : xxxx : xxxx

  4. IPv6 eliminates the need for DHCP server configuration. Because the IPv6 autoconfiguration feature automatically configures interface addresses and default routes for you. In stateless autoconfiguration, IPv6 takes the MAC address of the machine and a network prefix provided by a local router and combines these two addresses to create a new, which is a unique IPv6 address.
  5. To make non-interrupted migration of IPv4 to IPv6 it supports concurrent and harmless parallel configurations on the same device. As a result you can run both IPv4 and IPv6 applications on same device.
  6. Domain Name System (DNS) supports AAAA addresses and a new domain for reverse lookups, which is IP6.ARPA. The DNS retrieves IPv6 information. Where IPv4 supports A addresses/ A records.
  7. The testing tools: ping, traceroute, netstat, nslookup already supports IPv6.

So these are the basic idea of IPv6. There are lots of more features of IPv6. We will discuss those in later posts.

Sunday, November 20, 2011

webmail changepassword in linux


I was working with squirrelmail change password plugin on RHEL 5. Though it works, I know, but unfortunately it was not working on that day. I have tried all the possible ways but failed. Then I have to go for alternate way and did changepassword on that server. Here is how I did it.

Download it on your server.

wget  <the link for changepassword-0.9.tar.gz>

untar the file:

tar –zxvf  changepassword-0.9.tar.gz

Now enter the directory do the following steps (I have a cgi-bin dir in /var/www):

cd changepassword-0.9

./configure –help

./configure --enable-cgidir=/var/www/cgi-bin --disable-smbpasswd --disable-squidpasswd

make && make install


Now open the page with the follwing URL and change your password:

http://<your-server-IP>/cgi-bin/changepassword.cgi


To make easier for user we have to change the path:

mkdir /var/www/changepass

cd /var/www/changepass

vim index.html

## type the following lines in this file and save it ##

<HTML><HEAD>
<TITLE>Webmail Password change</TITLE>
<meta http-equiv="Refresh" content="0; URl=http://<your-server-ip>/cgi-bin/changepassword.cgi">
</HEAD><BODY>
</body>
</html>

Now restart the apache service and open the below URL:

http://<your-server-ip>/changepass/

Tuesday, November 15, 2011

htaccess (Apache Authentication)

Sometimes we may face problem with our webmail when the spam mails generated from it changing the from ID and from server itself (127.0.0.1).

In that case we may enforce a authentication to access our webmail. Lets see how we can do it.

Create a file:
vim /var/www/.htaccess


AuthType Basic
AuthName "Password Required"
AuthUserFile /var/www/webmail/.htpasswd
AuthGroupFile /dev/null
Require user test

Save and Exit.

Create another file:
vim /var/www/webmail/.htpasswd

Save and exit.

Edit the following file:
vim /etc/apache2/sites-available/default

Change AllowOverride None to AllowOverride All

Save and Exit.

Now create the password:
htpasswd -m /var/www/webmail/.htpasswd test

New password:
Re-type new password:

Now restart apache:
/etc/init.d/apache2 restart

Access your webmail address now.

Tuesday, November 1, 2011

Sample Script to reboot a telnet enabled device


This is a sample script for a device restart. You can run it in cron schedular. In my script my device is using 10.2.150.2 IP and its  password is:1234. To run this script I need a package named "expect"

Install expect:
apt-get install expect

Now create a file with your code.
vi /usr/local/bin/device-reboot


#!/usr/bin/expect -f

set timeout 5

# router password
set pass "1234"

# router IP address
set routerip "10.2.150.2"


# start telnet
spawn telnet $routerip

# send username & password
expect "Password:"  ### [the prompt should be like Password: in this step on your device]
send -- "$pass\r"


# execute command
expect ">"   ### [the prompt should be like > in this step on your device]
send -- "reboot\r"
# exit
expect ">"  ### [the prompt should be like > in this step on your device]
send -- "^D"

Save and close the file.

Now make it executable. 
#chmod 777 /usr/local/bin/device-reboot

You can include it in your cron schedular to reboot the device periodically.

Increase squirrelmail attachment size

By default Squirrel mail (webmail) has maximum attachment size limit 2MB. But in our daily mail transections we need to send large files as attachment.

To increase the attachment size edit /etc/php5/apache2/php.ini file.

#vi /etc/php5/apache2/php.ini

upload_max_filesize = 2M [increase the size as you need]

post_max_size = 20M [increase the size as you need]

save and close.

Now restart apache.
#/etc/init.d/apache2 restart