3

I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli.

What I'm trying to achieve is to create a mon0 interface at startup and run tcpdump on it. I've created a file in /etc/init.d and named it monitor. The monitor file contains the following

#!/bin/sh /etc/rc.common

#to start after /etc/init.d/network is started and stop after it stopped
START=99
STOP=1

start(){
    #tried with and without the following two lines
    include /lib/network
    scan_interfaces

    iw phy phy0 interface add mon0 type monitor
    ifconfig mon0 up
    echo "mon0 is up!"
}
stop(){
    ifconfig mon0 down
    iw mon0 del
    echo "mon0 is down!"
}

then I run the following

/etc/init.d/monitor enable

and in /etc/rc.d I can see S99monitor and K1monitor but when I reboot, I can't see the mon0 interface created when I do ifconfig.

This works if I manually start it with

/etc/init.d/monitor start

I've also tried adding the command above to /etc/rc.local but nothing changed.

What am I doing wrong?

1
  • Did you update-rc.d monitor default? In Debian it needs special header, i don't know what in dd-wrt Jun 13, 2017 at 7:08

1 Answer 1

0

I guess you forgot to add the

boot(){
start
}

section

2
  • 3
    can you elaborate how a boot() function would solve the problem?
    – Jeff Schaller
    Mar 30, 2016 at 18:53
  • You wrote it works if you do "/etc/init.d/monitor start" but it doesn't automaticaly do it after reboot. So you need to add the boot section in /etc/init.d/monitor
    – max
    Apr 1, 2016 at 11:14

You must log in to answer this question.

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