There are some buses leaving from Vietnam capital city - Hanoi in the morning and early afternoon to Guangxi capital city - Nanning(5h). After you arrive in Nanning there are a lot of trains and buses from there to Guilin(4h).
Guilin - Hanoi
There is a sleeper over night bus/train route from Guilin to Hanoi. It costs about 480CNY leaving in the evening every day and arriving Hanoi next day. The details is here. Or catch the afternoon train to Nanning(5hrs), stay overnight in a cheap station hotel and get the early morning bus in Langdong bus station to Hanoi, arriving about 3PM depending on traffic.
Vietnam has a consulate in Nanning. It takes 3 working days and 380CNY to obtain a visa. It is possible to post your passport to travel agents in Nanning and they can help to get the visa instead of waiting a few days in Nanning.