Option 1 : plane
from Da Nang
you should be able to research this yourself.
Option 2 : train
Go to Da Nang by taxi or bus and book early to get what you want. Should be around 50 bucks per person for a soft sleeper. 15 hr trip i believe.
Option 3 : Bus
. cheapest and most uncomfortable of course but if budget is an issue, its not really bad. Go to the area in Da Nang where you can buy bus tix, they will be able to sort it out for you to get where you want. Off hand i think its Da nang to Hue than Hue to Hanoi. Don't quote me though.
Option 4 : rent a taxi/car
You can rent a driver and car. No idea how much this would cost from Hoi an/Da Nang to Hanoi but you can ask around.