Getting vagrant box networking working again after wifi change

Tags: apple, python, django

I’m using vagrant for my osx python/django work. There’s one big problem I had: networking would stop working when I switched between work and home. Probably because of a different wifi.

Pretty irritating, as I’d have to do a full vagrant halt and vagrant up dance.

In the end, the solution was pretty obvious and simple. I didn’t think of it myself though :-) The solution was on stackoverflow. Inside the VM, execute:

sudo /etc/init.d/networking restart

Hurray!

(I’ve of course added it as a shell script to my personal tool/scripts/whatever collection.)