Did you download a pirated copy of iWork lately? 🙄
The sharing screen would suggest it's a problem with your router, but I don't think that would explain the problem with the Terminal. Still, just to make sure I'd probably try disconnecting the computer from the router (and the internet all together) and rebooting while it's disconnected.