Anyone know how, trying to give a device static ip my isp gave me.
Friend told me it must be done in the router and something about port fowarding
also been part of it
Way over my head in this.The static ip is for storage device just don't know how it's done.
I can give it an ip from the router that all start with 192..but when i try the isp ones
says not valid ip.something i must be doing wrong
#!/bin/sh
WAN_IF=$(nvram get wan0_ifname)
STATIC_NETMASK=255.255.255.248 # <<- Change this?...Provided by ISP e.g. covers 8 I/P addresses
VIRTUAL_IF=0
STATIC_WAN_IP=WAN.xxx.xxx.XXX # <<- Change this....First Static public I/P provided by ISP
LAN_IP_FOR_STATIC_WAN_IP=192.zzz.zzz.ZZZ # <<- Change this....First LAN device I/P to be referenced by First public Static I/P
# Map the public WAN I/P to private LAN device
ifconfig $WAN_IF:$VIRTUAL_IF $STATIC_WAN_IP netmask $STATIC_NETMASK up
iptables -t nat -A PREROUTING -i $WAN_IF -d $STATIC_WAN_IP -j DNAT --to-destination $LAN_IP_FOR_STATIC_WAN_IP
iptables -t nat -I POSTROUTING -s $LAN_IP_FOR_STATIC_WAN_IP -j SNAT --to $STATIC_WAN_IP
# Repeat for next static WAN/LAN device......
VIRTUAL_IF=$(($VIRTUAL_IF + 1))
STATIC_WAN_IP=xxx.xxx.xxx.XXX2 # <<- Change this....Second Static public I/P provided by ISP
LAN_IP_FOR_STATIC_WAN_IP=192.xxx.xxx.ZZZ2 # <<- Change this....Second LAN device I/P to be referenced by Second public Static I/P
ifconfig $WAN_IF:$VIRTUAL_IF $STATIC_WAN_IP netmask $STATIC_NETMASK up
iptables -t nat -A PREROUTING -i $WAN_IF -d $STATIC_WAN_IP -j DNAT --to-destination $LAN_IP_FOR_STATIC_WAN_IP
iptables -t nat -I POSTROUTING -s $LAN_IP_FOR_STATIC_WAN_IP -j SNAT --to $STATIC_WAN_IP
We use essential cookies to make this site work, and optional cookies to enhance your experience.