I wanted to setup a DNS and DHCP server for my home network. I could have used a Linux server to do this, but I wanted to write about server core. I also wanted to mess with working over ssh to do things, I found a SourceForge project that worked really well on 2008 x86, I had errors on 2008 R2 which I’ll poke at next week.

I don’t think I need to explain these things too much, I’ll be using DNS and DHCP as they were intended to be used. I’m installing the SNMP service because I have setup a Zenoss server. It uses SNMP to monitor everything from disk usage to network usage. You will need to have your network card set to a static IP in the proper network for it work correctly.

PowerShell Installation

Windows 2008 Core

Install PowerShell following these instrcuctions.

Windows 2008 R2 Core

Install PowerShell following these instrcuctions.

Install OpenSSH

  • Download the install file
  • The installation takes care of everything but the firewall
  • Allow SSH through the firewall
netsh firewall set portopening TCP 22 “OpenSSH TCP22”

Basic Networking Configuration

netsh interface set interface name=”Local Area Connection” newname=”Public”
netsh interface ipv4 set address name=”Public” static 192.168.1.1 255.255.255.0 192.168.1.254
netsh interface ipv4 set dnsserver name=”Public” static 192.168.1.1 primary
netdom renamecomputer %computername% /newname:{newComputerName}

Installing the required services

DNS

start /w ocsetup DNS-Server-Core-Role

DHCP

start /w ocsetup DHCPServerCore

SNMP

start /w ocsetup SNMP-SC

Configuration of these services can be done via a server with RSAT installed, but that would be no fun at all, so we’ll use the builtin tools to set things up. If you have read the above article you may already have SSH setup and be using puTTY or some other client to perform these tasks.

Configuring the required services

DNS: dnscmd

The following command creates a forward lookup zone and marks it as the primary zone on this server.

dnscmd ServerName /ZoneAdd company.com /Primary /file company.com.dns

The following command creates a reverse lookup zone for 192.168.1.0/24 and marks it as the primary zone

dnscmd ServerName /ZoneAdd 1.168.192.in-addr.arpa /Primary /file 1.168.192.in-addr.arpa.dns

The following command creates an A record for the local server at 192.168.1.1

dnscmd ServerName /RecordAdd company.com @ A 192.168.1.1

The following command creates the reverse record for the server at 192.168.1.1

dnscmd ServerName /RecordAdd 1.168.192.in-addr.arpa 1 PTR company.com

Allow DNS traffic to pass through the firewall

netsh firewall set portopening TCP 53 “DNS-TCP”
netsh firewall set portopening UDP 53 “DNS-UDP”

DNSCMD Resources:

Setup DNS from the command-line

Configuring DNS on Server Core

DNSCMD Cheat Sheet

Administering DNS Server

DHCP: netsh

After installing the DHCP role on the core server you will need to run the following command to allow the service to auto-start

sc config dhcpserver start= auto