-
Notifications
You must be signed in to change notification settings - Fork 4
/
ABOUT
286 lines (240 loc) · 13.3 KB
/
ABOUT
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
README v0.4
*******************
Looking Glass (LG) for the Internet Routing Daemon "BIRD"
=========================================================
LG copyright (c) 2013 SUBNETS.RU project (Moscow, Russia)
Authors: Nikolaev Dmitry <virus@subnets.ru>, Panfilov Alexey <lehis@subnets.ru>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
================================================================================================================================
INTRODUCTION
================================================================================================================================
26.11.2013 we migrated from Quagga to BIRD daemon.
So we needed a LG for BIRD, but we can find only this => https://github.com/sileht/bird-lg/ written on python.
I (Dmitry) decided to create (for a start) a simple LG on PHP. This is my version of LG, so be indulgent :)
+++++++++++++++++++++++++++++++++++++
About Internet Routing Daemon "BIRD"
+++++++++++++++++++++++++++++++++++++
The BIRD project aims to develop a fully functional dynamic IP routing daemon.
- Both IPv4 and IPv6
- Multiple routing tables
- BGP
- RIP
- OSPF
- Static routes
- Inter-table protocol
- Command-line interface
- Soft reconfiguration
- Powerful language for route filtering
WWW: http://bird.network.cz/
Maling List: bird-users@network.cz (http://bird.network.cz/mailman/listinfo/bird-users http://bird.network.cz/pipermail/bird-users/)
FreeBSD users can find BIRD daemon in ports tree:
/usr/ports/net/bird
/usr/ports/net/bird6
================================================================================================================================
ABOUT PHP Looking Glass
================================================================================================================================
This is a looking glass for the Internet Routing Daemon "Bird". Written on PHP.
LG is split in two parts:
* Web interface;
* Client for communicate with BIRD socket;
Web interface that request informations from bird nodes.
LG working schemes:
+++++++++++++ ******************** ******************* ****************
+--> + LOCALHOST + --> * CLI * ----> * bird.client.php * ----> * BIRD sockets *
| +++++++++++++ ******************** ******************* ****************
|
******** ****************************** | +++++++++++++++ ******************** ******************* ****************
* USER * ----> * http://webserver/index.php *--+--> + REMOTE HOST + --> * TCP-based server * ----> * bird.client.php * ----> * BIRD sockets *
******** ****************************** | +++++++++++++++ ******************** ******************* ****************
|
| +++++++++++++++ ******************** ******************* ****************
+--> + REMOTE HOST + --> * TCP-based server * ----> * bird.client.php * ----> * BIRD sockets *
| +++++++++++++++ ******************** ******************* ****************
|
|
+--> .....etc......
Files
++++++
* func.php - web-interface php functions;
* index.php - web-interface index file with request form;
* bird.lg.config.php - configuration file for web-interface and bird.client.php;
* bird.client.php - php client for connect and run commands on BIRD socket;
* js/mt145.js - mootools (http://mootools.net/) for web-interface
* css/style.css - CSS style file for web-interface
* img/indicator.gif - request process image for web-interface
* favicon.ico - icon image for web-interface
Availiable query types in web interface:
+++++++++++++++++++++++++++++++++++
* "Show route" with "additional parameters"
* "Ping IP" with "additional parameters"
* "Trace IP" with "additional parameters"
* "Show protocols" without "additional parameters" or with "additional parameters"
* "BGP summary"
* "Advertised routes" with "additional parameters"
* "BFD sessions"
* "OSPF neighbors"
A few words about file bird.client.php
++++++++++++++++++++++++++++++++++
bird.client.php gets commands on input and execute them.
It can be run from:
* web-interface on localhost;
* separately from web-interface on remote host (where bird deamon run);
* from CLI on localhost;
See install instructions below.
Usage: php bird.client.php -c [ipv4|ipv6]: COMMAND
COMMAND: supported commands
+++++++++++++++++++++++++++
IPv4
++++
* bird.client.php -c ipv4: show route for X.X.X.X
* bird.client.php -c ipv4: show route X.X.X.X/Y
* bird.client.php -c ipv4: show protocols
* bird.client.php -c ipv4: show protocols all
* bird.client.php -c ipv4: show route protocol <PROTOCOL_NAME> all
* bird.client.php -c ipv4: show route protocol <PROTOCOL_NAME> filtered all
* bird.client.php -c ipv4: show route export <PROTOCOL_NAME>
* bird.client.php -c ipv4: ping X.X.X.X
* bird.client.php -c ipv4: trace X.X.X.X
* bird.client.php -c ipv4: show bfd sessions
* bird.client.php -c ipv4: show ospf neighbors
IPv6
++++
* bird.client.php -c ipv6: show route for 200X:XXXX::XXXX
* bird.client.php -c ipv6: show route 200X:XXXX::XXXX/XXX
* bird.client.php -c ipv6: show protocols
* bird.client.php -c ipv6: show protocols all
* bird.client.php -c ipv6: show route protocol <PROTOCOL_NAME> all
* bird.client.php -c ipv4: show route protocol <PROTOCOL_NAME> filtered all
* bird.client.php -c ipv6: show route export <PROTOCOL_NAME>
* bird.client.php -c ipv6: ping6 200X:XXXX::XXXX
* bird.client.php -c ipv6: trace6 200X:XXXX::XXXX
* bird.client.php -c ipv6: show bfd sessions
* bird.client.php -c ipv6: show ospf neighbors
Where "<PROTOCOL_NAME>" is name of the protocol, see "show protocols" birdc command for details.
So bird.client.php can be run on localhost and remote host (with the support of TCP-based server).
Example of the TCP-based server http://cr.yp.to/ucspi-tcp.html (FreeBSD users can find it in ports tree: /usr/ports/sysutils/ucspi-tcp).
Working scheme: ucspi received command from WEB-iface, run php bird.client.php and ucspi transmits a command to bird.client.php
<s>This you homework ;)</s>
Sorrowfully but not everyone was able to perform homework :( So... from version 0.4.1 bird.client.php support to be run with TCP-based server, usage example below...
================================================================================================================================
INSTALL INSTRUCTIONS
================================================================================================================================
Requirements
+++++++++++++
1. Installed and running BIRD daemon (IPv4 and/or IPv6 version)
2. Installed PHP5 - CLI version and Apache module or CGI version
Installing on localhost, where web-interface located
+++++++++++++++++++++++++++++++++++++++++++++++++++++
1. Download archive with last version of LG from http://bird-lg.subnets.ru/
2. Unpack all files from archive to your HTTP service www folder (such as /usr/local/www/lg) and edit your HTTP service config file if needed
3. Edit LG config file bird.lg.config.php for your needs. You must set "bird_client_remote" to false.
4. Edit permissions on BIRD daemon socket (see "Notes" section)
5. Start browser and open URL such as http://yourserver/lg/index.php
Installing on remote host to be run separately from web-interface
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* X.X.X.X is IP-address of host where web-interface located
* Y.Y.Y.Y is IP-address to listen connections from web-interface
* ZZZZZ tcp port to listen connections from web-interface
1. Download archive with last version of LG from http://bird-lg.subnets.ru/
2. Unpack files:
- bird.lg.config.php
- bird.client.php
from archive to some folder (such as /usr/local/sbin)
3. Edit LG config file bird.lg.config.php for your needs.
You must:
- set "bird_client_remote" to true
- add string:
$config['bird_client_remote_permited_ips'][]="X.X.X.X";
4. Start tcp-based server
Example for FreeBSD users:
# cd /usr/ports/sysutils/ucspi-tcp
# make install clean
# ee /usr/local/bin/tcpserver.conf
127.0.0.1:allow,RELAYCLIENT=""
X.X.X.X:allow,RELAYCLIENT=""
# /usr/local/bin/tcprules /usr/local/bin/tcpserver.cdb /usr/local/bin/tcpserver.tmp < /usr/local/bin/tcpserver.conf
# /usr/local/bin/tcpserver -v -H -R -l 0 -c 10 -x /usr/local/bin/tcpserver.cdb Y.Y.Y.Y ZZZZZ /usr/local/bin/php /usr/local/sbin/bird.client.php &
Example for Linux users:
* This example is provided by forum user: dragomir (see http://subnets.ru/forum/viewtopic.php?f=18&t=519 for details)
a) install inetutils-inetd
b) edit /etc/default/inetutils-inetd and add:
INETD_OPTS="--environment"
c) edit /etc/inetd.conf and add:
birdclient stream tcp nowait root /usr/sbin/tcpd /usr/bin/php /usr/local/sbin/bird.client.php
d) edit /etc/services and add:
birdclient ZZZZZ/tcp
e) check /etc/hosts.allow for allowing connections:
ALL:ALL
f) start inetutils-inetd
5. Edit LG config file on X.X.X.X (web-interface host) and add Y.Y.Y.Y ZZZZZ as remote node:
$hin++;
$config['nodes'][$hin]['host'] = 'Y.Y.Y.Y';
$config['nodes'][$hin]['port'] = 'ZZZZZ';
$config['nodes'][$hin]['name'] = 'Remote';
$config['nodes'][$hin]['description'] = 'remote host';
6. Start browser and open URL such as http://yourserver/lg/index.php
Notes
++++++
Permissions on BIRD daemon socket:
* If you run BIRD and HTTP on LOCALHOST you must set write permissions on BIRD sockets.
So user/group who runs HTTP server can write to the BIRD socket:
chmod o=w /path/to/bird.ctl
exmples:
/bin/chmod o=w /var/run/bird.ctl
/bin/chmod o=w /var/run/bird6.ctl
* NOTICE: keep in mind that socket permissions will be rewrited after BIRD daemon restarted
It should be noted that you can run bird.client.php on localhost also with the support of TCP-based server.
If TCP-based server is started from user root and group wheel than you don`t need to edit permissions on BIRD socket.
================================================================================================================================
TESTED ON
================================================================================================================================
* OS:
- FreeBSD versions: 8.3, 8.4, 9.1
- Linux: Ubuntu 12.10, Debian 6
* BIRD versions: 1.3.7, 1.3.11, 1.4.0, 1.4.4
* PHP:
- 5.4.21
- 5.3.3
- 5.3.10
* HTTP: Apache 2.2
================================================================================================================================
SUPPORT
================================================================================================================================
You can request for support or report bug:
* email: lg@subnets.ru virus@subnet.ru
* www: http://subnets.ru/wrapper.php?p=100 or http://subnets.ru/forum/viewtopic.php?f=18&t=519
In support request it necessarily should be attached:
* your OS version: uname -a
* your PHP version: php -v
* query log (if exists)
* bird client log (if exists)
* a detailed description of your question
Otherwise your request goes to /dev/null.
Please understand that we do not promise to answer on your request but we will necessarily try to this.
================================================================================================================================
CONCLUSION
================================================================================================================================
Good luck !
õÄÁÞÉ ! (russian word is in KOI8-R encoding :))
---
With best regards,
Meganet-2003 IT team
WWW: www.mega-net.ru