Setup Multiple static public IPs

Your ISP has given you two public IPs
e.g. two public static ips 111.1.1.1 & 111.1.1.2

I have two internal machines

192.168.10.7 will be my mail server
192.168.10.8 will be my web server

1. Mail server External IP = 111.1.1.1, Internal IP = 192.168.10.7, Port required = 25

2. Webserver server External IP = 111.1.1.2, Internal IP = 192.168.10.8, Port required = 80

Open your tomato router->Administration->Scripts->Firewall

Paste the following ( change the internal\external IP values to your own )

/usr/sbin/ip addr add 111.1.1.1/30 dev vlan1  
/usr/sbin/ip addr add 111.1.1.2/30 dev vlan1

/usr/sbin/iptables -t nat -I PREROUTING -d 111.1.1.1 -j DNAT --to-destination 192.168.1.7
/usr/sbin/iptables -t nat -I PREROUTING -d 111.1.1.2 -j DNAT --to-destination 192.168.1.8

/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.10.7 --dport 25 -j ACCEPT
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.10.8 --dport 80 -j ACCEPT

/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.1.7 -j SNAT --to 111.1.1.1
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.1.8 -j SNAT --to 111.1.1.2
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License