Solved

Linux Startup Script

Posted on 2014-04-07
4
357 Views
Last Modified: 2014-04-07
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

0
Comment
Question by:JamesonJendreas
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 39984576
Use this file:
/etc/rc.local
0
 
LVL 1

Author Comment

by:JamesonJendreas
ID: 39984579
Just to confirm, I should just put that syntax in rc.local, or do I use rc.local to poitn to this script?
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39984582
Both are a possibility.
0
 
LVL 1

Author Closing Comment

by:JamesonJendreas
ID: 39984615
Cheers!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now