NIC Bonding / Port Trunking with CentOS/RHEL

Hello,

with NIC Bonding or Port Trunking you can provide higher throughput and redundency to your network cards. Basically it bonds two, let's say 1Gb network cards, to one 2Gb card. Bonding can be achieved with more than 2 cards in a system.

There are several modes:

Mode 0 (round-robin – load balancing/fault tolerence):
This is the default mode and sends packets from the first to the last slave. 1st packet -> 1st NIC, 2nd packet -> 2nd NIC, 3rd packet -> 1st NIC etc…

Mode 1 (active backup – fault tolerence):
In this mode only 1 card/slave is active at the moment. Another takes over as soon as the other goes down. Only the MAC address of the bond is visible on the outside.

Mode 2 (balance-xor – load balancing/fault tolerence – Static Link Aggregation):
In this mode every destination gets the packets from the same source address based on MAC addresses.

Mode 3 (broadcast – fault tolerence):
In this mode all packets go out on every interface. Incoming traffic is not affected.

Mode 4 (802.3ad – Dynamic Link Aggregation, LACP):
In this mode there is a group created wth the same speed an duplex possibilities according to IEEE 802.3ad. There are some prerequisites fot this: Ethtool support in drivers to get speed and duplex of each slave and a switch which supports 802.3ad.

Mode 5 (balance-tlb – load balancing):
In this mode the outgoing packets are distributed over all slaves, but only the active slaves receives packets. If this goes down another slave takes over.

Mode 6 (balance-alb – load balancing):
In this mode all outgoing and incoming traffic in distributed over all salves.

Now after shortly explaining all modes here how to create such a bond:

  • add these lines to /etc/modprobe.conf:
    alias bond0 bonding
  • create and open the file /etc/sysconfig/network-scripts/ifcfg-bond0:
    DEVICE=bond0
    IPADDR=<ip address>
    NETMASK=<your netmask>
    NETWORK=<network>
    BROADCAST=<broadcast>
    GATEWAY=<gateway>
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    BONDING_OPTS="mode=<your selected mode (0-6)> miimon=100"
  • then change your /etc/sysconfig/network-scripts/ifcfg-ethX files to:
    DEVICE=ethX
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

Now you should only need to restart your server. If you can't restart it please load the bond kernel module and restart your network:

# modprobe bonding
(ATTENTION: My host's connection froze here and i had to go to the physical server to restart the network)

# /etc/init.d/network restart

Setting timezone and synchronizing time with NTP (CentOS/RHEL)

Hello,

first of all i explain how you can set your timezone through the terminal. This is quite easy:

check the available timezones on your machine with:
# ls /usr/share/zoneinfo

and copy them over to /etc/localtime (e.g. Europe/Luxembourg)
# cp /usr/share/zoneinfo/Europe/Luxembourg /etc/localtime

done.

Next step is the syncing with an ntp server. First check is ntp is installed on your system with
# which ntp

if it's not installed you get nothing in return. so install it with:
# yum install ntp

the config file which is used for the ntp is /etc/ntp.conf. There you can configure the time servers you want to use. For a list of servers visit www.ntp.org or go here. Here is an example for Luxembourg time servers, remove the old ones and insert the following lines instead:

server 2.lu.pool.ntp.org
server 3.europe.pool.ntp.org
server 0.europe.pool.ntp.org

Note:
Inside the ntp.conf you find 2 lines starting with "server … # local time" and "fudge". Comment out these lines as they can prevent proper syncing.

Now start the ntp daemon and set it up at boot time:
# /etc/init.d/ntp start
# chkconfig ntp on

Hope this helps someone out there!
 

Switch your monitor on/off from the command-line

You can switch your screen on or off in a terminal when using the xset command in Ubuntu Linux:

to query information about your screen simply type the command:
# xset -display :0.0 -q

to turn your screen to standby or off type:
# xset -display :0.0 dpms force standby
or
# xset -display :0.0 dpms force off

to turn your screen on again simply type:
# xset -display :0.0 dpms force on

in case the dpms should be disabled on your screen, you can enable it manually with:
# xset -display :0.0 +dpms

Note:

If the screen stays black after switching the screen on again use this command:
# xset -display :0.0 s reset