# [SOLVED] Where to put network post-start commands?

## ycUygB1

My ISP has requested that I limit my traffic to 150 mbps, so I executed this command. 

```
tc qdisc add dev eno1 root tbf rate 150mbit latency 50ms burst 15mb
```

The command works fine and the resulting traffic is now flat at 150 mbps.  Now I want to

make sure that it is executed every time I restart networking.

My question:  In what file should I put such a command?  All the Gentoo networking docs I have 

found are tutorials that don't mention post_start commands.  Reading net.lo, there

is some mention of post_start, but it is not documented that I could see.  

The only thing I found by trawling the internet was from lartc.org,  where they say:

 *Quote:*   

> 15.10.4. Making all of the above start at boot
> 
> It sure can be done in many ways. In mine, I have a shell script in /etc/init.d/packetfilter that accepts [start | stop | stop-tables | start-tables | reload-tables] it configures qdiscs and loads needed kernel modules, so it behaves much like a daemon. The same script loads iptables rules from /etc/network/iptables-rules which can be saved with iptables-save and restored with iptables-restore. 

 Last edited by ycUygB1 on Sat Sep 13, 2014 1:45 pm; edited 1 time in total

----------

## eccerr0r

OpenRC: 

Create or edit file local.start in /etc/local.d/ that contains your command.  This will be executed after normal startup sequence.

Systemd:

http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd

----------

## ycUygB1

Right.  That looks good.  Just one question.  How do you know that this will be executed after the network comes up?  Is local always the last thing started?

----------

## eccerr0r

For systemd it's automatic because you're adding the dependencies in the file.

For openrc, it's run after everything is set up.  You can also create your own service and start it much like systemd but I think this is simpler overall.

----------

## ycUygB1

Thanks.  I was thinking that baselayout would handle it in /etc/conf.d/net, maybe with some line like

tc_eno1 = "some tc command"

but I guess I must have reached baselayout's limits.

----------

## eccerr0r

You may also be able to add

```
postup() {

tc qdisc add dev eno1 root tbf rate 150mbit latency 50ms burst 15mb

}
```

in your /etc/conf.d/net ... I haven't tried this, this might be a nicer way that's dependency aware...

----------

## ycUygB1

Yeah, that is what I was looking for.  I didn't see that documented anywhere.

Regards,

----------

