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


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. doesn't work.

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

$IPTABLES -F -t nat
echo 1 > /proc/sys/net/ipv4/ip_forward

Whats wrong? Can anybody help?

Who is Participating?
CetusMODConnect With a Mentor Commented:
PAQed with points refunded (500)

Community Support Moderator
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.
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?

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

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
target     prot opt source               destination        

target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        

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


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,


l00ny_tn1Author Commented:
Thanks, a really cool tool this tcpdump is :)
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.

All Courses

From novice to tech pro — start learning today.