Solved

Linux Startup Script

Posted on 2014-04-07
4
370 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
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 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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

863 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

28 Experts available now in Live!

Get 1:1 Help Now