Monday, July 25, 2016

RHCE7 Objective: Network Bonding and Teaming

NIC/Channel Bonding RHEL6

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.

Thursday, March 31, 2016

How to create CRONTAB to restart ubuntu





Use cron (should already be installed):

Edit crontab:
sudo crontab -e

The first time you might have to choose your preferred editor (like nano)

Insert a line like
0 6   *   *   *    /sbin/shutdown -r +5
at the bottom. Explanation:
m      h    dom        mon   dow       command
minute hour dayOfMonth Month dayOfWeek commandToRun
so the line
  0 6   *   *   *    /sbin/shutdown -r +5

would reboot your system every day at 6:05am. (6:00am + 5 minutes)

Ctrl+X, Y, Enter should get you out of crontab (if using nano)

Note: you might have to run crontab -e as root, because shutdown needs root.

Monday, February 29, 2016

Windows - Set the size of the "Buffer Memory"


[ Windows ] Set the size of the "Buffer Memory"

 
By default Windows 7/Vista make use of only 512 Kb of your RAM as "Buffer Memory", to optimize exchanges between the Hard drive and the Main Memory.
If your system sports more that 1GB of RAM, then you can increase the space allocated.

For this you must make some modifications in the registry (better make up a backup before).
  • Click on Start/Run/regedit.
  • Expand the following key: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session Manager/Memory Management.
  • Search for the following value: IoPageLockLimit
  • In the case the value doesn't exist, create it:
    • Right click and choose New > DWORD Value (32bit).
    • Name the value IoPageLockLimit and double click it.
  • Select Hexadecimal (base).
  • Enter value F0000 and click OK.
  • Close the Registry Editor and restart your PC to apply the change.

Wednesday, February 10, 2016

Server has a weak, ephemeral Diffie-Hellman public key

Hi,
I am writing this blog to help saving time for admins like me who are getting this error in their browsers "Server has a weak, ephemeral Diffie-Hellman public key"

The server.xml in tomcat is looks similar to this :

       clientAuth="false" sslProtocol="TLS"/> 

With Firefox, I get the untrusted communication error. and there are no errors in catalina.log.

Solution :
Just add this below keystorePass

ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA"

 and Save.

It should look like this :

ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA"
clientAuth="false" sslProtocol="TLS"/>

Thats all friends, restart the service and the page will open normal.

Thanks
Rohit Kumar