LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-19-2006, 05:15 PM   #1
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
iptable help needed


I have a linux ISP server that I am running which has modem and ppp running at work for testing purpose for devices..

What devices does is logon to ISP server via ppp and then trying a DNS lookup to get to next server.

Problem is, I need that DNS lookup to happen on that ISP server I am running but it looks like device has DNS IP hard coded in there.

So I thought of doing iptables translation somehow but not too familiar..

so iptables should be stating like..

if destination ip is 200.200.200.1 for DNS, change that destination ip for 215.215.215.1

is that possible? I am not even sure if I should use OUTPUT or what.. can someone please point me to rite direction?

thank you.
 
Old 04-20-2006, 01:12 PM   #2
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,
that's doable with iptables, by using the DNAT target in the PREROUTING chain in the NAT table:
iptables -t nat -A PREROUTING -p udp --dport 53 -d 200.200.200.1 -j DNAT --to-dest 215.215.215.1

BUT, I don't see why you would need that... your DNS server is specified in /etc/resolv.conf.
If you edit this file, you'll see the IP address that you currently use.
If you replace it by the one you want to use, that should be it.
Also, this file can be overwritten (by your dhcp client, or maybe by your ppp connection script), so you may want to check if the modification you make do not "disappear" after a while...

Last point, if you need only 1 DNS query to be made to this specific server, you can use:
nslookup www.google.com 215.215.215.1
which will force the query for google to be made to the 215.215.215.1 nameserver.

Hope this helps...
 
Old 04-21-2006, 11:59 AM   #3
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Original Poster
Rep: Reputation: 0
hi, i will try your iptable solution..

the reason we needed to do this was the fact that client device had dns ip hard coded into it..

we did resolve the issue by putting lo:1 's ip to that particular dns but I want to learn more about iptables and will try yours & let you know.

thank you.
 
  


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
Slackware iptable/packet mangling help needed. underscorelinux Linux - Wireless Networking 3 10-23-2005 04:27 PM
iptable summerfish Linux - Networking 1 07-16-2004 02:28 AM
iptable help Neomaster Linux - Security 5 05-29-2003 09:13 PM
Iptable Help cirkut5732 Slackware 4 04-10-2003 11:18 PM
iptable help Syntax Linux - General 1 12-29-2002 11:04 PM

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

All times are GMT -5. The time now is 06:23 PM.

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