Answer the question
In order to leave comments, you need to log in
How to open port on dd-wrt?
Good afternoon!
There is a Dlink-DIR-632A router with DD-WRT v24-sp2 , as well as a LAN connection via PPPoE.
Nginx runs locally on the home server, and it calmly responds to the internal IP or internal address (DNSMasq).
How to forward 80, 443 port to a local address?
I tried via WEB - NAT / Port Forwarding - 0 reactions
I tried via ssh, but as I understand it, it sneezes on iptables, because I tried to drop port 80 in general, but I still got into the WRT console via external IP
I tried it with a self-written script:
#!/usr/sh
mask=255.255.255.0
wan=ppp0
server_dest_ip=192.168.1.100
iptables -A FORWARD -s $mask/8 -j ACCEPT
iptables -A FORWARD -d $mask/8 -j ACCEPT
iptables -I POSTROUTING -t nat -o $wan -d $mask/8 -j MASQUERADE
for port in 80 443 8080; do
iptables -t nat -A PREROUTING -i $mask -p tcp --dport $port -j DNAT --to-dest $server_dest_ip:$port
iptables -t nat -A PREROUTING -i $mask -p udp --dport $port -j DNAT --to-dest $server_dest_ip:$port
done
Answer the question
In order to leave comments, you need to log in
It turned out that if you connect to the server from another network (mobile, proxy), it responds. Does not respond only in one case, if you connect via external IP while on the same network.
Decided savagely.
1) Configured NAT/Port Forwarding
2) Added the following script to Administration/Commands -> Startup
cat <<EOF >> /etc/hosts
# Local server
192.168.1.100 myawesomesite.com
EOF
restart_dns
If through the web interface, the "NAT / QoS" section, the "Port Forwarding" tab
Application-any name
Protocol-for the web tcp
Source Net-leave empty
Port from-80
IP Address-your
Port to-80
Also for port 443
Same router and firmware all works
Here is an example of forwarding from external port 8000 to port 80 to a LAN host:
# iptables -t nat -I PREROUTING -p tcp --dport 8000 -j DNAT --to 192.168.1.40:80
# iptables -I FORWARD -p tcp -d 192.168.1.40 --dport 80 -j ACCEPT
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question