'How do you do?' is not unnatural, and it's not just for textbooks. It is real English, but it's quite formal and a little old-fashioned.
You have to understand two things about 'How do you do?' :
1. It is not a question. The response to 'How do you do?' is ''How do you do?'
2. It doesn't mean 'How are you?'. It means 'I'm pleased to meet you'.
So, in fact, the only situation where you can use 'How do you do?' is when you shake hands and meet someone for the first time. It has no other function, and is gradually falling out of use. These days, most people say 'Hello' or even more informally 'Hi', and 'Nice to meet you' or 'Pleased to meet you', when you make someone's acquaintance.