How can I make a keyboard configuration become default when I hook it up?
I'm not sure if it'll support the switching case you describe 100%, but KeyRemap4Macbook will probably get you most of the way there. You can set different options for the internal and external keyboards, for example.