0

Suppose I have the following script, roughly it sets up promisc mode and setup a bridge between the two networks (acting as a routing point on the mac level in a sense).

## set interfaces to promiscuous mode
ifconfig eth0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up

## add both interfaces to the virtual bridge network
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1

## optional: configure an ip to the bridge to allow remote access
ifconfig br0 192.168.0.111 netmask 255.255.255.0 up
route add default gw 192.168.0.1 dev br0

script was seen here

Suppose I need to to 'turn off' the promisc mode again (creating another script to turn it off) or go back the previous configuration, is there some clever way to accomplish that ?

1 Answer 1

1

You shouldn't be using ifconfig and route anymore (as they have been deprecated in Linux for many years and are no longer installed by default on modern Linux systems) and should rewrite those to use the current ip commands.

After that you can disable promiscuous mode with something like:

ip link set eth0 promisc off
4
  • 1
    Also, the interface is automatically put in promiscuous oper state (rather than admin state) when enslaved to a bridge: there's no need to ever write the word "promisc". This can be checked by not setting the interface in promiscuous mode manually and then running ip -details link show dev eth0 which will include in its result promiscuity 1 instead of promiscuity 0 as soon as enslaved (whatever the method/api) and will revert to promiscuity 0 when removed from the bridge. It's not possible to turn the operative state off while enslaved by trying to administratively turn it off.
    – A.B
    Sep 20, 2020 at 7:49
  • @A.B when I do "netstat -i" it does not seem to be in promisc mode - is that implied then, can you elaborate ?
    – darune
    Sep 21, 2020 at 7:23
  • 1
    @darune I gave in my comment the precise command to type. As Michael Hampton wrote, older Linux commands should be avoided (including netstat which can be replaced by ss and ip). They use an older APIs becoming obsolete. Those APIs don't provide the information. The P flag is the administrative promiscuous state, not the operational promiscuous state. The oper state can only be seen with newer tools.
    – A.B
    Sep 21, 2020 at 7:47
  • @A.B that is briliant, just checking, thank you !
    – darune
    Sep 21, 2020 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .