How to set interface to promiscuous mode permanently

  • You can use a script to apply promiscuous settings to an interface or multiple interfaces when they come online.

touch /etc/NetworkManager/dispatcher.d/30-promisc
chmod +x /etc/NetworkManager/dispatcher.d/30-promisc

  • Add following script code to 30-promisc file.

#!/bin/bash
if [ "$1" == "eth0" ] && [ "$2" == "up" ]; then
ip link set dev "$1" promisc on
fi

  • You can also use network initscripts by adding code in /sbin/ifup-local file. Create a file if it is not present.

#!/bin/bash
if [ "$1" == "eth0" ]; then
/usr/sbin/ip link set dev "$1" promisc on
fi

How to apply ethtool settings to interface using Network Manager dispatcher script

In the same way as above, you can use the network manager dispatcher script to apply ethtool commands.

  • create files as follows:

touch /etc/NetworkManager/dispatcher.d/30-ethtool
chmod +x /etc/NetworkManager/dispatcher.d/30-ethtool

  • Now to apply settings to a single network interface:

#!/bin/bash
if [ "$1" == "eth1" ] && [ "$2" == "up" ]; then
ethtool -K "$1" lro off rx on gro off 
fi

  • For multiple interfaces:

#!/bin/bash
if [ "$1" == "eth1" -a "$2" == "up" ] || [ "$1" == "eth0" -a "$2" == "up" ] ; then
ethtool -K "$1" lro off rx off gro off 
fi

  • For bonding interface:

#!/bin/bashif [ "$1" == "bond0" ] && [ "$2" == "up" ]; then
for INTERFACE in bond0 eth1 eth0; do
ethtool -K "$INTERFACE" lro off rx off gro off 
done
fi

Leave a Reply