…Details…

Icon

Thoughts that's escape, only details.

Linux – Multicast DVB-S router for EUMETCast

This simple script transform a linux box into a DVB-S Satellite router to receive data from Eurobird 9E used by EUMETSAT to redistribute weather satellite image.

REQUIRE:
DVB Tools
SMCroute
PCI Card supported by Linux/DVB Tools (ex. Skystar 2)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
####################################################################
#								   #	
# Leonardo Rizzi 						   #
# Late night 24/04/2010						   #
# Revision 1.0							   #
# Tune DVB-S pci card for Eurobird 9E shifted from 13E Hotbird     #
# Tune, set net PID, Enable multicasting ecc. ecc. blah blah buuuu #
#								   #	
####################################################################
 
#Globalvar
DTUNE="/usr/bin/dvbtune"
DNET="/usr/bin/dvbnet"
MROUTE="/usr/sbin/smcroute"
IFCONFIG="/sbin/ifconfig"
 
SERVICE="eumetsat"
 
#Set dvbcard 0-3
INT="0"
 
#Set multicast forwarding interface and ip (by default TelliCast bind on 192.168.238.238)
MINT="eth1"
MIP="192.168.238.238"
 
#Set absolute frequency in Hz
FREQ=11977000
 
#Set polarization
POL=H
 
#Set symbol rate
SYR=27500
 
#Set PID one space for value separation
PID="100 300 301 302 500 509 510 511"
 
 
#Begin start!!
 
case "$1" in
  start)
  	# Pre-Start check
 
  	test -x $DTUNE || { echo "$DTUNE not installed or not configured properly";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
        test -x $DNET || { echo "$DNET not installed or not configured properly";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
        test -x $MROUTE || { echo "$MROUTE not installed or not configured properly";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
        test -x $IFCONFIG || { echo "$IFCONFIG not installed or not configured properly";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
        test -d /dev/dvb/adapter$INT || { echo "DVB$INT device not installed or not configured properly";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
 
	# Tuning the dvb frequency 
	echo ""
	echo "Tune the satellite donwlink on interface ${INT}"
	${DTUNE} -c ${INT} -f ${FREQ} -p ${POL} -s ${SYR} -m >/dev/null 2>&1 &
 
	# Set address on local forwarding interface and bring it up
	echo ""
	echo "Set multicast forwarding interface ${MINT}"
	${IFCONFIG} ${MINT} ${MIP} multicast up
 
	# Set PID on active dvb interface
	echo ""
	echo "Set net interface for listed PID:"
	for i in ${PID}
	do
	echo "Bring up PID $i"
	${DNET} -a ${INT} -p $i>/dev/null 2>&1
	done
 
	# Set address on dvbs interfaces and bring it up
	echo ""
	echo "Set net interface up:"
	for ii in {0..7}
	do
	echo "Bring up dvb net interface $ii"
	${IFCONFIG} dvb${INT}_$ii 192.168.22$ii.238 up >/dev/null 2>&1
	done
 
	# Start multicast router
	echo ""
	echo "Enable Multicast Router"
	${MROUTE} -d
 
	#PID 100 multicast forward
	echo "Set multicast for PID 100"
	${MROUTE} -a dvb0_0 192.168.1.1 224.223.222.34 ${MINT}
	${MROUTE} -a dvb0_0 192.168.1.1 224.223.222.36 ${MINT}
	${MROUTE} -a dvb0_0 192.168.1.1 224.223.222.40 ${MINT}
	${MROUTE} -a dvb0_0 192.168.1.1 224.223.222.223 ${MINT}
 
	#PID 300 multicast forward
	echo "Set multicast for PID 300"
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.21 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.31 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.32 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.37 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.226 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.252 ${MINT}
	${MROUTE} -a dvb0_1 192.168.1.1 224.223.222.253 ${MINT}
 
	#PID 301 multicast forward
	echo "Set multicast for PID 301"
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.23 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.33 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.38 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.39 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.35 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.227 ${MINT}
	${MROUTE} -a dvb0_2 192.168.1.1 224.223.222.251 ${MINT}
 
	#PID 302 multicast forward
	echo "Set multicast for PID 302"
	${MROUTE} -a dvb0_3 192.168.1.1 224.223.222.25 ${MINT}
 
	#PID 500 multicast forward
	echo "Set multicast for PID 500"
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.1 ${MINT}
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.22 ${MINT}
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.28 ${MINT}
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.27 ${MINT}
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.29 ${MINT}
	${MROUTE} -a dvb0_4 192.168.1.1 224.223.222.30 ${MINT}
 
	#PID 509 multicast forward
	echo "Set multicast for PID 509"
	${MROUTE} -a dvb0_5 192.168.1.1 224.223.222.248 ${MINT}
	${MROUTE} -a dvb0_5 192.168.1.1 224.223.222.249 ${MINT}
	${MROUTE} -a dvb0_5 192.168.1.1 224.223.222.250 ${MINT}
 
	#PID 510 multicast forward
	echo "Set multicast for PID 510"
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.231 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.232 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.233 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.234 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.235 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.236 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.237 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.239 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.240 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.242 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.243 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.244 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.245 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.246 ${MINT}
	${MROUTE} -a dvb0_6 192.168.1.1 224.223.222.247 ${MINT}
 
	sleep 5
	;;
 
  stop)
	# Stopping the dvb card
	echo ""
	echo "Stopping Satellite Downlink"
	killall dvbtune >/dev/null 2>&1
 
	echo ""
	echo "Stopping Multicast Routing"
	# Stopping Multicast Router
	${MROUTE} -k
 
	# Disable dvbs interfaces and remove active PID
	echo ""
	echo "Shutting down DVB-S interfaces"
	for iii in {0..7}
	do
	/sbin/ifconfig dvb0_$iii down >/dev/null 2>&1
	${DNET} -d $iii >/dev/null 2>&1
	done
 
	# Remove and disable multicasting forwarding interface
	echo ""
	echo "Shutting down multicasting forwarding interface"
	${IFCONFIG} ${MINT} del ${MIP} multicast
	${IFCONFIG} ${MINT} down
 
	;;
 
  restart)
 
	$0 stop
	$0 start
	;;
 
  status)
 
  	PID1='pidof dvbtune'
  	echo ""
  	echo "Tuning subsystem running at pid" $PID1
 
  	PID2='pidof smcroute'
  	echo ""
  	echo "Mulicast router running at pid" $PID2
 
	;;
 
  multicast)
 
  	echo "Multicasting Routing table:"
  	ip mroute show  
	;;
 
  *)
	echo "Usage: $0 [start|stop|restart|status|multicast]"
	;;
esac
 
exit;s

Category: Linux

Tagged: , , , , ,

Leave a Reply

You must be logged in to post a comment.

Archive