To use GPIO2 for debugging, just use Serial1 instead of Serial. Over the network is more involved.
Serial1
Serial