PugJr Posted January 28, 2010 Share Posted January 28, 2010 Lets say I have two servers both with the same I.P. and both the default HTTP port both hosting Apache. A client makes a request. What happens? Is it whichever is higher up on the router that they are both connected to or would they possibly both respond or what? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 28, 2010 Share Posted January 28, 2010 Two computers on the same network CANNOT have the same IP address. What exactly is your question about? Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Two computers on the same network CANNOT have the same IP address. What exactly is your question about? They can't have the same lan I.P. but internet I.P. they surely can. For instance, I have two computers, one is 192.168.1.1 and the other 192.168.1.2 both are under the same exact internet I.P. and port. Which one would reply to the clients request or both? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Two computers on the same network CANNOT have the same IP address. What exactly is your question about? They can't have the same lan I.P. but internet I.P. they surely can. For instance, I have two computers, one is 192.168.1.1 and the other 192.168.1.2 both are under the same exact internet I.P. and port. Which one would reply to the clients request or both? Read the previous post. You can only map one port via your router to be accessable through the internet. You must physically map (forward) xx.xx.xx.xx:80 -> 192.168.1.2:80, You obviously can't map both. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 I have two servers running with the same exact port AND I.P. Unless I'm misunderstanding what you guys are saying? This might raise a question why I'm asking this if I have already tested it and see that it somehow works, but one was running a computer game server with the same port and the other was Apache running the same port. But what if they are both Apache? Although now you bring it up, oni-kun, I'm a bit confused on how its working because how can it identify which packet goes to which computer if they are the same exact IP:Port? Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2010 Share Posted January 28, 2010 I have several web servers (5 currently) running on port 80 within my local network, all accessible via 1 ip address from outside. What I have done is setup 1 server as a proxy (using Apache's mod_proxy), this proxy then forwards requests to the appropriate internal server based on the host name used to make the request. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Thats a good idea, thorpe, but still not my original question answered. I can run the same exact port and I.P. on 2 different servers and somehow both properly work which is Apache for one server and a computer game server for the other (So don't tell me its impossible to use the same port and I.P. for the 2 different servers). Now how do you figure that this can happen since they are the same IP:PORT? So would it have to be that the router sends packets to both of the servers under the same port? Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2010 Share Posted January 28, 2010 I'm not sure how that would be possible. Can we see a screen shot of your router's forwarding setup? Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Don't know whats there to see, but okay. As you can see, both have the same port, just different computers. WC3 being the computer game, Server being Apache. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Imagine trying this: header('Location: ' . $site1 && $site2); It's impossible! Use a network switch, proxy (as thorpe mentioned) or a different port. The client connects to what the router tells it to, two servers at once (in your example), It can't be done. Why can't your forward apache to 80, and second apache to 8080? That's hardly out of stanard spec, if you are specifically just wanting two different servers accessable. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Why is it impossible for the router to send the packets to both 192.168.2.6 and 192.168.2.8? Now if its a WC3 packet and apache gets it, it ignores the packet as its not readable to it, and while if WC3 gets an apache packet, it ignores it? All I see is this: Client connects to my I.P.:PORT, now my router tells 192.168.2.6 AND 192.168.2.8 the same identical packet. Each server responds on it if it can properly read the packet. If it can't, it doesn't, if it can, it does. Nothing is techincally impossible in this case, but I'm not even sure if thats what its doing. I suppose I could prove it with packet logger and see if both servers get packets which only one is supposed to get. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Why is it impossible for the router to send the packets to both 192.168.2.6 and 192.168.2.8? Now if its a WC3 packet and apache gets it, it ignores the packet as its not readable to it, and while if WC3 gets an apache packet, it ignores it? All I see is this: Client connects to my I.P.:PORT, now my router tells 192.168.2.6 AND 192.168.2.8 the same identical packet. Each server responds on it if it can properly read the packet. If it can't, it doesn't, if it can, it does. Nothing is techincally impossible in this case, but I'm not even sure if thats what its doing. I suppose I could prove it with packet logger and see if both servers get packets which only one is supposed to get. Do you understand what port forwarding is? Apache should by default be on port 80. Meaning you should map port TCP 80 -> 192.x.x.1 (apache server) Then you should forward map port 5550 to 192.x.x.2 (game server) Does that make sense? If you want DNS to have a wildcard resolve, that is not secure by any means. The Client DNS should not need to read both end hosts and decide magically what to connect to. Quote Link to comment Share on other sites More sharing options...
akitchin Posted January 28, 2010 Share Posted January 28, 2010 i think the confusion that exists between the two sides of this thread is that a router will NOT duplicate packets and redistribute them. it will simply forward the single packet to one local IP. the fact that both servers work without conflict is likely just the result of the outside source re-pinging the WAN connection with the same packet upon failure. i'm no server guru, but a router isn't built to do what you claim it is doing (which is why the people attempting to help are confused about the question). Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Akitchin, would you explain that a bit newbier? I don't really understand what you mean. So are you saying that when a packet is sent to me, the client sends it twice and then it gets split to each server? I'm afraid I don't really understand what you mean. :-\ P.S I wasn't exactly claiming thats what its doing, I just was making a hypothesis thats what it was doing since you guys have been so helpful in saying what could be doing it. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Akitchin, would you explain that a bit newbier? I don't really understand what you mean. So are you saying that when a packet is sent to me, the client sends it twice and then it gets split to each server? I'm afraid I don't really understand what you mean. :-\ P.S I wasn't exactly claiming thats what its doing, I just was making a hypothesis thats what it was doing since you guys have been so helpful in saying what could be doing it. Host: <extern IP>:5550 DNS: Host <extern IP>:5550 resolves to <extern IP> Host: <extern IP> DNS: Binding to socket NAT: Binds to 192.0.0.1 DNS: Unable to resolve 192.0.0.1:5550 (Method not allowed) <-Gameserver DNS: .. DNS: Connecting to next available port,-> DNS records resoves to <Extern IP> DNS: Binding to socket NAT: Binds to 192.0.0.2 DNS: Connecting to Default 192.0.0.2:80<-Apache DNS: Method: HTTP/1.1 There you go. Now note the client's DNS will not automagically do this, The router is using a hit and miss technique. You should map different ports to different clients to maintain NAT integrety. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Oni-kun, why does Apache go to :80? Was that a typo on your side to be intended as :5550? Or is there some significance about being :80? (:80 is blocked in my router.) Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Oni-kun, why does Apache go to :80? Was that a typo on your side to be intended as :5550? Or is there some significance about being :80? (:80 is blocked in my router.) Did you manually set Apache to run under port 5550? Because if you go <yourIP>:5550, It won't even read the server that has apache on it. Because apache was set up to run under port 80. If it connects to 192.0.0.2:5550, It will not be found. And will either default to :80 (and find apache) or return a METHOD NOT ALLOWED flag. Again, you should port different ports per forward. As mentioned, You are telling your Router to forward an external port to two clients, which the client should handle, in this case you're not using a proxy, so it's a hit and miss scenario, and incorrect setup. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Yes, I had manually set apache to 5550. Unless somehow my website is working through port 80 when its closed. So its just a typo then without any significance to it? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Yes, I had manually set apache to 5550. Unless somehow my website is working through port 80 when its closed. So its just a typo then without any significance to it? Then if you are connecting through the external IP with port 5550, It will query the NAT to resolve both clients, as your game server obviously can't accept the HTTP protocol, it will either throw an error (or in your router's lucky case) resolve to the other client. Why do you want this set up that way? Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Just wondering how you would have 1 domain over 2 servers so was wondering if that would work but clearly it does not. Guess thats the next question: How do people have 1 domain with X amount of servers? You could use thorpes idea where you have a computer that always takes the requests and then gives the request to one of his local servers, but what happens if you have 50000 requests a second? Surely that isn't what google is doing. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Just wondering how you would have 1 domain over 2 servers so was wondering if that would work but clearly it does not. Guess thats the next question: How do people have 1 domain with X amount of servers? You could use thorpes idea where you have a computer that always takes the requests and then gives the request to one of his local servers, but what happens if you have 50000 requests a second? Surely that isn't what google is doing. There should be a network switch. An example using the MX port.. But it gives you the idea of how Google uses load balancing servers etc. ns1.domain.com. IN A 192.168.1.5 ns2.domain.com. IN A 192.168.1.6 ns3.domain.com. IN A 192.168.1.10 ns4.domain.com. IN A 192.168.1.11 DNS would resolve to another client. Which is what you're wanting to do. Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 Uh...*scratch head*...So exactly what would I need to do? Would I buy a piece of hardware that does this or what...? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 Uh...*scratch head*...So exactly what would I need to do? Would I buy a piece of hardware that does this or what...? You have not told us why you are wanting to forward port 5550 into Apache. Are you wanting it so when they enter the port through the game, it connects there, and if they view for web browser it goes to the apache instead? Quote Link to comment Share on other sites More sharing options...
PugJr Posted January 28, 2010 Author Share Posted January 28, 2010 No no, I mean now if I had 2 apache servers (The servers will have the same files as well. So lets say both servers are used as a calculator and right now one is getting overloaded so I need to split the work load of that one server unto the other), not 1 apache and 1 game. It doesn't matter what the ports are anymore (Can't be 1-1000 though), now its just a question of how would I get 1 domain over X amount of servers? So ultimately when someone connects to IP:5550 (As it would be with google.com:80 or whatever the default port is) it will randomly (Doesn't have to be randomly, but atleast some method of balancing the requests to the 2 servers) pick one of my 2 servers and then respond with the same IP:Port. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 28, 2010 Share Posted January 28, 2010 No no, I mean now if I had 2 apache servers (The servers will have the same files as well. So lets say both servers are used as a calculator and right now one is getting overloaded so I need to split the work load of that one server unto the other), not 1 apache and 1 game. It doesn't matter what the ports are anymore (Can't be 1-1000 though), now its just a question of how would I get 1 domain over X amount of servers? So ultimately when someone connects to IP:5550 (As it would be with google.com:80 or whatever the default port is) it will randomly (Doesn't have to be randomly, but atleast some method of balancing the requests to the 2 servers) pick one of my 2 servers and then respond with the same IP:Port. http://content.websitegear.com/article/load_balance_dns.htm DNS load balancing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.