View previous topic :: View next topic |
Author |
Message |
thedeadlyquiche n00b
Joined: 10 May 2006 Posts: 33
|
Posted: Sun Mar 16, 2008 6:13 am Post subject: Differentiating which network to use based on port? |
|
|
Hey all, I was wondering it it's possible to setup my computer to run on two different networks with two different internet connections, then make it use a different connection for different programs / ports.
Such as running a game server off the Ethernet connection and my vnc connection off the wireless connection. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23062
|
Posted: Sun Mar 16, 2008 3:51 pm Post subject: |
|
|
Yes. For exposing different servers to different networks, just bind the server to a network-specific address. For example, suppose your Ethernet connection issues 192.168.0.x addresses and your wireless connection uses 192.168.1.x addresses. A server bound to 0.0.0.0 can accept connections to either address. A server bound to your 192.168.0.x address will only accept connections to that address. The OS will reject connections to that port on 192.168.1.x because no process is listening there. |
|
Back to top |
|
|
thedeadlyquiche n00b
Joined: 10 May 2006 Posts: 33
|
Posted: Sun Mar 16, 2008 5:43 pm Post subject: |
|
|
Awesome.
Is this application specific or is it something within Linux's configuration? |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23062
|
Posted: Sun Mar 16, 2008 6:54 pm Post subject: |
|
|
The individual servers need to bind to the correct address. That is configured on a per-application basis. You can check if you have it correct by using netstat -l or lsof -p pid-of-server. For those rare programs which cannot be configured to listen on only one address, you could use the Linux packet filter to DROP requests to the "wrong" IP address. |
|
Back to top |
|
|
|