2012年5月24日 星期四

Allowing ddclient on vyatta to push NAT outside IP to DDNS provider

I have a vyatta vpn appliance sit behind NAT and have a need to use dynamic DNS to update its public IP to dynamic dns provide like no-ip.com. So I ran the suggested commands mentioned in their doc

vyatta@vyatta# set service dns dynamic interface eth0 service dyndns host-name myvyattatestbox.no-ip.org
[edit]
vyatta@vyatta# set service dns dynamic interface eth0 service dyndns server dynupdate.no-ip.com
[edit]
vyatta@vyatta# set service dns dynamic interface eth0 service dyndns login myusername
[edit]
vyatta@vyatta# set service dns dynamic interface eth0 service dyndns password mypassword
[edit]

vyatta@vyatta# commit
[edit]

However, somehow it updated its internal IP of the nic instead of the NAT outside public IP address.

$ show dns dynamic status
interface    : eth0
ip address   : 192.168.0.80
host-name    : myvyattatestbox.no-ip.org
last update  : Wed May 11 04:07:20 2012
update-status: good


It looks like the way that vyatta will update the IP binded to interface though I would expect it to update with the NAT outside address. To let vyatta to update with the NAT outside, we could make a trick on /opt/vyatta/sbin/vyatta-dynamic-dns.pl, replace the line from

     97     #$output .= "use=if, if=$interface\n\n\n";

to
     98     $output .= "use=web, web=checkip.dyndns.com/, web-skip='IP Address: '\n";

By replacing the line, vyatta will query the NAT outside IP against checkip.dyndns.com and then use the polled IP to update against the dynamic DNS provider.

$ show dns dynamic status
interface    : eth0
ip address   : 1.2.3.4
host-name    : myvyattatestbox.no-ip.org
last update  : Wed May 11 05:07:20 2012
update-status: good



沒有留言:

張貼留言