Control of internal and external noise in genetic regulatory networks