I sent a mail to Vietnam Railway last week asking if I can buy the train ticket for bicycle online, because their website only allows buying the human ticket. They replied me that I should go to the train station and buy the bicycle ticket there. But I should play safe and take Simon's advice to buy the bike ticket a day before, cause it's common to miss information in email conversation.
Taking all your advice, I drafted the plan as below. Some riding, some sight seeing, some breaks and rests. Downloading the Openstreetmap map for GPS. Thanks.
Day 1: Fly to Hanoi
Day 2: Sight seeing in Hanoi
Day 3: Sight seeing in Hanoi and overnight train to Hue
Day 4: Bike from Hue to Hoi An
Day 5: Sight seeing in Hoi An
Day 6 to Day 10: Bike from Hoi An to Buon Ma Thuot
Day 11: Bike from Buon Ma Thuot to Nha Trang
Day 12: Relax in Nha Trang
Day 13: Overnight train from Nha Trang to HCMC
Day 14: Sight seeing in HCMC
Day 15: Fly to Hanoi
Day 16: Bike from Hanoi to Ninh Binh
Day 17: Sight seeing in Ninh Binh
Day 18: Take train from Ninh Binh to Hanoi
Day 19: Sight seeing in Hanoi
Day 20: Fly back to HK