Preheat oven to 375 °F
Bring a large pot of salted water to a boil, then add macaroni. Cook for 8 to 9 minutes. Strain and set aside.
In a heavy-bottomed large pot, melt butter using medium heat.
Sprinkle the salt, pepper, flour, and cayenne pepper, onion powder, and garlic powder over the melted butter, whisking until smooth and the mixture has thickened slightly.
Stir in the milk, 1/2 cup at a time. Thoroughly combine the 1/2 cup before adding the next 1/2 cup.
Add all of the medium cheddar cheese and half of the extra sharp. Stir into the milk and flour until melted. Stir in the macaroni.
Pour into a 3-quart baking dish. Top with the remaining extra sharp cheddar cheese, then bake 375 °F at for 30 minutes.