# multiple routers one webserver



## antolap (Feb 21, 2016)

one router (192.168.0.1) redirects port 80 to freebsd server 192.168.0.109
another router (192.168.0.2) redirects port 80 to freebsd server 192.168.0.109
another router (192.168.0.3) redirects port 80 to freebsd server 192.168.0.109
another router (192.168.0.4) redirects port 80 to freebsd server 192.168.0.109


default gateway of 192.168.0.109 is 192.168.0.1, so only http://public-ip-of-router-192.168.0.1 works , accessing http on other routers doesn't work

how to access port 80 of 192.168.0.109 with multiple IP address (=mutiple routers)?


----------



## tingo (Feb 22, 2016)

The question should be: why the complicated setup?
Also, you got your terminology mixed up; redirecting traffic is done by firewall (or application proxies), not routers. Routers only route traffic 
(Ok, it is possible to have both a router and a firewall on the same machine)


----------



## SirDice (Feb 24, 2016)

There's no way to tell from which router the traffic originates, at least not on the IP level. Unless each of the routers serves different subnets but I'm assuming they all receive connections originating on the internet?


----------



## antolap (Feb 25, 2016)

for example:
router one - private ip 192.168.0.1 - public ip 79.xx.xx.1 redirects port 80 to private ip 192.168.0.109
router two - private ip 192.168.0.2 - public ip 79.xx.xx.2 redirects port 80 to private ip 192.168.0.109
router three - private ip 192.168.0.3 - public ip 79.xx.xx.3 redirects port 80 to private ip 192.168.0.109
router four - private ip 192.168.0.4 - public ip 79.xx.xx.3 redirects port 80 to private ip 192.168.0.109

this is the configuration of 192.168.0.109
ip 192.168.0.109/16
gateway 192.168.0.1

now:
if someone tries to connect to http://79.xx.xx.1 then 192.168.0.109 replies and all works
while using other public IPs there are problems

I'd like 192.168.0.109 to reply even if someone want to connect to http://79.xx.xx.2 and also http://79.xx.xx.3 and also http://79.xx.xx.4

the problem is that the default gateway points to 192.168.0.1
is there a workaround?

p.s: routers are *dsl cisco routers


----------



## SirDice (Feb 25, 2016)

As I said, there's no way to tell from which router the traffic comes from. So you're going to have to rethink the whole situation.


----------



## PacketMan (Feb 26, 2016)

SirDice is right.

Consider running source NAT on the routers, so that the source address of the http request is changed from the Internet user's address to the router 'inside' address.  The server will respond to the appropriate 192.168.0.x address and then that router will route back to the Internet.

But your design in general is very different, never seen it done that way before.  DSL eh?  Are you trying to get more bandwidth by using multiple DSL connections?


----------



## antolap (Feb 28, 2016)

I'd like to be able to access my server even if one dsl connection is down, using other dsl connections


----------



## PacketMan (Feb 29, 2016)

Then consider trying source NAT on each router I say.


----------



## FKEinternet (Mar 25, 2016)

I would suggest setting up each router to redirect to a different internal IP, e.g.,
192.168.0.1 -> 192.168.0.109
192.168.0.2 -> 192.168.0.110
192.168.0.3 -> 192.168.0.111
192.168.0.4 -> 192.168.0.112

You will then need to set up aliases for the interface in /etc/rc.conf, e.g.,

```
ifconfig_re0="inet 192.168.0.109 netmask 255.255.255.0"
ifconfig_re0_alias0="inet 192.168.0.110 netmask 255.255.255.0"
ifconfig_re0_alias1="inet 192.168.0.111 netmask 255.255.255.0"
ifconfig_re0_alias2="inet 192.168.0.112 netmask 255.255.255.0"
```

You will also have to configure your Web server to listen on all four ports.  For Apache, this means adding multiple Listen directives, and listing each of the IPs in your <VirtualHost> blocks (assuming you are using virtual hosts).


----------

