Problems with LINUX as a router - Masquerading, NAT, Internet connection sharing

Hello,

I have the following problem:
I want to use a linux box as a gateway to the internet. It is connected through a DSL (dialup) connection (ppp0 -> eth1).
I want to have access from clients connected to this machine through wireless connections. There is a notebook, running Windows2000. I can ping the linux box and vice versa. Trying to surf to e.g. www.google.com doesn't work.

What I have done so far:
Linux (fedora, kernel 2.6.8) IP on device atml0 (this is the wireless device): 192.168.0.1
Win2k IP: 192.168.0.99
DNS AND gateway on Win2K: 192.168.0.1

/etc/rc.d/rc.ipmasq:
#!/bin/sh
IPTABLES=/sbin/iptables
$IPTABLES -F -t nat
$IPTABLES -A POSTROUTING -t nat -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Whats wrong? Can anybody help?

loony
l00ny_tn1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jlevieCommented:
Unless you've set up Bind on your Linux box you'll need to configure windows to use the same name server IP(s) that you find in /etc/resolv.conf. Your firewall set up should work as configured and when you fix the nameserver the 2k box should be able to surf.
0
l00ny_tn1Author Commented:
I thought it could have something to do with the DNS entry on the Win2k box, but even if i have set it to the one shown in /etc/resolv.conf it doesn't work. What else could it be? By the way: How do I set up a bind on the linux box?

loony
0
l00ny_tn1Author Commented:
Some extra info:
Output of
/sbin/iptables -L
==============
Chain INPUT (policy DROP)
target     prot opt source               destination        
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:netbios-ns
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:netbios-dgm
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:netbios-ssn
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:4662
ACCEPT     udp  --  anywhere             anywhere            udp dpt:4223
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request limit: avg 5/min burst 5
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             localhost.localdomain
LOG        all  --  anywhere             anywhere            limit: avg 10/hour burst 5 LOG level warning prefix `IPTABLES: '

Chain FORWARD (policy DROP)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        


/sbin/iptables -t NAT -L
===================
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination        

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        

Hm... Anybody?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

l00ny_tn1Author Commented:
Okay, I got it:

For anybody having the same probs:
Reset any firewall rules (for testing though <g>), then do the following:

iptables -F -t nat
iptables -A POSTROUTING -t nat -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -A FORWARD -t filter -i atml0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i ppp0 -m state --state ESTABLISHED,RELATED     -j ACCEPT

(where atml0 is the interface connected to the lan (perhaps eth1 for you?!), ppp0 is the interface connected to the internet (perhaps something other like eth0 for you?!))
 Don't forget to set the DNS server on the clients to the one given by DHCP of your isp (/etc/resolv.conf)...

For me, it seems it was a problem with the rules I set up to protect the router/gateway.
 loony

 
0
kidomanCommented:
Hi,

Good that you found a solution but I can give u a small hint. When you want to chase IPTABLES buys, then use the utility "tcpdump". By seeing the packets arrriving and going, you can diagnose the problems easily.

Actually you could have jsut set the DNS server addresses in the clients to the one supplied by ur ISP and seen if it worked...?

Just my 2 cents,

Cheers,

karan
0
l00ny_tn1Author Commented:
Thanks, a really cool tool this tcpdump is :)
0
CetusMODCommented:
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.