Undo'ing some network setups including 'promisc' mode

darune asked:

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 ?

My answer:


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

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.