Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    DNS Configuration

    I am running a Fedora Core server that is acting as the router for several computers. I would like several websites to be redirected to a certain IP address. I know this can be accomplished with the hosts file, like the example below:

    I tried this in the hosts file but it seems to only work on the local machine and not the clients. Does anyone know how to "push" this to the clients or an alternative method of accomplishing this task?


  2. #2


    I think you might want to look into iptables and FORWARD rules.

  3. #3
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    If you run your own DNS server on the FC5 machine, and have every other machine on the network use the server for it's DNS, then you can make your server provide whatever IP address you like in response to any request it receives from the lan.

    Take a look at the man pages for 'bind'.
    Linux user #126863 - see

  4. $spacer_open
  5. #4
    Am I on the right track?

    iptables -t nat -A PREROUTING -p tcp -d --dport 80 -j DNAT --to

    So if I try to go to it should take me to This doesn't seem to be working.

  6. #5
    Just Joined!
    Join Date
    Aug 2006
    Ripon, UK
    There used to be an little app called DNSmasq that did just what you are looking for - used the hosts table as a lookup for answering DNS queries (and sent anything that didn't match to your usual DNS service). I have an old version if you can't find uptodate anywhere.

  7. #6

    Re:...DNS Configuration


    in your firewall iptables rule collection, the nat/PREROUTING
    rule is good.

    but not enough... you should also have these rules somewhere appropriate:

    iptables -A INPUT -i $EXTERNAL_IF -p tcp --dport 80 -j ACCEPT

    iptables -A FORWARD -i $EXTERNAL_IF -p tcp --dport 80 -j ACCEPT

    where EXTERNAL_IF=eth0 for eg.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts