This happens to me on occasion. It's really only when I go from one internet router to a different and only about 5% of the time.
Anyway, I've found that going to network preferences, then "Assist Me" then running through that fixes it.
Or sometimes I just go to network preferences -> advanced -> TCP/IP and click Renew DHCP
Also, google what type or router you have. There are a few out there that don't work well with certain mac OS's. I recall at&t dsl modems being one of those. In which, you can typically just buy a different router and be good to go.