Monday, January 28, 2008

Configure DHCP on a Cisco Router or Switch

When it comes to configuring DHCP, you have a number of ways to do it. You can run DHCP service on a Windows or a Linux box or as most networking professionals prefer, run it on an existing router or a switch.

The advantage of this is that you can leverage existing hardware, provide DHCP locally at each site and reduce the dependency on the WAN link.

To configure DHCP on a Cisco router or switch, follow these steps:

1. Configure an IP address on the router's Ethernet port

Router(config)# interface e0/0
Router(config-if)#ip address 172.16.1.1 255.255.255.0
Router(config-if)# no shut

2. Create a DHCP IP address pool for the IP addresses you want to use.

Router(config)# ip dhcp pool dhcppoolname

3. Specify the network and subnet for the addresses you want to use from the pool.

Router(dhcp-config)# network 172.16.1.0 255.255.255.0

4. Specify the DNS domain name for the clients.

Router(dhcp-config)#domain-name yourdomain.com

5.Specify the DNS server.

Router(dhcp-config)#dns-server 172.16.1.2

6. Specify the defaut router (or default gateway)

Router(dhcp-config)#default-router 172.16.1.1

7. Specify the lease duration.

Router(dhcp-config)#lease 7

8. Let's say that you've decided that all IP addresses between .30 and .40 will be used for static IP devices such as mail servers and database servers and you don't want them to be available in the DHCP pool, you can exclude them using "exclude-address" command:

Router(config)#ip dhcp excluded-address 172.16.1.30 172.16.1.40

Now any device that requires an DHCP address on the 172.16.1.0 network will be able to send a DHCP request to 172.16.1.1.

Friday, January 18, 2008

Update Client Status on Long Running Job

Every once in a while I come across a question like: "I have a web application that has a long running job. It could take up to a few dozen minutes to complete. How can I keep the client status updated and not causing a timeout?"

The problem with a web application like this is that if the job run too long, it will cause a script timeout error. One can opt to increase the script timeout to prevent this but when you actually have an error, it would take forever before the client is notified of the error.

People often think that AJAX is the only solution to this problem but it isn't. But with a little clever coding, combining javascript with server side code, you can accomplish this. You can apply this technique to classic ASP or ASP.NET or whatever techonolgy or language you choose to use.

What we need to do is find a way to continuously sending data to the browser so that it doesn't time out on us. with vbscript and vb.net Repsonse.Buffer & Response.Flush can take care of this quite nicely.

So now we have the data streaming to the client, how to we update the status? The answer is javascript. We can script a function and take advantage of the ability to dynamically changing the content of the div or span tag to update the status when we receive some data from the server.

Please examine the source code for the complete example.

Tuesday, January 15, 2008

Optimize Routing Updates

Dynamic routing protocols such as EIGRP, OSPF & RIP update the routing table through the use of protocol updates. These updates are sent periodically from one router to another and can create quite a bit of traffic on your network.

You can optimize your router and reduce this kind of traffic through the use of the "passive-interface" command. It works by instructing the router not to send update to specific interface(s).

The "passive-interface" command can be used in two ways:

1. Specify an interface that will not participating in routing updates.

Router(config)# router rip
Router(config-router)# passive-interface Ethernet 0/0

2. Make all interfaces passive then use "no passive-interface" on interfaces that you want to participating in routing updates.

Router(config)# router rip
Router(config-router)# passive-interface default
Router(config-router)# no passive-interface Ethernet 0/0

Note that the "passive-interface" command works on all IP routing protocols except BGP.

Tuesday, January 1, 2008

Changing Computer SID

I've been working on a SharePoint project that requires a domain controller, an IIS web farm and a SQL Server. In order to quickly setup my development environment, I use Virtual Server 2005 and created a number of virtual machines and set them up in an isolated virtual network.

I started out by setting up a barebone Windows Server 2003 with SP2 and .Net Framework 2.0. After all the security updates have been applied, I copied the virtual hard drive (.vhd) file, renaming it and attached to the new virtual machines. I brought them up one by one and renamed them. Once I got through all four, they all came up with no problem.

When I promoted the DC and start joining the first member server things also went pretty well until I tried to logon to the member server with a domain account. The error message I received was:

The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain

This error occurred because I used only one installation of Windows 2003 Server. The SID is the same on all of my virtual machines because I just simply copied the .vhd file and renamed it.

The solution was to download NewSID utility from SysInterals (now owned by Microsoft). The tool allows you to change SID as well as computer name and works wonderfully in this situation.

Here's a few tips for those who might run into this same scenario:

1. Run NewSID when you bring up a clone server/computer and let it do the rename for you. This will save you from rename the computer, reboot, login then change the SID only to reboot again.

2. Run NewSID before you join the member server to the domain. This is because it will save you from all the hassle of joining domain, reboot, unjoin, reboot, change SID reboot and rejoin domain...