Link to home
Start Free TrialLog in
Avatar of JamesonJendreas
JamesonJendreas

asked on

Linux Startup Script

A somewhat Linux novice here (I know enough to be DANGEROUS!).

Anyway, I've built a little ubuntu system to work as netem device to sit in-line and add some artificial latency to a lab network for testing a specific application.

That itself was pretty straight forward.  Now, I've essentially written a script to set it up, but was wondering how I could go about kicking it off at startup.  I know this is quite basic...

What I've put together:
#NOTE eth0 is the onboard NIC.  eth2 is the USB NIC.  Setup should be          
#[node]--(eth2)[NetEm](eth0)--[switch]
#Clear Network info on the network interfaces
ifconfig eth0 0.0.0.0
ifconfig eth2 0.0.0.0

#Build The Bridge
 brctl addbr br0

#Disable Forward Delay
 brctl setfd br0 0

#Add Interfaces to the Bridge
 brctl addif br0 eth0
 brctl addif br0 eth2

#Enable the Bridge
 ifconfig br0 up

#Disable Kernel-level filtering
 for f in /proc/sys/net/bridge/bridge-*; do echo 0 > $f; done

#tc qdisc limits Bandwidth on outbound queuing.
tc qdisc replace dev eth0 root handle 1:0 tbf rate 768kbit burst 1536 latency 1ms
tc qdisc replace dev eth2 root handle 2:0 tbf rate 768kbit burst 1536 latency 1ms

#Adding artificial 150 ms delay/latency with 1 ms +/- variation 
#Note in this example, latency is added to both interfaces

tc qdisc add dev eth0 parent 1:1 handle 10: netem delay 75ms 1ms
tc qdisc add dev eth2 parent 2:1 handle 10: netem delay 75ms 1ms

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JamesonJendreas
JamesonJendreas

ASKER

Just to confirm, I should just put that syntax in rc.local, or do I use rc.local to poitn to this script?
Both are a possibility.
Cheers!