LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2007, 11:19 AM   #1
xvalentinex
LQ Newbie
 
Registered: Dec 2005
Posts: 15

Rep: Reputation: 0
Redirect one public IP to another


Helly guys/gals,

I've never been good at iptables, just enough to do basic firewalling. My situation is that I have 200 or so clients all statically set with private ip's. I am having to change DNS servers and the IP's for the DNS servers currently set in all these clients is going to become inactive. I am looking to redirect these old DNS IP's to the new ones, until I can get all these clients switched to DHCP.

Let's have an example.

Client A is set as:
IP : 192.168.0.5
NETMASK : 255.255.255.0
GATE : 192.168.0.1
DNS1 : 65.200.200.200
DNS2 : 65.200.200.201

So the 65.200.200.200 and 201 are going to be inactive, and the new DNS's are 69.100.100.100 and 69.100.100.101

How can I redirect any DNS request to 65.200.200.200 to 69.100.100.100?

I realize that this will mean that no one will be able to access 65.200.200.200 while this rule is in place, but that is fine.

TIA,
-xvalx
 
Old 01-10-2007, 11:56 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Stand @ Gateway box & run..
Code:
iptables -t nat -A PREROUTING -i LAN_IF -s LAN/LAN_MASK -d 65.200.200.200 -p udp -j DNAT --to 69.100.100.100
iptables -t nat -A PREROUTING -i LAN_IF -s LAN/LAN_MASK -d 65.200.200.201 -p udp -j DNAT --to 69.100.100.101
Basically dns queries are udp packets but since they can fall back on tcp protocol, make sure to add rule for tcp packets (if face problems).

p.s: If you run some fully configured firewall, you got to all these packets to traverse through FORWARD chain as well.
 
1 members found this post helpful.
Old 01-10-2007, 03:30 PM   #3
xvalentinex
LQ Newbie
 
Registered: Dec 2005
Posts: 15

Original Poster
Rep: Reputation: 0
brilliant! I will give it a whirl
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD: how to get pf to redirect to a public IP? dsegel *BSD 0 08-07-2006 03:26 PM
LXer: Public Venture, Public Content LXer Syndicated Linux News 0 06-22-2006 08:54 PM
YUM requires public keys, how do I get public keys? GNUROCKS Linux - Newbie 3 05-29-2005 08:50 AM
Redirect wonderland Linux - Newbie 3 05-24-2004 11:50 PM
To anyone=(To go public or not to go public that is the question...) hotrodowner Linux - General 10 06-25-2002 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration