Tag Archives: Linux

Making a linux VM running in Windows Azure auto-register in internal DNS.

Friday fun with other operating systems! Being a Windows guy with limited knowledge in Linux these things always burns a fuse it seems. Well, I have a customer spawning Linux vm:s in Windows Azure wanting these to automatically register their A-records in DNS just like Windows does. Well, seems there’s no easy way for this, but I’ve found a solution. Keep in mind that there might be an easier solution but for a Windows admin this at least works.

Prereqs for this to work:

  1. Your DNS-zone must accept unsecure updates.
  2. Your Linux machine must have its hostname updated with the FQDN.
  3. You must have a gateway to your internal network configured, not included in this article, no need to look for it. Look under “TV” for a guide on how to set that up.

Solution 1

Make sure your zone allows unsecure updates. Start DNS MMC, right-click your zone, select properties, edit your zone to allow Nonsecure and secure updates.

dns

 

 

 

 

 

 

 

Solution 2

Edit /etc/hostname and add your unqualified hostname:

ns-ub01

Edit /etc/hosts:

sudo vi /etc/hosts

Add an entry of your desired hostname by replacing ns-ub01.labs.nullsession.com ns-ub01 where ns-ub01.labs.nullsession.com is the fully qualified hostname and ns-ub01 is hostname.

127.0.1.1 ns-ub01.labs.nullsession.com ns-ub01

Test your configuration by opening a terminal and enter the below commands:
“hostname<enter”>: This should output ns-ub01

“hostname -f”: This should output ns-ub01.labs.nullsession.com

 

You could also update it with the command hostname servernamn.fqdn which updates it but only lasts until reboot.

 

The script:

#!/bin/bash

_HOST=$(hostname)
_IP=$(ifconfig eth0 | grep ‘inet addr:’ | cut -d: -f2 | awk ‘{ print $1}’)

nsupdate << EOF
server dnsservername.fqdn (dc01.labs.nullsession.com)
zone fqdn (labs.nullsession.com)
update delete $_HOST A
update add $_HOST 86400 A $_IP
send
EOF

 

The easiest way is to schedule the script with cron so that it runs periodically, this also updates the DNS in case the ip changes. The script is only tested on Ubuntu, but should at least get you started on other distros as well.

The famous Microsoft iSCSI target

Update: Don’t miss http://www.nullsession.com/2009/06/17/a-guide-to-iscsi-target-software-for-windows/ where I’m listing different iSCSI target software. Or the video which shows the installation of them and how to add one basic target. (I’m not testing advanced features or listing them though since we all have different needs and budgets)

Jose Barreto has posted an article on how to install the iSCSI software target on Windows Server 2008 over on Technet blogs: http://blogs.technet.com/josebda/archive/2008/05/21/installing-the-vds-hardware-provider-for-the-microsoft-iscsi-software-target-on-windows-server-2008.aspx. What’s kind of annoying is that the software is only released to OEM’s and not available from Microsoft otherwise. Today when the hype of virtualization is upon us again it’d be nice with that piece of complement in the setup. If you want to run Windows Server 2008 as an iSCSI target today there’s still software available.

I’ve found the following:

Windows:
Starwind from Rocket Division
MySan from Nimbus (not tested on 2008)

Linux:
iSCSI Enterprise Target Project

Have you found any other iSCSI target software? Let me know!