Saturday, December 12, 2015

Block IP using blackole route

A null, also known as Blackhole, is a routing table entry that discards a matching packet without sending it further. It is mainly used for preventing/ blocking an unwanted IP to attack your system. It drops the IP using IPtables. for instance, if you want to block an IP address 192.168.0.1, you can write the command:
# ip route add blackhole 192.168.0.1/32

your system will now drop all packets coming from 192.168.0.1

Teaming 2 Network cards

If we have two network interfaces, eth0 and eth1 and we want it to be shown in a single bond as bond0, we need to first create a config file with the name bond0. The network configuration in Linux stores files in etc/sysconfig/network-scripts/ directory.
The work parameters must be set as follows:

#vi /etc/sysconfig/network-scripts/bond0

DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
The IP address must be replaced with your actual setup.
Open eth0 and eth1 configuration files
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Modify the parameters as follows:
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
Save and close the file.
 Now load the bond driver/module when the channel bonding interface is brought up. The kernel configuration files are also modified using # vi /etc/modprobe.conf
Add these lines :
alias bond0 bonding
options bond0 mode=balance-alb miimon=100
 Test configuration using these two steps:
Firstly, load the bonding module:
# modprobe bonding
Restart the network to see bond0 interface:
# service network restart

Both Nic's should now be working as one