Author Topic: adding additional ip addresses to router  (Read 1088 times)

kenknight

  • Calf
  • *
  • Posts: 1
adding additional ip addresses to router
« on: March 24, 2011, 01:06:50 pm »

Hi all,

 

I purchased a few WHR-HP-GN routers and am trying to add some additional WAN ip addresses and route packets hitting those addresses to specific internal IP's.  I have done this on MANY other routers including some older buffalo routers, however, nothing I've tried to date is working.  Here is the sample script I'm using and this is working on several other routers running the dd-wrt core.

 

 

# Linux VM servers
/usr/sbin/ip addr add xx.xx.xx.xx/0 dev vlan1
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.100.45 -j SNAT --to xx.xx.xx.xx
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 21 -j DNAT --to-destination 192.168.100.45:21
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 21 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 80 -j DNAT --to-destination 192.168.100.45:80
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 80 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 20 -j DNAT --to-destination 192.168.100.45:20
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 20 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p udp -d xx.xx.xx.xx --dport 53 -j DNAT --to-destination 192.168.100.45:53
/usr/sbin/iptables -I FORWARD -p udp -d 192.168.100.45 --dport 53 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 443 -j DNAT --to-destination 192.168.100.45:443
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 443 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 3389 -j DNAT --to-destination 192.168.100.45:3389
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 3389 -j ACCEPT
/usr/sbin/iptables -t nat -I PREROUTING 1 -p tcp -d xx.xx.xx.xx --dport 81 -j DNAT --to-destination 192.168.100.45:81
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.100.45 --dport 81 -j ACCEPT
Any suggestions on why this might not be working would be greatful.  On my other routers, after reboot, I can immediately ping the new ip address and get replies.
Thanks,
Ken