I have setup bind server using the following link
And added few extra lines in /etc/bind/named.conf.options
as
Recursion yes;
allow-query { 0.0.0.0/0; };
and an extra lamp server with web server for example.com hosted on bind server machine with ip 192.168.2.2.
Now I configured two separate machines with ip 192.168.2.3 and 2.4 with dns 2.2 for each.
Now I want that machine 192.168.2.3 should be able to open locally hosted example.com and all other queries pertaining to other websites should be resolved by 8.8.8.8
And machine with 192.168.2.4 should not be able to resolve locally hosted example.com but its dns queries should directly be resolved by 8.8.8.8 open dns.
Both machines dns will remain 192.168.2.2 but above scenario should also be fulfilled.