Find the answer to your Linux question:
Results 1 to 6 of 6
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    2

    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:

    Code:
    192.168.1.1 www.google.com
    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?

    Thanks!

  2. #2
    Linux Newbie unchiujar's Avatar
    Join Date
    Oct 2006
    Posts
    194

    iptables

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

    http://www.linuxguruz.com/iptables/h...O-6.html#ss6.4

  3. #3
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,847
    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 http://linuxcounter.net/

  4. #4
    Just Joined!
    Join Date
    Oct 2006
    Posts
    2
    Am I on the right track?

    iptables -t nat -A PREROUTING -p tcp -d www.google.com --dport 80 -j DNAT --to 216.109.112.135

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

  5. #5
    Just Joined!
    Join Date
    Aug 2006
    Location
    Ripon, UK
    Posts
    26
    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.

  6. #6
    Just Joined! cuervo73's Avatar
    Join Date
    Apr 2006
    Posts
    47

    Re:...DNS Configuration

    ctg3,

    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.

    cuervo

Posting Permissions

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