Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-11-01
8
Medium Priority
?
275 Views
Last Modified: 2010-03-18
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
0
Comment
Question by:l00ny_tn1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 12462811
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
 

Author Comment

by:l00ny_tn1
ID: 12463064
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
 

Author Comment

by:l00ny_tn1
ID: 12463763
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:l00ny_tn1
ID: 12463929
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
 
LVL 2

Expert Comment

by:kidoman
ID: 12467331
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
 

Author Comment

by:l00ny_tn1
ID: 12468041
Thanks, a really cool tool this tcpdump is :)
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 16238477
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

597 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