How to permanently set a network interface to promiscuous mode?

Joshua Gimer jgimer at gmail.com
Thu Aug 2 15:34:00 UTC 2007


What about adding support for PROMISC yourself in an init script that  
runs after "network". Maybe something like:

#!/bin/bash

cd /etc/sysconfig/network-scripts/

interfaces=`ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|-range|rpmsave| 
rpmorig|rpmnew)' | \
             LANG=C egrep -v '(~|\.bak)$' | \
             LANG=C egrep 'ifcfg-[A-Za-z0-9\._-]+$' | \
             sed 's/^ifcfg-//g' |
             sed 's/[0-9]/ &/' | LANG=C sort -k 1,1 -k 2n | sed 's/ //'`

for i in $interfaces
do
         PROM=$(egrep -i 'promisc' ifcfg-$i | awk -F"=" '{ print $2 }')

         if [ "$PROM" = "yes" ];
         then
                 /sbin/ifconfig $i promisc
         fi
done

Or you can add support for it in /etc/sysconfig/network-scripts/ifup- 
post, something like:

PROM=$(egrep -i 'promisc' ifcfg-${DEVICE} | awk -F"=" '{ print $2 }')

if [ "$PROM" = "yes" ];
then
         /sbin/ifconfig ${DEVICE} promisc
fi

at the end of the file before exit 0.

Josh

On Aug 1, 2007, at 1:42 AM, Mertens, Bram wrote:

> Hi,
>
> We need to configure a network interface on one of our machines so  
> that
> it always gets set to promiscuous mode.
>
> So far I have manually issued "ifconfig eth1 promisc" but I wouldn't
> like to do this every time the interface has been brought down and up
> again.  According to /usr/share/doc/initscripts-7.93.25.EL/ 
> sysconfig.txt
> there used to be a "PROMISC=yes" option that could be used in the
> "/etc/sysconfig/network-scripts/ifcfg-eth1" file but apparantely this
> option is deprecated and the file reads "To properly set these, use  
> the
> packet socket interface."
>
> So far I haven't been able to find any documentation on this packet
> socket interface.  How can I configure this netwxork interface to  
> always
> come up in promiscuous mode?
>
> Thanks in advance.
>
> Bram
>
>
>
> Mazda Motor Logistics Europe NV, Blaasveldstraat 162, B-2830  
> Willebroek
> VAT BE 406.024.281, RPR Mechelen, ING  310-0092504-52, IBAN : BE64  
> 3100 0925 0452, SWIFT : BBRUBEBB
>
>
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list