To support 30 networks we need atleast 5 bits(2^5=32).
And default subnet mask for class B network is 255.255.0.0
so we will borrow the most significant 5 bits from the third octet to support our 30 subnet networks that is
255.255.11111000.00000
i.e; 255.255.248.0
and the rest bits(represented as 0) will be host part......
Correct me If I'm wrong......:-)