I have one Quagga router running on Ubuntu Trusty Tahr and I'm planning to install Lubuntu on a old laptop to turn it into a router. Will they ping each other? Thanks
Yes they can. As Everton mentioned they can already do so even before/during the installation. Quagga is a software on top of a linux/unix kernel. Much the same as, let's say, Firefox on top of Windows.
You can install Firefox on Windows on one machine and install Chrome on Linux on another machine. Regardless, the two machines are able to talk to each other on a TCP/IP level (ping each other) long before the browsers are installed. The network configuration is done long before Firefox or Chrome are ever installed. You need of course to configure it according to normal network standards, so they must be in the same subnet or have the correct router configured.
If you're asking whether they can exchange information other than ICMP pings, that depends primarily on software configuration and your Lubuntu installation. Debian/Ubuntu/Lubuntu also has similar software for OSPF, RIP and BGP servers, that you can install. Then they would be able to exchange routing information to each other.
For example you can install an OSPF daemon on your Lubuntu that exchanges routing information with your Quagga OSPF daemon. Each individual program will be able to communicate with it's counterpart on the other machine. (for example BGP->BGP daemon, OSPF->OSPF daemon)