What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

asuswrt merlin multiple static IPs on port 80

Actomic

New Around Here
Hello

I ran in some issues with multiple static IPs on my RT-N66U so I downloaded asuswrt merlin.
So far I just love it.

The problem I have with my router is to have multiple static IPs on my router and route them to a server with the same amount of privat IPs.

The reason I try to accomplish this configuration is a customer thing. He needed his Domains on different IPs for what ever reason.

Example:

Static IP XXX.XXX.001 port 80 -> privat ip 192.168.1.100
Static IP XXX.XXX.002 port 80 -> privat ip 192.168.1.101
Static IP XXX.XXX.003 port 80 -> privat ip 192.168.1.102

and so on.

My first question would be - Is this even possible?

I wrote a net-start script to see if it’s working and it seems to add the eth0:0 with the correct IP. (ifconfig)

#!/bin/sh
ifconfig eth0:0 XXX.XXX.001 netmask 255.255.255.248 up
iptables -t nat -A PREROUTING -i eth0 -d XXX.XXX.001 -j DNAT --to-destination 192.168.1.101
iptables -A FORWARD -i eth0 -p tcp --dport 80 -d 192.168.1.101 -j ACCEPT

But if I try to reach the domain, or even just the static IP from outsite, the router is showing up. No routing to the server what so ever.
The router has one Static IP typed in via the UI with port forwarding port 80 to 192.168.1.100 and all domains under this IP are working fine.

I think I’m a bit lost right now.
 
Never mind I figured out by my self.

I changed my nat-start script like below and it is working now.

#!/bin/sh
ifconfig eth0:0 STATIC IP netmask 255.255.255.248 up
iptables -t nat -I PREROUTING -d STATIC IP -j DNAT --to PRIVAT IP
iptables -t nat -I POSTROUTING -s PRIVAT IP -j SNAT --to STATIC IP
iptables -I FORWARD -d PRIVAT IP -p tcp --dport 80 -j ACCEPT

ifconfig eth0:1 STATIC IP netmask 255.255.255.248 up
iptables -t nat -I PREROUTING -d STATIC IP -j DNAT --to PRIVAT IP
iptables -t nat -I POSTROUTING -s PRIVAT IP -j SNAT --to STATIC IP
iptables -I FORWARD -d PRIVAT IP -p tcp --dport 80 -j ACCEPT

ifconfig eth0:2 STATIC IP netmask 255.255.255.248 up
iptables -t nat -I PREROUTING -d STATIC IP -j DNAT --to PRIVAT IP
iptables -t nat -I POSTROUTING -s PRIVAT IP -j SNAT --to STATIC IP
iptables -I FORWARD -d PRIVAT IP -p tcp --dport 80 -j ACCEPT

ifconfig eth0:3 STATIC IP netmask 255.255.255.248 up
iptables -t nat -I PREROUTING -d STATIC IP -j DNAT --to PRIVAT IP
iptables -t nat -I POSTROUTING -s PRIVAT IP -j SNAT --to STATIC IP
iptables -I FORWARD -d PRIVAT IP -p tcp --dport 80 -j ACCEPT
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top