Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to get an HTTP server up on 2 IP addresses.

What i have at the moment is the Server connects to 2 routers..

                         --> Router 1 w/ Static IP (192.168.1.1)
HTTP Server   -->  Switch 
                         --> Router 2 w/ Static IP (192.168.1.2)

But the HTTP Server's NIC can be set to 1 gateway only (Router 1)

both routers have DMZ settings for the HTTP Server so there are no firewall issues..

Traffic through Router 1 gets thru to the server, but traffic from Router 2 times out.. (kinda expecting that)

So this is where I am.. how would you guys recommend me to proceed?

I was thinking of adding another NIC to the HTTP Server so i can set that to GATEWAY 2.. i think it'll work that way but i wanted to know if it would work before i even bother. Or perhaps there's a better way of doing things?

Regards to all

share|improve this question

4 Answers 4

You are correct, you cannot have two NICs with different Gateway if they are on the same subnet. What you can do is make the 2nd Router 192.168.2.1 (I assume class C 255.255.255.0 for subnet mask). Then give the 2nd NIC an IP from the 2.x subnet and now the server will respond to traffic coming from either router.

There are still other things to consider, such as DNS. You will need a smart DNS solution that can recognize that ISP 1 (Router 1) is down and give end-users only the IP of ISP 2 ( Router 2) until ISP 1 comes back on line.

Your easiest way to achieve the DNS portion of this is by using a special ISP load balancer, like from barracuda or www.elfiq.com and there are many others.

share|improve this answer
    
Thanks for the confirmation and suggestions, and WOW, i didn't think about the DNS part.. thanks for reminding me.. I'll definitely look into this... –  BrownChiLD Mar 12 at 13:37

You really need to use some network-based failover solution (first-hop redundancy protocol) like HSRP/VRRP/GLBP between your two gateway routers. If your gateways are Cisco routers you can use the 'track' command to ensure the path past the gateway is valid before the router will be the active forwarder.

Otherwise you could use static routes on your web server, just route 0.0.0.0 0.0.0.0 to each gateway and you should have some sort of basic outbound load-balancing but you will lack any kind of path failure detection.

share|improve this answer
    
thanks.. but a bit complicated for my purpose mate hehe. thanks though, good to know –  BrownChiLD Mar 12 at 13:34
    
Late reply... if you want to use the same subnet you have to make sure your host will reply out the same interface as it receives the packet on. Otherwise you are stuck with actually using your network for redundancy, like you should with a single-homed, non-network-aware device. –  cpt_fink Jul 3 at 2:43

The simplest solution is to assign the server two private IP addresses as well. Have each router forward to a different private IP address. You can then use policy-based routing on the reply packets to determine the next hop based on the local source IP address.

So, for example, you could assign the server both 192.168.1.101 and 192.168.1.102 (on the same physical interface). Have the 192.168.1.1 router forward to 192.168.1.101 and the 192.168.1.2 router forward to 192.168.1.102. You can then determine how to route the reply packets based on the local source IP -- if 192.168.1.101, the next hop is 192.168.1.1 -- if 192.168.1.102, the next hop is 192.168.1.2.

share|improve this answer
    
The server doesn't really need to know where traffic is coming from, but that's a good idea mate.. as for the rest of your suggestion, thanks very much! Appreciated, you are. :P PS- but as per User3404205 suggests, i may need to use different subnet (?) for the 2nd NIC –  BrownChiLD Mar 12 at 13:33

If you have the flexibility to change the routers it would be easiest to put them on different subnets. Then you can multi-net the NIC and everything will work.

If the two routers connect to different outside networks you could add a static route via router 2 - there is no reason not to have two gateways on the same LAN, they just have to go to different places. You can only have one DEFAULT gateway, but you can have any number of explicit gateways.

If you can't do that and your server is Linux you could fake it by re-writing the router 2 addresses in both directions so the IP stack thinks it is two separate networks.

I suspect a second NIC would not work as the routing table would still default to sending all the responses to Router 1.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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