piątek, 15 marca 2013

Zeroconf is your friend (real world examples incl. VMware ESXi and IBM DS3524)

Subnet 192.168.1.0/24 is probably the best recognized subnet in the world. Every piece of network hardware - no matter if it's for home use or advanced one for business use - comes with 192.168.1.x as its default IP. We're are very familiar with this subnet.

But sometimes, especially if there is some problems with network, your PC catches IP from some other subnet - like 169.254.x.y. What's this? Does it always mean problems? No. Let me introduce - 169.254.0.0/16 is your new friend.

Subnet 169.254.0.0/16 is:
  • part of Zeroconf idea,
  • is used for IPv4 Link-Local addressing,
  • is not routable,
  • is reserved by IANA,
  • is described in document RFC 3927
The idea is simple and clever. After media is detected, network interfaces set random IP for itself from 169.254.0.0/16 subnet and it's ready to communicate with other devices within the subnet.

In practice, after media is detected (ethernet cable plugged or associated with WIFI access point), OS is broadcasting for new IP from any DHCP/BOOTP server, and if there is no response, after some timeout it sets new IP itself - from 169.254.0.0/16 subnet. Of course there is no broadcasting for new IP if it's set to static or you're using alternative NIC configuration feature of Windows 7 and above which sets static IP defined by your in case there is no DHCP/BOOTP nearby.

Some interesting part of RFC 3927:

2.1. Link-Local Address Selection

When a host wishes to configure an IPv4 Link-Local address, it selects an address using a pseudo-random number generator with a uniform distribution in the range from 169.254.1.0 to 169.254.254.255 inclusive. The IPv4 prefix 169.254/16 is registered with the IANA for this purpose. The first 256 and last 256 addresses in the 169.254/16 prefix are reserved for future use and MUST NOT be selected by a host using this dynamic configuration mechanism. The pseudo-random number generation algorithm MUST be chosen so that different hosts do not generate the same sequence of numbers. If the host has access to persistent information that is different for each host, such as its IEEE 802 MAC address, then the pseudo-random number generator SHOULD be seeded using a value derived from this information.

OK, I could have quite unique IP without DHCP - so what? Even cheapest internet router has got DHCP server built-in. Why would I want to work without DHCP? And I always can set any IP manually if there is no DHCP.

At this point I want to introduce some real world examples. In both cases there is no place for DHCP - and of course - you can always set IP manually but it's always an additional effort and source of possible problems if you forget to change IP to AUTO after your job is done.

Scenario A: VMware host in co-location centre

Company has got one 1U server in co-location centre for off-site backup purposes. Centre charges the company for every 1U space and electric power. So for the cost effective installation there is no monitor, there are no additional networking hardware - only server with VMware ESXi on it.

How to maintenance the machine being at co-location site if there is no display or local network infrastructure (accessible for you)? It's common that 1U servers can have two network interfaces (NIC) in standard. One can be connected with collocation LAN (the way it access Internet) and the second one may be for local access purposes.
And a pic how ESXI networking was configured:
Notice: on vmnic1 physical adapter there was management port configured in subnet 169.254.0.0/16. IP number shown (169.254.100.100) is static one (and easy to remember).

How it works? Just connect notebook with server directly using crossed ethernet cable (or straight if you believe in auto-sensing). Because there is no DHCP - after timeout - OS at notebook will set up its NIC with some IP from 169.254.0.0/16 subnet - the same subnet ESXi is in. And you're ready to connect ESXi with VMware Sphere Client.

Pros:
  • You can easily access your machine in co-location site with just notebook and ethernet cable.
  • You don't have to make VMware ESXi to act as DHCP server on ethernet port labeled "for management".
  • You don't have to do any effort to set IP manually on your notebook - especially when you switch between some LAN segments with and without DHCP
  • You don't have to remember to set IP to AUTO after work.
Cons:
  • You have to wait for a timeout - OS waits for response from any DHCP first.

Scenario B: emergency access to IBM DS3524 storage system

This is also real world example. I have named system storage with its model number because this is more vendor specific solution. IBM DS3524 storage system has two redundant controllers (called Controller A and Controller B). Every controller has its cache, keeps configuration and so on - so storage system can continue work on one controller only. Both controllers have two network interfaces (so there are 4 NICs in total).
  • Controller A Port 1
  • Controller A Port 2
  • Controller B Port 1
  • Controller B Port 2
Manual says that Port 1 and Port 2 must be in separate subnets. So it's great occasion to develop solution like that:
  • Controller A Port 1 - IP = 192.168.1.201
  • Controller A Port 2 - IP = 169.254.111.111 (easy to remember)
  • Controller B Port 1 - IP = 192.168.1.202
  • Controller B Port 2 - IP = 169.254.222.222 (easy to remember)
You control DS3524 with software called  DS Storage Manager Client. DS Storage Manager has some availability to discover controllers in LAN or define it manually. Using zeroconf idea, in case of emergency, you can plug into DS3524 directly (using crossed ethernet cable or straight if you really believe in auto-sensing) or in-directly using switch (solution may include switch with some VLANs configured). By use of switch you can make connection with both controllers at one time - which is more preferred by IBM software when both controllers are online and in a good mood (healthy state I mean ;). And again: you don't have to configure IP in your notebook manually, so you can access device more quickly. Image scenario where your DHCP server is down because it relays on system storage.

Some pics..

Pros:
  • You can easily access your system storage with just notebook and ethernet cable.
  • Your access do not relay on DHCP server which could relay on managed system storage.
  • Your access may not relay on any other networking devices.
  • You don't have to do any effort to set IP manually on your notebook.
  • You don't have to remember to set IP to AUTO after work.
Cons:
  • You have to wait for a timeout - OS waits for response from any DHCP first.

czwartek, 14 marca 2013

Hide Results Pane and make some space for your SQL code (SSMS 2012)

Space on your screen has its value. This is productive tip for making some more space for your SQL code while building your query. After executing a query under SQL Server Management Studio (SSMS), a result pane appears and takes aprox. half of the screen. You can make it smaller by dragging the separator line down. But better idea is to just hide it.

You have 3 options:
  • Go to Windows | Hide Results Pane
  • Use CTRL+R shortcut (worth to remember - as it's worth to remember F5 shortcut is for Execute)
  • Use Hide Results Pane button just from toolbar - but.. you have to add it onto toolbar first (and spend some minutes if you don't know where to find it - continue reading..)
My favorite is the third one. So, the number one step after running SSMS in new enviroment is to add Hide Results Pane button onto toolbar. And this is the post how to do it.

Some pics..

You're starting with some new query..


You're pressing F5 to execute and a half of screen is taken by results. No space for continuing a query..


You may find Hide Results Pane under Windows menu and get rid of it.



If you want to have Hide Results Pane button easy accessible you have to start with clicking left mouse button on a small down arrow at right side of choosen toolbar. Click Customize at the end.


On the Commands tab click Add Command button.


Next, select Windows in Category list (almost at the end) and then select Show Results Pane in Commands list (also almost at the end). Yes - it's Show Results Pane - do not look for Hide Results Pane.

New command was added at the begining of choosen toolbar. It's good idea to move it to the end with Move Down button. Tip: use auto-fire on your joystick ;)



Ready! Congratulations! Now you can hide and show again results pane fast with only one click.