i want a programme to do this thing .

fakeresolv www.example.com= -- wget www.example.com/abc

this way i can test vhost's of my webserver without setting up dns records . i want to limit this effect on one process or one process tree . i want uninvolved processes resolve hostnames with the regular resolver .

wget here is for example . i want this facility to wrap many other programmes .

i think LD_PRELOAD and ptrace(2) are candidate approaches . but have small experience on the detail implementation . if there is another programme does something similar , i may use that as a reference . so before i want to start my own code , what existing project is good to look at ?

  • i am aware of wget --header "Host:www.example.com" . but not satisfied . – 把友情留在无盐 Feb 23 '15 at 1:10
  • So, editing /etc/hosts is overkill for your needs, right? – glenn jackman Feb 23 '15 at 2:22
  • how to make different processes see a different /etc/hosts ? with namespaces(7) ? @glennjackman – 把友情留在无盐 Feb 23 '15 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.