LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   pppoe/nat/iptables working BUT strange setup HELP (http://www.linuxquestions.org/questions/linux-networking-3/pppoe-nat-iptables-working-but-strange-setup-help-412137/)

ALInux 02-06-2006 03:37 AM

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...?

ALInux 02-06-2006 04:13 AM

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...

Darin 02-06-2006 01:09 PM

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

ALInux 02-06-2006 01:37 PM

Thx Darin just what I needed...


All times are GMT -5. The time now is 03:31 AM.