Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a small ARM box running ownCloud in my house, and a domain bound to my DSL router with Dynamic DNS. This works well as I can configure the ownCloud client to use the domain name, which works both in the house and when I'm on the road.

However, at home I would like to let my laptop and my server talk to each other directly on the local network, rather than as if they were talking over the Internet (including DNS resolution for my domain name, routing all traffic through the DSL machinery etc.). I know that I can set a hostname alias for my domain in /etc/hosts - the problem is that I want this alias to only be active when I'm in the home network, while in all other cases DNS resolution should be used as normal. Is this possible?

share|improve this question
I think there is no straightforward way for that in Ubuntu. I would write a startup script, detecting i.e. the IP address of notebook, and then replace /etc/hosts with the appropriate one. –  Doka Dec 9 '12 at 7:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.