hsdn / lg Goto Github PK
View Code? Open in Web Editor NEWPHP Version of BGP Looking Glass script, based on the Perl sources: https://github.com/Cougar/lg
License: Other
PHP Version of BGP Looking Glass script, based on the Perl sources: https://github.com/Cougar/lg
License: Other
switch ($url['scheme']) - Undefined index: scheme
Hello,
We're trying this with Huawei routers and see that the looking-glass response is incomplete compared to the same command inside the router itself.
Below is the different replies with a NE40E-X8 router.
Command executed inside router:
<HUAWEI1>display bgp routing-table A.A.A.A
BGP local router ID : 10.29.0.253
Local AS number : ASAAAAA
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of A.A.A.A/24:
From: B.B.B.B (C.C.C.C)
Route Duration: 1d01h08m24s
Direct Out-interface: Eth-Trunk1.3682
Original nexthop: B.B.B.B
Qos information : 0x0
Community:<ASAAAAA:12417>, <ASAAAAA:25400>, <ASAAAAA:24400>, <ASAAAAA:23400>
AS-path ASBBBBB, origin igp, localpref 200, pref-val 0, valid, external, best, select, active, pre 255
Advertised to such 5 peers:
A.A.A.236
A.A.A.252
A.A.A.247
A.A.A.84
A.A.A.81
Reply from looking-glass webpage:
Command: display bgp routing-table A.A.A.A
BGP local router ID : 10.29.0.253
Local AS number : ASAAAAA
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of A.A.A.A/24:
From: B.B.B.B (C.C.C.C)
Route Duration: 1d01h10m09s
Direct Out-interface: Eth-Trunk1.3682
Original nexthop: B.B.B.B
Qos information : 0x0
Greetings,
I am using hsdn/lg to display quagga queries and it works really nice.
would it be difficult to have as an option the possibility of also retaining the last query/submit/value menu at the answer/output page, in order to easily further continue similar queries without having to go through the whole initial cycle?
I am trying to find a way to preserve the initial div form
table upon displaying the output, but my php skills aren't that great
Hello! First, I wanted to congratulate you on your work and thank you.
Can you help me with this doubt?
When I generate the graph, it creates an additional html, which causes the graph to get stuck in a "box"
https://uploaddeimagens.com.br/imagens/lg1-png-b2ab3993-51ec-4469-8267-6d69d4d8f1e5
https://uploaddeimagens.com.br/imagens/lg2-png
once again
Thank you!
Hi everyone, could anyone help me, I'm having difficulty in leaving the tracert command, it does not return any value.
BGP routing graph for 179.127.248.0/21, router: BGP NE40
when trying to require the graph for huawei, this error appears:
Not found BGP information of request.
Works well on mikrotik router
PHP Parse error: syntax error, unexpected '}', expecting end of file in /opt/lg/htdocs/index.php on line 515
PHP 7.0.7-1+donate.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
It might be nice to have support fo Vyos as well. I'll look at the code a bit more and see if its something I could add...
NGINX:
2017/12/22 00:17:17 [error] 2989#0: *1 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '80.81' (T_DNUMBER) in /var/www/html/index.php(1314) : regexp code on line 1
PHP message: PHP Fatal error: preg_replace(): Failed evaluating code:
" ".link_command("bgp", "neighbors+"80.81.192.6"+routes+all", "Import").": " in /var/www/html/index.php on line 1314" while reading upstream, client: 10.22.15.2, server: lg.cln.net, request: "GET /?router=Jun0-MR&protocol=ipv4&command=bgp&query=neighbors+80.81.192.6 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "lg.cln.net", referrer: "http://lg.cln.net/?command=summary&protocol=ipv4&query=&router=Jun0-MR"
Apache:
[Thu Dec 21 23:42:44.648685 2017] [:error] [pid 583] [client 10.22.15.2:49342] PHP Parse error: syntax error, unexpected '78.25' (T_DNUMBER) in /var/www/html/index.php(1314) : regexp code on line 1, referer: http://lg.cln.net/?command=summary&protocol=ipv4&query=&router=Jun0-MR
[Thu Dec 21 23:42:44.648751 2017] [:error] [pid 583] [client 10.22.15.2:49342] PHP Fatal error: preg_replace(): Failed evaluating code: \n" ".link_command("bgp", "neighbors+"78.25.75.133"+routes+all", "Import").": " in /var/www/html/index.php on line 1314, referer: http://lg.cln.net/?command=summary&protocol=ipv4&query=&router=Jun0-MR
traceroute ping not working mikrotik and junos
Command: /tool traceroute 1.1.1.1 size=60 count=1
blank screen
Notice: Undefined index: scheme in /var/www/html/index.php on line 568
Hi,
We have upgraded from CentOS 6 to 7. But now, it seems even though GraphViz tools is installed.
Anyone has working instructions how to install GraphViz tools on CentOS 7? Take note NOT Perl Image_GraphViz as that was installed.
Dear Team,
Im using user/passwd to access juniper router but can't connect, below some logs and my config
$_CONFIG['routers'] = array
(
'router-alg' => array
(
'url' => 'ssh://lg:[email protected]:22',
....
'os' => 'junos',
),
'router-anb' => array
(
'url' => 'ssh://lg:[email protected]:22',
...
'os' => 'junos',
),
);
Oct 10 13:41:04 ALG-RD-MX2020-02-re0 sshd[14259]: (pam_sm_authenticate): DEBUG: PAM_USER: lg
Oct 10 13:41:04 ALG-RD-MX2020-02-re0 sshd[14259]: (pam_sm_authenticate): DEBUG: Updating lock-attempts of user: lg attempts: 1
Oct 10 13:41:04 ALG-RD-MX2020-02-re0 sshd[14259]: (pam_sm_acct_mgmt): DEBUG: PAM_USER: lg
Please your advice
Hello,
I am facing an issue which has some similarities to "SSH and Image_GraphViz problems", but also quite different.
I setup a server with the front end, just followed this github's readme, example public telnet looking glasses working fine. I also tried with other public telnet looking glasses, they all worked fine. Please note that I only checked with cisco IOS XE varient, even if I dont mention later, assume that I only tested/tried against IOS XE.
Problem starts when I try to attach my own router, its a cisco A901. It shows following error.
First I thought it was not playing well with ssh, so I changed it to telnet. Then I thought may be my password having a "@" character causing the issue. So I removed the password too. Currently it is telnet with no password. Error is same as above.
Public telnet looking glass working fine when attached. Also when I try from the server cli, I can reach my telnet with no issue, just like public ones.
This one is a public one from this github's example, which also works fine in front end.
So from server cli, same server hosting the front end, I can interact with both looking glasses same way without any issue. Note that router commands for these two routers, public example and mine, are identical.
Below is my lg_config.php, except for "example1" paragraph, rest is default. I tried with port number at the end and without.
Please note that first I tried without a hostname, just a direct ip address, I thought it might cause an issue so I changed the ip to hostname at /etc/hosts.
Also note that since I have not been able to got this to production, and my company, and me, has a telnet phobia, my telnet looking glass has private IP to login. But as long as its reachable from the server, it shouldn't be an issue. Still mentioned it just in case.
Server runs on Ubuntu 20.04.1 LTS, my router is cisco A901 with IOS XR.
long story short, front end works fine. Back end telnet looking glass also works fine. But when I try to attach them I get the error from the first image. I tried to copy my looking glass as much as like the public one in this example. I dont know about the public one's internal, but from putty or server cli, connection process and commands are identical.
http://103.131.159.232/ if you want to see for yourself.
Thanks for taking your time to read the post. Bgp graph feature is really neat.
Hey mate,
trying to set this up on ROS 6.42.1 and it doesn't appear to be working, any ideas?
Just getting login failed each time, but wireshark and the router are both reporting login, wireshark trace shows connection and then it just quits.
Hi Guys
I was wondering if its possible for you to add support for VYOS?
We are currently using Mikrotik but looking at deploying new locations with VYOS
Cheers
D
Hi everyone, Can anyone help me with Huawei router filter, I need to perform the following filter, to rertornar only some information display bgp routing-table 8.8.8.8 | AS-path | Community | Duration | From | BGP
'huawei' => array
(
'ipv4' => array
(
'bgp' => 'display bgp routing-table %s ',
'advertised-routes' => 'display bgp routing-table peer %s advertised-routes',
'received-routes' => 'display bgp routing-table peer %s received-routes',
'routes' => 'display bgp routing-table peer %s received-routes active',
'summary' => 'display bgp peer',
'ping' => 'ping %s',
'trace' => 'tracert %s',
),
'ipv6' => array
(
'bgp' => 'display bgp ipv6 routing-table %s',
'advertised-routes' => 'display bgp ipv6 routing-table peer %s advertised-routes',
'received-routes' => 'display bgp ipv6 routing-table peer %s received-routes',
'routes' => 'display bgp ipv6 routing-table peer %s received-routes active',
'summary' => 'display bgp ipv6 peer',
'ping' => 'ping ipv6 %s',
'trace' => 'tracert ipv6 %s',
)
),
Hi,
traceroute to my MikroTik is not working.
I get the error message:
expected end of command (line 1 column 43)
Ping and BGP informations are working.
Hope you can help me!
Br
Markus
hi, did you see that on the mikrotik router with errror Command failed anda graphic erro Unable to get BGP information.
Thx
Hi,
Can you advise how can we use userid/admin for access to the router for the script?
Hi
When using Mikrotik to login to our routers via this script, we see in the log that the user logs in/out within a matter of a second, and the page returns
Telnet error: Login failed.
As i said, the user logs in and out straight away we can verify this in the log
Please help with this issue.
Daniel
When attempting the traceroute option via the web interface, I get an error
Command: /tool traceroute 8.8.8.8 size=60 count=1
expected end of command (line 1 column 42)
I've tried multiple options.
When I perform it manually using plink:
plink -P 2244 REDACTED@REDACTED '/tool traceroute 8.8.8.8 size=60 count=1'
# ADDRESS LOSS SENT LAST AVG BEST WORST
1 0% 1 0ms
1 REDACTED 0% 1 20.4ms 20.4 20.4 20.4
2 REDACTED 0% 1 28.4ms 28.4 28.4 28.4
3 REDACTED 0% 1 20.8ms 20.8 20.8 20.8
4 8.8.8.8 0% 1 20.3ms 20.3 20.3 20.3
however there is a bit of a pause after the first hop.
If performed on the device itself, the pause is when it says:
-[Q quit|C-z pause]-
before outputting the traceroute results.
But it's not clear if this is the reason for the error in the web interface.
Hi everyone, I need to enter the command (screen-length 0 temporary) before the Huawei router commands. display without any breaks
Ping on cisco xe devices only output one ping and no ping ms info
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.133.168.1, timeout is 2 seconds:
Packet sent with a source address of 216.66.73.62
!
Hello Dmitry!
How are you ?
We can come back to this, see if you can access our router to implement what is needed to improve the Looking Glass project for the Huawei NE40 router.
Any questions please contact me
Have a nice day
Hi guys.
Im trying to check about why this yelds comand failed when trying to query my mkt devices.
After manually checking those commands they works ok when launch on mikrotik device.
I will try modifing the index.php file and will come back.
Regards.
Hello, I can't connect with a IOS XR router, i have a "connection failed' with telnet and a "command failed" with ssh.
I test the looking glass with a router IOS and it works
Can you advice me please
Hi Guys
Whenever i try and run any commands via the ssh protocol within your script, i get thrown back the following error
Command failed.
Any idea why this may be happening?
In the show ip bgp neighbors command in IOS-XR, the response does not match the neighbor's IP address.
In IOS it is followed by a comma, not in IOX-XR.
--- index.php 2018-04-24 15:12:36.000000000 -0300
+++ index.php.orig 2018-01-08 16:53:19.000000000 -0300
@@ -565,11 +565,8 @@
}
}
}
-/*
-* if ($fp = @popen('echo n | '.$_CONFIG['plink'].' '.implode(' ', $params).' '.$exec, 'r'))
-*/
- if ($fp = @popen($_CONFIG['plink'].' '.implode(' ', $params).' 0>&1 '.$exec, 'r'))
+ if ($fp = @popen('echo n | '.$_CONFIG['plink'].' '.implode(' ', $params).' '.$exec, 'r'))
{
while (!feof($fp))
{
@@ -1454,7 +1450,7 @@
if (preg_match("/^show ip bgp n\w*\s+([\d\.]+)/i", $exec) OR
preg_match("/^show ip bgp n\w*$/i", $exec))
{
- if (!isset($lastip) AND preg_match("/^BGP neighbor is ([\d\.]+)(,?)/", $output, $lastip_exp))
+ if (!isset($lastip) AND preg_match("/^BGP neighbor is ([\d\.]+),/", $output, $lastip_exp))
{
$lastip = $lastip_exp[1];
}
@@ -1518,7 +1514,7 @@
$output
);
$output = preg_replace_callback(
- "/^(BGP neighbor is )(\d+\.\d+\.\d+\.\d+)(,?)/",
+ "/^(BGP neighbor is )(\d+\.\d+\.\d+\.\d+)(,)/",
function ($matches) {
return $matches[1].link_whois($matches[2]).$matches[3];
},
Ping/Traceroute commands seem to fail with the following error showing in my web server log:
FATAL ERROR: Remote side unexpectedly closed network connection
The command does run, however only for the first ping/traceroute hop:
Command: traceroute ip 8.8.8.8
Type escape sequence to abort.
Tracing the route to google-public-dns-a.google.com (8.8.8.8)
VRF info: (vrf in name/id, vrf out name/id)
1 116.212.x.x [AS XXXX] 2 msec
Command: ping ip 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!
Running 15.7(3)m3 on the router and the latest code from the repo. I have just set this up so unsure if it's ever worked before.
Hi, any chance of adding support for Huawei routers (comware) ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.