I am sitting with quite a predicament, I am the happy owner of a model B pi running a raspbian lampi distro. The pi is currently running a little php site which connects to a network of devices and servers running all sorts of apps, including ubuntu machines and mysql databases, this network LAN (Network 1) does have internet access but only via proxy and i cant use it. the pi is also connected to WiFi network which will be used to send out mails via phpmailer and will be used for incoming connections to the pi for users that will use the php site.

Here is a breakdown of the networks Network 1 - LAN 24 Ubuntu Machines running all sorts of scripts 4 Mysql Databases

Network 2 - WiFi Incoming Connections to the pi (Port Forwarding on the router) Purely and internet connection will be used to send mail via php mailer

Now here is my problem, when connected to these two networks i cannot seem to access the internet over the wifi as the lan connection takes over (frustrating)

Is it possible to set Network 1 to only run services such as SSH, Mysql etc ports 22, 3306, 3307 and have Network 2 run Http and smtp ports?

How would i go about doing that. To be honest networking on linux distros is french to me and i have no idea what i am doing. Help would be greatly appreciated.

Please note that i am very new to this type of networking, i have heard people say i must use iproute or iptables but to be honest i have no idea what i am doing there?

  • Seeing something like "i am very new to this type of networking" always makes me curious - What type of networking would be not new to you? More of a rhetorical question than anything else, while the voice in my other ear is whispering "'dumb' means 'without voice' so a 'dumb question' is one that hasn't been asked..." Commented Aug 29, 2023 at 17:59

1 Answer 1


Q: "Is it possible to set Network 1 to only run services?" A: Possible, yes. But completely pointless.

The problem isn't the raspberry or rasbian, but your network configuration. As far as you explained, you need to set up your routes (not in the router, but in your raspbian). The LAN should route just inside of your local network and the wifi connect holds the default route.

I need more explanations about your environment to give the sequence of commands. But just to advance, is a set of files and commands to type to have your setup working as you described.

  • I suggest to search for network and routing tutorials on Linux before. Commented Jun 27, 2014 at 18:33
  • To be honest i have tried majority of the tutorials out there. but as soon as i edit the iptables my internet connection stops working Commented Jun 27, 2014 at 18:50
  • like i said networking is not my strongest point. but i am willing to learn Commented Jun 27, 2014 at 18:50
  • 1
    I think the key is set the wifi router as default gateway. So try this. sudo route add default gw <ip-of-your-router> And then try to ping an IP outside, like Google's DNS: ping Commented Jun 27, 2014 at 19:01
  • yes it does, next issue is to have my phpmailer send emails over the wifi as well Commented Jun 27, 2014 at 20:05

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.