Monday, July 30, 2012

Linux - ipv6 Commands

To Verify if ipv6 is running
~~~~~~~~~~~~~~~~~~

[kanbaras@adprobot ipv6]$ cat /proc/net/if_inet6
00000000000000000000000000000001 01 80 10 80       lo
fe80000000000000e61f13fffe68411c 03 40 20 80     eth0

To View the ipv6 route
~~~~~~~~~~~~~~~~
netstat -r -6

or

[kanbaras@adprobot ipv6]$ route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
fe80::/64                                   *                                       U     256    0        0 eth0
localhost6.localdomain6/128                 *                                       U     0      5188       1 lo
fe80::e61f:13ff:fe68:411c/128               *                                       U     0      0        1 lo
ff00::/8                                    *                                       U     256    0        0 eth0

To ipv6 Ping in linux
~~~~~~~~~~~~~~

kanbaras@adprobot ipv6]$ ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.016 ms
64 bytes from ::1: icmp_seq=4 ttl=64 time=0.015 ms
64 bytes from ::1: icmp_seq=5 ttl=64 time=0.014 ms
64 bytes from ::1: icmp_seq=6 ttl=64 time=0.015 ms

To Configure a server load balancer
~~~~~~~~~~~~~~~~~~~~~~~~

load balancer like SI-ADX - DUT3
~~~~~~~~~~~~~~~~~~~~~~~
server real rs1 2002::606:601
 port http
 port http url "HEAD /"
 port telnet        
       

server virtual vs1 2002::505:503
 port http
 port telnet
 bind http rs1 http
 bind telnet rs1 telnet

ip route 172.26.50.0 255.255.255.0 172.26.64.1
ip route 10.37.54.0 255.255.255.0 172.26.64.1

interface ethernet 1
 ipv6 address 2002::505:502/120

interface ethernet 16
 ipv6 address 2002::606:602/120

 DUT2
 ~~~~
 172.26.64.250 7011

 int eth 24
 enable


 int eth 2
 enable


 DUT4
 ~~~~
  172.26.64.250 7012

 int eth 23
 enable


 int eth 24
 enable

 PC1
 ~~~
 ifconfig eth1 up
 ifconfig eth1:1 inet6 add 2002::0505:0501/120 up
 route -A inet6 add 2002::0606:0600/120 gw 2002::0505:0502

 PC2
 ~~~~
 ifconfig eth1 up
 ifconfig eth1:1 inet6 add 2002::0606:0601/120 up
 route -A inet6 add 2002::0505:0500/120 gw 2002::0606:0602 dev eth1

 service httpd restart


Wednesday, July 25, 2012

Simplest method of transferring a file from one linux PC to another using SCP

The simplest example of an scp command is given below

Syntax
~~~~~
scp <filename> <username@ipaddress>:/<path for the destination>

eg:

scp ASR12500b119.bin root@172.26.64.146:/var/lib/tftpboot

In the next step you will have to supply the password of the destination machine and then you will get some thing like this if the transfer is complete.

[a@CHN-A11-144 tftpboot]$ scp ASR12500e079.bin root@172.26.64.144:/var/lib/tftpboot
The authenticity of host '172.26.64.144 (172.26.64.144)' can't be established.
RSA key fingerprint is 14:bb:29:4c:62:3d:d2:95:d6:e3:17:00:ee:25:72:e8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.26.64.144' (RSA) to the list of known hosts.
root@172.26.64.144's password:
ASR12500e079.bin                                   100%   30MB  29.9MB/s   00:00
 

Tuesday, July 10, 2012

How To Configure A Server Load Balancer For Testing With Traffic


What does a server load balancer do?
When  too many users access a particular web site, the server gets overloaded. In order to get rid of this problem a server load balancer is used.


All requests for a Web site arrives at the load balancer that then passes the request to one of the available servers. A load balancer can find out from the servers which one is least loaded, so all of them are doing an equal amount of work.

Internals of a server load balancer

SLB software establishes a virtual server that acts as a front end to physical servers, distributing user service requests among active real servers. SLB packet processing is based on the Network Address Translation (NAT) method. Packets received by the virtual server IP address are translated into the real physical IP address based on the configured distribution metric (for example, “round robin”) and sent to a real server. Packets returned by the real server for the end user are translated by SLB so that the source address is that of the virtual server instead of the real server. NAT is performed for both directions of the traffic flow. Converting virtual services to real services requires IP and TCP checksum modifications.



The server load balancing (SLB) requires associations between the application servers (real
servers) and the virtual server (VIP). The associations are done by binding TCP or UDP ports on the
real servers with TCP or UDP ports on the virtual server. When a client sends a TCP or UDP request
to an application port defined under the virtual server, then the ServerIron identifies one of the
back-end application servers based on the configured load balancing method and forwards the
client request to it. The client is completely unaware of this traffic distribution, but observes
increased availability, faster response time and better throughput. The ServerIron can be
configured to host multiple application services such as web (http), ftp, or DNS under a single
virtual server.


Configurations
~~~~~~~~~~

-----------              -------                     -----------------------             ---------            -----------

Client PC    ------- Router 1------------ Server Load Balancer---------Router 2---------Server PC

-----------              --------                    ------------------------           ----------          -------------

 
The load balancer should be configured with a real server and a virtual server and ports are created under each of them and the real and virtual server ports are bound to each other. Let us say, left side of the load balancer is kept in 1.1.1.0 network and right side in 2.2.2.0 network.

Load balancer Config:
~~~~~~~~~~~~~~~~

interface ethernet 1
 ip address 1.1.1.2 255.255.255.0
!
interface ethernet 16
 ip address 2.2.2.1 255.255.255.0

                interface ethernet 1
                enable
                ip add 1.1.1.2/24
                exit
                int eth 16
                enable
                ip add 2.2.2.1/24
                exit
                server real rs1 2.2.2.2
                port http
                port telnet
                server virtual vs1 1.1.1.4
                port http
                bind http rs1 http

Router 1 and Router 2:
~~~~~~~~~~~~~~~
Enable the  connected ethernet ports and make sure they are up

Client PC
~~~~~~~
 ifconfig eth1 1.1.1.1/24 up               
route add -net 2.2.2.0 netmask 255.255.255.0 gw 1.1.1.2


Server PC
~~~~~~~
ifconfig eth1 2.2.2.2/24 up
route add -net 1.1.1.0 netmask 255.255.255.0 gw  2.2.2.1


TESTING
~~~~~~~

Now send traffic from the client pc to the virtual server's ip (1.1.1.4) using any of the tools listed (Apache bench or Curl). (show server bind in SLB should be Active)

curl http://1.1.1.4
ab -n 10 http://1.1.1.4/


In the load balancer, sessions are created and the transmit and receive packets  are incremented