Null Route an IP

Adding a null route to a host on linux
This is done by adding the following line to the /etc/sysconfig/static-routes file:
any host 111.111.111.111 reject (being 111.111.111.111 the ip address to block)
When you perform a “route -n” you will see this IP with “-” as it’s gateway. This will cause your server to drop all response traffic to this IP.

Read On »

Some useful Commands.

Creating Linux install drive.
mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
cd /cdrom/images
dd if=boot.img of=/dev/fd0 bs=1440k
cut -d: -f1,7 /etc/passwd | grep sh | grep -v noshell
List: iptables -L -n | grep <IP Address>
Remove: iptables -D INPUT -s <IP 1> -d <IP 2> -j DROP
Insert: iptables -I INPUT -s <IP> -j DROP
Flush: iptables -F
Remove: iptables -D OUTPUT -s 0.0.0.0/0 -d 66.93.33.185 -j DROP
netstat -nap | grep :80 | wc -l //list number of connections connected to port 80
netstat -ntu | awk ‘{print $5}’ …

Read On »

Add Swap partition to Linux

You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.

To add a swap partition (assuming /dev/hdb2 is the swap partition you want to add):

The hard drive can not be in use (partitions can not be mounted, and swap space can not be enabled). The easiest way to achieve this it …

Read On »

Adding New partitions to Linux servers.

ADDING A NEW PARTION TO THE LINUX SERVER

Follow the below steps.

Creating, Mounting, and Configuration New Partitions
Before adding an extra drive, this machine had 2 physical drives. Both of them were named accordingly (sda and sdb) before the new drive was added. The second drive containing the swap partitions was automatically renamed when the new drive was added. Notice the command and output below:

[root@test root]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 8.3G 2.4G 5.5G …

Read On »

 Page 1 of 2  1  2 »