Solved

Linux Startup Script

Posted on 2014-04-07
4
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

710 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