LinuxQuestions.org
Register a domain and help support LQ
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 02-06-2006, 04:37 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Rep: Reputation: 31
pppoe/nat/iptables working BUT strange setup HELP


Ive got a debian box acting as my router to my ISP pppoe...I setup a firewall script and everything is running just fine...there is only one prob..for the clients "WinXP" to get internet connection I need to enter the DNS IP found in /etc/resolv.conv in the configuration of the network cards of the XP clients as a DNS server or they cant browse the web...I dont have a transparent proxy ....I had one on my old cable connection but I cant figure out if that is the problem.. I want to use the IP of my debian box as a dns server for my xp clients ...how to do that...?
 
Old 02-06-2006, 05:13 AM   #2
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Original Poster
Rep: Reputation: 31
i have added the following lines to my firewall and it seems to work:

IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 25 -j DNAT --to $DNS:25

IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 53 -j DNAT --to $DNS:53
IPTABLES -t nat -A PREROUTING -p udp -i ppp0 --dport 53 -j DNAT --to $DNS:53

IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 80 -j DNAT --to $DNS:80
IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 8080 -j DNAT --to $DNS:8080
IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 8081 -j DNAT --to $DNS:8081

IPTABLES -t nat -A PREROUTING -p tcp -i ppp0 --dport 143 -j DNAT --to $DNS:143

Now my question is...instead of Prerouting every packet if it matches a certain port cant I just forward it depending on an IP...keeping in mind that my pppoe IP is dynamic.

Another question as you can see I use a variable $DNS ...which I set manually earlier in my script..I want to know if there is a way to extract my dns servers IP and assign it to a variable...because my dns server IP is extracted dynamically...
 
Old 02-06-2006, 02:09 PM   #3
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
DNS1="`grep nameserver $RESOLV | head -n 1 | cut -d \" \" -f2`"
DNS2="`grep nameserver $RESOLV | head -n 2 | tail -n 1 | cut -d \" \" -f2`"

Graciously lifted from http://svn.foo-projects.org/comp.php...ar-tools@16091

via
http://www.google.com/search?ln=en&q...ep+resolv.conf
 
Old 02-06-2006, 02:37 PM   #4
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Original Poster
Rep: Reputation: 31
Thx Darin just what I needed...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Strange PPPOE setup prob "NOT newbie" ALInux Linux - Networking 3 02-04-2006 06:19 PM
NAT - pppoe problems LordNimrod Linux - Networking 2 11-24-2005 05:19 PM
iptables - strange behaviour of nat?? shacky Linux - Networking 2 10-17-2004 11:44 AM
adsl-status can't read pppoe PID file with rp-pppoe program setup Smarvy Linux - Newbie 2 03-14-2004 12:35 AM
Email not working after IPTABLES setup sergio3986 Linux - Networking 4 12-09-2003 09:21 PM


All times are GMT -5. The time now is 10:30 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration