Saturday, May 14, 2016

Ethernet Bonding in Redhat Linux (Port Trunk) with Multiple Vlan

Hi Friends,
I have done this project  for a High Frequency Trading Server. In this i created a bond [logical interface] with multiple VLANs from [2 physical interface] at blade server.
From this i achieved redundancy of Ethernet Ports and backend Networking.


1) First go to #cd /etc/sysconfig/network-scripts and edit [ifcfg-eth0]


DEVICE=eth0
HWADDR=00:0a:f7:66:ff:f2
TYPE=Ethernet
UUID=64a6fa8a-3bha-4d46-8080-830149e031a0
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no

2) Edit [ifcfg-eth1]

DEVICE=eth1
HWADDR=00:0A:F7:66:FF:F0
TYPE=Ethernet
UUID=fcdde1bc-2bgaa-4fc7-a358-31f47587cd5b
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no


3) Create a new Ifcfg-bond0 after making a copy of ifcfg-eth0 and edit it as below
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPV6INIT=no
USERCTL=no
BONDING_OPTS="mode=0 miimon=100"


4) Create a new Ifcfg-bond0.51 (In this 51 is tagged to Vlan 51)
DEVICE=bond0.51
TYPE=Bond
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
ONPARENT=yes
IPADDR=10.211.211.156
NETMASK=255.255.255.240
GATEWAY=10.211.211.145
IPV6INIT=no
USERCTL=no
VLAN=yes


5) Create a new Ifcfg-bond0.58 (In this 58 is tagged to Vlan 58)
DEVICE=bond0.58
TYPE=Bond
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
ONPARENT=yes
IPADDR=13.13.13.5
NETMASK=255.255.255.0
GATEWAY=
IPV6INIT=no
USERCTL=no
VLAN=yes

6) Edit the /etc/modprobe.d/bonding.conf file and edit as below


[root@localhost]#vi /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bond0 mode=0 miimon=100

#(Bonding Load Balancing methods are defined at below no. 10)


7)  Go to the backend switches and allow the Vlan Trunk with Vlan allowed[51 & 58]
8) Then restart the network service
#service network restart

9) Now its time to check the vlans connectivity Guys.. It should definitely work. I did it on RHEL 5.7 64 Bit server.

10) Details of Load Balancing methods : (In my case mode=0 was success)

 You can set up your bond interface according to your needs. Changing one parameters (mode=X) you can have the following bonding types:
mode=0 (balance-rr)
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1 (active-backup)
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=2 (balance-xor)
XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.

mode=3 (broadcast)
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4 (802.3ad)
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

    Pre-requisites:
    1. Ethtool support in the base drivers for retrieving
    the speed and duplex of each slave.
    2. A switch that supports IEEE 802.3ad Dynamic link
    aggregation.
    Most switches will require some type of configuration
    to enable 802.3ad mode.

mode=5 (balance-tlb)
Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

    Prerequisite:
    Ethtool support in the base drivers for retrieving the
    speed of each slave.

mode=6 (balance-alb)
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

The most used are the first four mode types...

Also you can use multiple bond interface but for that you must load the bonding module as many as you need.
Presuming that you want two bond interface you must configure the /etc/modules.conf as follow:

    alias bond0 bonding
    options bond0 -o bond0 mode=0 miimon=100
    alias bond1 bonding
    options bond1 -o bond1 mode=1 miimon=100

Test :
To check status type : watch -n cat /proc/net/bonding/bond0

Alternate Way if facing errors related to delaying initialization then (Ifcfg-bond0.x) vlan interface shold be present before this vconfig command:

Use the vconfig command instead to add VLAN which is more appropriate to create VLAN tagging.
#yum install vconfig -y 
###If you dont have the package already installed 
 
#modprobe 8021q 
###To load the VLAN module 
 
#vconfig add bond0 58
###To add a VLAN inteface with ID 58 
 
#vconfig rem bond0.58 
###To remove the interface 
 
#ifconfig bond0.58 
###To view the status/information of VLAN interface 
 
#ifconfig bond.58 192.168.58.100 netmask 255.255.255.0 broadcast 192.168.58.255 up 
### To assign an IP to this interface 
 
#cat /proc/net/vlan/bond0.58 
or check ifconfig |more


Thanks
Rohit Kumar

Wednesday, May 11, 2016

WhatsApp on Desktop Application

Introducing WhatsApp's desktop app

Today we're introducing a desktop app so you have a new way to stay in touch anytime and anywhere - whether on your phone or computer at home or work. Like WhatsApp Web, our desktop app is simply an extension of your phone: the app mirrors conversations and messages from your mobile device.
The new desktop app is available for Windows 8+ and Mac OS 10.9+ and is synced with WhatsApp on your mobile device. Because the app runs natively on your desktop, you'll have support for native desktop notifications, better keyboard shortcuts, and more.
To download the app, visit https://www.whatsapp.com/download from your desktop browser. Then, open the app and scan the QR code using the WhatsApp app on your phone (look for WhatsApp Web menu under Settings).
Just like WhatsApp Web, the new desktop app lets you message with friends and family while your phone stays in your pocket.