Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a network behind a NAT with a few machines.

The machines are:

  • router - NAT, dnsmasq, forwarding - directly connected to the inet
  • server - which runs ssh, www and some other stuff
  • clients - which do stuff on server

I also have is pointing to my connection's IP (single IP), which is the router, which forwards ports to server.

Server, has a httpd running, which serves different sites based on vhosts.
So I have, site2..

The problem is that all the traffic is going thru the router, and when I check logs I always see the router's IP for everything (so it's hard to see who is running the script with the while(1)).

I would just ServerAlias site1.server.local, but most of the sites have a root URL saved somewhere on top of which other URLs are built, so I can't do that.

The solution for me would be telling dnsmasq somehow to answer to * with server's IP.

Is this possible somehow?

share|improve this question
up vote 10 down vote accepted

I do the exact same thing on my dev server(s) so that I can have an rsynced mirror locally and on the off-site server with identical configs.

Here's what you need in your dnsmasq.conf (make sure you restart it) assuming your webserver's internal interface is


This will create a wildcard entry for * and as long as your client's are using DNSMasq for their DNS (and your server listens in the internal interface), you're set.

share|improve this answer
THAAAAAAAAAAAAAANKS – Prody Mar 18 '10 at 17:12
Excellent! Had the same problem and the same solution worked fine for me, too! ;) Many Thanks. – mnemosyn Apr 26 '10 at 13:16

I'm not sure that I understand your issue but it seems to me that the root cause of your troubles is NATing incoming connections on your router. More specifically, since you said that all incoming connections appear in the logs with the router ip address, it seems like you're masquerading all incoming connections.

What you should do is DNAT incoming connection and SNAT outgoing connections on the router which would preserve the source ip of each connection.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.