Asides

SSH Root Login on Debian Server

Posted on by admin

To enable SSH login for a root user on Debian 8 Jessie, you need to configure the SSH server config.
Open /etc/ssh/sshd_config and change:
PermitRootLogin without-password
to:
PermitRootLogin yes
Save the configuration file and then restart the SSH server:
#service ssh restart

CentOS 6.3 NIC Bonding

Posted on by admin

CentOS 6.3 NIC Bonding

NIC Bonding or Channel Bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy. If one physical NIC is down or unplugged, it will automatically move resource to another NIC card in the bond.

Step 1: Creating Bonding Channel

As root, create a new file name, bonding.conf in this example, in the /etc/modprobe.d/ directory. Insert the following line in this new file:

#vi /etc/modprobe.d/bonding.conf
alias bond0 bonding

For each configured channel bonding interface, there must be a corresponding entry in your new /etc/modprobe.d/bonding.conf file.

Step 2: Creating Channel Bonding Interface

To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bond0. The following is an example:

#vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.8
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPRO=none
USERCTL=no

Step 3: Configuring Channel Bonding Interface

After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding the MASTER and SLAVE directives to their configuration files. The configuration files for each of the channel-bonded interfaces can be nearly identical For example:

eth0

#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=bond0
SLAVE=yes
BOOTPRO=none

#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPRO=none

  • DEVICE: Indicates what is the device name
  • USERCTL: Indicates if user can control this device (in this case, no)
  • ONBOOT: Indicates that at boot time should this device be up (in this case, yes)
  • MASTER: the device master (in this case bond0)
  • SLAVE: Indicates if this device is a slave
  • BOOTPRO: Where to get the IP Address from (in this case since it is set to none, it indicates a static IP)

Step 4: Restarting Network Service

Restart the network service and check the output of ifconfig

#service network restart
#ifconfig

and check to see that bond0 is UP and that eth0 and eth1 (in this case) are UP and running as SLAVE.

How to Setup Network Bonding with Debian 6

Posted on by admin

How to Setup Network Bonding with Debian 6

In order to setup either load balancing or redundant NICS on your Debian server, you will need at least two NICS connected to either different switches (failover and possible load balancing) or the same switch (load balancing only).
First off, you need to install the bonding module by:

#sudo apt-get install ifenslave-2.6
#sudo modprobe bonding && echo bonding >> /etc/modules

This will install the module as well as load the module at boot.
Now we need to edit the /etc/network/interfaces file as follows:

#sudo cp /etc/network/interfaces /etc/network/interfaces.org
#sudo vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto bond0
iface bond0 inet static
address 192.168.2.8
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
bond-mode balance-rr
bond-miimon 100
bond-downdelay 200
bond_updelay 200
slaves eth0 eth1

Reboot and test by checking that bond0 is UP and that eth0 and eth1 (in this case) are UP and running as SLAVE.

A Note About Various Bonding Policies

In the above example bounding policy (mode) is set to 0 or balance-rr. Other possible values are as follows:

The Linux bonding driver aggregating policies
Bonding policies (mode) Description
balance-rr or 0 Round-robin policy to transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
active-backup or 1 Active-backup policy. Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. This mode provides fault tolerance.
balance-xor or 2 Transmit based on the selected transmit hash policy. The default policy is a simple [(source MAC address XOR’d with destination MAC address) modulo slave count]. This mode provides load balancing and fault tolerance.
broadcast or 3 Transmits everything on all slave interfaces. This mode provides fault tolerance.
802.3ad or 4 Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification. Most network switches will require some type of configuration to enable 802.3ad mode.
balance-tlb or 5 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.
balance-alb or 6 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.

[ Source: See Documentation/networking/bonding.txt for more information. ]

Force CentOS 6 to Detect New Network Devices

Posted on by admin

Force CentOS 6 to Detect New Network Devices

This is handy to know specially if you work with virtual machines. CentOS 6.x now uses udev to deal with all hardware devices. Udev managages hardware, including network interfaces, via .rules files which contain various attributes of a given piece of hardware that are used to match the device against a single device node each time it is connected to the system. When you move a virtual machine from one host to another, that copy has the original .rules files contained in it which will no longer match the new host (in terms of network connections, different MAC Address, UID, etc.). In the case of CentOS 6.x, the 70-persistent-net.rules file controls the network devices in the system and for what ever reason, CentOS 6.x does not update this file upon boot.

To force CentOS 6.x to detect the new settings, all you need to do is:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

And remove the existing HWADDR line so that it won’t conflict with the new value written to the 70-persistent-net.rules file when you reboot the system. If there also exists a UID line, remove that as well.

Once you have saved the changes, all you need to do is to remove the existing 70-persistent-net.rules file by:

rm -f /etc/udev/rules.d/70-persistent-net.rules

Restart the computer or virtual machine and check that you now have network connectivity.