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

Posted on 2004-11-01
Last Modified: 2010-03-18

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?

Question by:l00ny_tn1
    LVL 40

    Expert Comment

    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.

    Author Comment

    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?


    Author Comment

    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?

    Author Comment

    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.

    LVL 2

    Expert Comment


    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,



    Author Comment

    Thanks, a really cool tool this tcpdump is :)

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Title # Comments Views Activity
    Problem to telnet 23 152
    CentOS7 Xvnc gdm login 9 121
    IPA - running on unsupported CentOS servers? 1 77
    Cron jobs 12 50
    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now