Altering hostname-IP mapping within a browser

Solution 1:

In Chromium, you can use the --host-resolver-rules option to specify a list of mappings.

For example:

$ chromium \
  --user-data-dir=/tmp/some-temp-dir \
  --host-resolver-rules='MAP host1.example.com 127.0.0.1, MAP host2.example.com 127.0.0.1'

Solution 2:

I found a solution here that works for one IP on a per-Firefox-profile basis.

  1. Navigate to about:config.
  2. Set network.dns.forceResolve to e.g. 127.0.0.1

screenshot of network.dns.forceResolve parameter in about:config of Firefox