DDNS + Firewall Shell Command

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
xes_
DD-WRT Novice


Joined: 21 Oct 2016
Posts: 31

PostPosted: Thu Sep 07, 2017 13:19    Post subject: DDNS + Firewall Shell Command Reply with quote
Hi,

I have firewall commands set on the dd-wrt interface where I put some rules.

My address is dynamic.
I need that the firewall commands was re-run when the public ip change.

Is it possible to configure inadyn to run a script or a command when ip change?

Thanks,
Sponsor
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6868
Location: Romerike, Norway

PostPosted: Thu Sep 07, 2017 17:29    Post subject: Reply with quote
What rules? Some examples is needed.
xes_
DD-WRT Novice


Joined: 21 Oct 2016
Posts: 31

PostPosted: Fri Sep 08, 2017 5:43    Post subject: Reply with quote
Hi,

Theses rules themself have no relation with my issue, I just need to re-execute them when IP change.


Quote:

WAN=mydomain.com <= The domain has a dynamic IP and is automatically updated by DDNS

iptables -t mangle -A PREROUTING -i ! `get_wanface` -d ${WAN} -j MARK --set-mark 0xd001
iptables -t nat -A POSTROUTING -m mark --mark 0xd001 -j MASQUERADE

iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10001 -j DNAT --to 192.168.0.100:10001
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10002 -j DNAT --to 192.168.0.100:10002
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10003 -j DNAT --to 192.168.0.100:10003
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10004 -j DNAT --to 192.168.0.100:10004
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10005 -j DNAT --to 192.168.0.100:10005
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10006 -j DNAT --to 192.168.0.100:10006
iptables -t nat -I PREROUTING -s 192.168.0.0/24 -d ${WAN} -p tcp --dport 10007 -j DNAT --to 192.168.0.100:10007

iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -j MASQUERADE
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6868
Location: Romerike, Norway

PostPosted: Fri Sep 08, 2017 7:25    Post subject: Reply with quote
If I understand you correctly, there is local clients that is accessing mydomain.com which is a local server.

A better approatch is to use a local dns server that resolves the domain to the private address. Dnsmasq on the router can be used for that.
xes_
DD-WRT Novice


Joined: 21 Oct 2016
Posts: 31

PostPosted: Fri Sep 08, 2017 7:42    Post subject: Reply with quote
To resume (but it's not the issue and all of this works)

Schema (The public IP is not the real one):

Internet <-> [83.194.234.157 | ISP BOX | 192.168.1.1] <-> [192.168.1.254 | DD WRT | 192.168.0.254] <-> LAN

I have no choice and I need to use the ISP Box (French Orange Livebox) and box don't have any bridge mode.
I can only set on ISP BOX a DMZ to forward ports to the DD-WRT.

The ISP Box have another issue. It's not possible to access to the forwarded ports from the LAN with the public IP. (For instance, from Internet my web server work: https://83.194.234.157 but not from LAN and I don't want to access to my web server from local IP because SSL certificate is only correct for the Public IP)

It's for all theses reasons I need to set some extra rules and specially the mangle prerouting, the nat postrouting and forward the different ports


-

All of this works but by issue here is just to restart the firewall script when the IP change...

Thanks,
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum