Monday, October 31, 2011

How to disable ICMP echo responses in Linux

Many malicious attacks begin with a ping scan. Disabling ICMP echo requests prevents your system’s discovery with a ping.

Disable ICMP echo responses temporarily

You can temporarily disable the ICMP using the following method but this setting will be erased after the reboot.

root@lifelinux:~# echo 1 >  /proc/sys/net/ipv4/icmp_echo_ignore_all

Also, to enable the ICMP echo responses back, type the following command:

root@lifelinux:~# echo 0 >  /proc/sys/net/ipv4/icmp_echo_ignore_all

Disable ICMP echo responses permanently

You can permanently disable the ICMP echo reponses using the following method:
Edit the sysctl.conf file:

root@lifelinux:~# vi /etc/sysctl.conf

And add the following line:

net.ipv4.icmp_echo_ignore_all = 1

After that, execute sysctl -p to enforce this setting immediately:

root@lifelinux:~# sysctl -p

The above command loads the sysctl settings from the sysctl.conf.

Continue Reading »

How to Enable TCP/IP Forwarding in Windows XP

To enable TCP/IP forwarding, follow these steps:

  1. Start Registry Editor (Regedit.exe).
  2. In Registry Editor, locate the following registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

  3. Set the following registry value:

    Value Name: IPEnableRouter
    Value type: REG_DWORD
    Value Data: 1

    A value of 1 enables TCP/IP forwarding for all network connections that are installed and used by this computer.

  4. Quit Registry Editor.
Continue Reading »

Howto enable internet for ip in Centos

#eth0 – internet
#eth1 – network
echo -e “192.168.10.99 00:15:F2:16:6C:C2 dev eth1″ > /srv/mac.list
arp -f /srv/mac.list
iptables -t nat -A POSTROUTING -o eth0-j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
#this script enable internet for ip 192.168.10.99 with MAC 00:15:F2:16:6C:C2

Continue Reading »

Enable IP forwarding under RHEL/CentOS

The regular way

Edit /etc/sysctl.conf

Edit the “net.ipv4.ip_forward” line and set it to 1

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

When done type the following to validate the new setting :

sysctl -p

The manual way :

echo "1" > /proc/sys/net/ipv4/ip_forward

This wouldn’t be persistent though, so you should edit sysctl.conf anyway, or add the command in /etc/rc.local

Continue Reading »