Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Differentiating which network to use based on port?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
thedeadlyquiche
n00b
n00b


Joined: 10 May 2006
Posts: 33

PostPosted: Sun Mar 16, 2008 6:13 am    Post subject: Differentiating which network to use based on port? Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23062

PostPosted: Sun Mar 16, 2008 3:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
thedeadlyquiche
n00b
n00b


Joined: 10 May 2006
Posts: 33

PostPosted: Sun Mar 16, 2008 5:43 pm    Post subject: Reply with quote

Awesome.
Is this application specific or is it something within Linux's configuration?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23062

PostPosted: Sun Mar 16, 2008 6:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum