I am quite new to the world of pi and would like to know if the following is possible. I have a r-pi which runs a php based web interface for monitoring machines on the network.

Network 1: Linux Machines SQL Databases No Internet Access LAN Connection

Network 2: Wifi Connection, Internet, Users

What i need to do is have the pi run all my scripts over network 1 (ports 22, 3306, 3307 - Sql & ssh) and then use network 2 to send out mails via php mailer also network 2 is where my users connect to the pi to view the statusses of these machines and run sql queries from the site hosted on the pi.

Is this in anyway possibl;e?

1 Answer 1


Yes, this is very possible. All you need to do is statically assign the IP address your LAN connection, and do not give it a default gateway. If there are other networks that are accessible from that interface, statically route them to the proper router using the ip route add command.

Then on your Internet facing connection, be it through DHCP or also statically assigned, give a default gateway.

This will then force any traffic for an unknown network, I.E. mail.google.com, out the Internet interface with a default gateway, and any traffic for the LAN out the LAN interface.

See http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html for more detailed information and syntax examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.