Author Archives: Tom

WiFi Card – Packet Injection in Linux

Very simple way to test if your WiFi card supports injection:

Stop Network Manager: /etc/init.d/network-manager stop
Put the card in monitor mode: airmod-ng start wlan0
Test using: aireplay-ng -9 mon0

With luck, the following output is displayed:
Trying broadcast probe requests…
Injection is working!

I am using Debian Wheezy (testing) with WiFi card:
Network controller: Intel Corporation Centrino Wireless-N 1000

IPv6 DNS Advertisements

DNS client configuration can be handled by the standard Router Advertisement Daemon (radvd) – apt-get install radvd

Edit /etc/radvd.conf on your Linux Router and insert the following at the end of the file to use Google’s DNS Caching server:

RDNS 2001:4860:4860::8888
{
};

On your Linux clients install rdnssd. To automatically add the advertised IPv6 DNS servers to your /etc/resolv.conf

The /etc/resolv.conf now contains both IPv4 and IPv6 entries. Typically a DHCP client is adding the IPv4 DNS server entries, this can be prevented by removing ‘domain-name-servers’ from the ‘request’ line in dhclient.conf

Net-SNMP writable attribute

Solarwinds NMS verifies the SNMP write configuration of its nodes (agents) by attemping to set the ‘sysContact.0’ (1.3.6.1.2.1.1.4.0) value.

On Net-SNMP you must first configure the ‘rwcommunity’ setting in the snmpd.conf file. Do not set ‘sysContact’ value in snmpd.conf.

Configuring ‘sysContact’ (or any other ‘sys’ setting) in the configuration file, results in that value being set as read-only. You will not be able to remotely configure the value, and Solarwinds configuration tests will fail.

Instead set values like ‘sysContact’, ‘sysName’, ‘sysDecr’ etc, using the command snmpset included with net-snmp.

Multiple IPv6 Addresses per Interface

Using ‘ifconfig’ on Debian Lenny, multiple IPv6 addresses can be added using entries in ‘/etc/network/interfaces’ with the ‘up’ and ‘down’ options. For example:

iface eth0 inet6 static
        address 2001:41c8:1:5568::100
        netmask 64
        gateway fe80::1
        pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/autoconf
        up /sbin/ifconfig eth0 inet6 add 2001:41c8:1:5568::1:100/64
        up /sbin/ifconfig eth0 inet6 add 2001:41c8:1:5568::2:100/64
        down /sbin/ifconfig eth0 inet6 del 2001:41c8:1:5568::1:100/64
        down /sbin/ifconfig eth0 inet6 del 2001:41c8:1:5568::2:100/64

Emulating a network connection with packet drop

IP packet drop can be easily emulated on any section of network using a Linux Bridge and a single iptables command:

iptables -t mangle -A FORWARD -m statistic --mode random --probability 0.01 -j DROP

(where probability is expressed as a value between 0 and 1)

If the intention is to emulate packet drop to the local Linux system not using a bridge, use the INPUT chain:

iptables -t mangle -A INPUT -m statistic --mode random --probability 0.01 -j DROP

To remove the random packet drop and restore the connection to normal operation either change -A to -D in the above commands, or flush the iptables with:
iptables -t mangle -F FORWARD or iptables -t mangle -F INPUT