LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-25-2019, 08:55 PM   #1
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Rep: Reputation: 32
Question auto start centos 7


Hi,

How to create an autostart for the following tc script?, so it will work when centos 7 box rebooted?

=== tc ===
#!/bin/sh
# Delete root qdisc
tc qdisc del dev enp8s0.100 root
tc qdisc del dev enp10s0.200 root
tc qdisc del dev enp10s0.201 root
tc qdisc del dev bond0 root

tc qdisc add dev enp8s0.100 root handle 1: htb default 1
tc qdisc add dev enp10s0.200 root handle 2: htb default 1
tc qdisc add dev enp10s0.201 root handle 3: htb default 1
tc qdisc add dev bond0 root handle 9: htb default 1


tc class add dev enp8s0.100 parent 1: classid 1:1 htb rate 1gbit
tc class add dev enp10s0.200 parent 2: classid 2:1 htb rate 1gbit
tc class add dev enp10s0.201 parent 3: classid 3:1 htb rate 1gbit
tc class add dev bond0 parent 9: classid 9:1 htb rate 1gbit

tc class add dev enp8s0.100 parent 1:1 classid 1:100 htb rate 25mbit ceil 30mbit
tc class add dev enp10s0.200 parent 2:1 classid 2:200 htb rate 10mbit ceil 15mbit
tc class add dev enp10s0.201 parent 3:1 classid 3:201 htb rate 20mbit ceil 15mbit

tc class add dev bond0 parent 9:1 classid 9:100 htb rate 25mbit ceil 30mbit
tc class add dev bond0 parent 9:1 classid 9:200 htb rate 10mbit ceil 15mbit
tc class add dev bond0 parent 9:1 classid 9:201 htb rate 20mbit ceil 25mbit

tc qdisc add dev enp8s0.100 parent 1:100 handle 100: sfq perturb 10
tc qdisc add dev enp10s0.200 parent 2:200 handle 200: sfq perturb 10
tc qdisc add dev enp10s0.201 parent 3:201 handle 201: sfq perturb 10

tc qdisc add dev bond0 parent 9:100 handle 100: sfq perturb 10
tc qdisc add dev bond0 parent 9:200 handle 200: sfq perturb 10
tc qdisc add dev bond0 parent 9:201 handle 201: sfq perturb 10

tc filter add dev enp8s0.100 protocol ip parent 1: prio 1 handle 100 fw flowid 1:100
tc filter add dev enp10s0.200 protocol ip parent 2: prio 1 handle 200 fw flowid 2:200
tc filter add dev enp10s0.201 protocol ip parent 3: prio 1 handle 201 fw flowid 3:201

tc filter add dev bond0 protocol ip parent 9:0 prio 1 handle 100 fw flowid 9:100
tc filter add dev bond0 protocol ip parent 9:0 prio 1 handle 200 fw flowid 9:200
tc filter add dev bond0 protocol ip parent 9:0 prio 1 handle 201 fw flowid 9:201

===
 
Old 04-25-2019, 09:45 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

you can use /etc/rc.d/rc.local for this, but it is kind of an old fashioned approach.

Evo.
 
Old 04-26-2019, 03:21 AM   #3
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 420
Blog Entries: 1

Rep: Reputation: 202Reputation: 202Reputation: 202
CentOS 7 custom start up script

If you absolutely want to use rc.local, you have to enable & start rc-local.service. I have not tried this and what I read on internet tells me that this sometimes may give weird and unexpected results. Please do your own research beforehand should you choose to use this. Link

But a better option is to write a customer systemd service for this. I have followed this for my custom startup scripts and it worked for me.

Last edited by Honest Abe; 04-26-2019 at 03:22 AM.
 
Old 04-26-2019, 05:50 AM   #4
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
This may help: https://www.linode.com/docs/quick-an...rvice-at-boot/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 14.04 x64 - xfce with vnc - auto login, auto start wine app kingkong89 Ubuntu 0 09-30-2015 08:45 PM
Wine and Auto-start service L"MountMgr" failed to start: 2 gw1500se Linux - Software 0 09-12-2015 06:45 PM
How do I auto start modules that aren't auto loaded on boot? darkbluedrew Debian 2 09-18-2005 09:10 AM
eth0 Auto Connect, How to auto start on logon cornish Linux - Networking 2 05-09-2005 12:02 PM
auto: auto file not found error rissi_kapoor Linux - General 0 08-15-2001 08:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration