LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-09-2004, 01:38 PM   #1
amado
LQ Newbie
 
Registered: Oct 2004
Location: Kuala Lumpur
Posts: 2

Rep: Reputation: 0
Unhappy client email problem with iptables masquerade


hi there,

i'm having problem accesing/receiving email from client pc connected to internet through gateway with the iptables masquerade setup.

i also having problem accessing some web site (such as mail.yahoo.com but able to log in mail.lycos.com) .

but no problem in surfing other web site.
if i connected directly using the adsl modem to isp, i can receive email and i can surf all the web site.... (so it is not isp problem)
from the gateway i can access the internet, do apt and others....

my client pc's :
OS windows XP Pro window 98 SE
Browser firefox 1.0 firefox 1.0
Email Client thunderbird 0.8 thunderbird 0.8

my gateway server:

OS Debian sarge (without X windows)
DNS bind9
M$ Network Samba
eth0 link to ADSL Modem (using pppoe to connect to ISP)
eth1 link to internal LAN

iptables rules is as below:

#!/bin/sh
#
#
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe

EXTIF="ppp0"
INTIF="eth1"

echo -e " Done loading modules.\n"
echo " Enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward
echo " Enabling DynamicAddr.."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr

echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

echo " FWD: Allow all connections OUT and only existing and related ones IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG

echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

i do some googling and even read the manual, but it seem no other person have the same problem.... or may be i just miss it.

thank you
 
Old 10-11-2004, 03:11 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
which is the external interface ppp0 or eth0???
your masquerade rule says that mask all outgoing ip pakects with ip of ppp0. but u say your external device is eth0!!!

try following instead of your masquerade rule

iptables -t nat -A POSTROUTING -s local_net -j MASQUERADE

good luck.
 
Old 10-13-2004, 10:46 AM   #3
amado
LQ Newbie
 
Registered: Oct 2004
Location: Kuala Lumpur
Posts: 2

Original Poster
Rep: Reputation: 0
hi ,

thank you for your suggestion. But i already solved the problem with help from 'firehol' help forum (thanks ktsaou!) and also from the 'Linux IP Masquerade HOWTO' by David A. Ranch. The problem seem to be related with MTU . and there are several way to fix it.
1) Enabling PMTU Clamping for pppoe and ppp
2) Clamping the MSS via iptables
3) Change the external MTU of MASQ server
4) Changing MTU for various Operating System (the problem also happened to other OS than Linux, including M$)
---- summarized from 'Linux IP Masquerade HOWTO' by David A. Ranch ----

i choose to use clamping MSS via iptables, and doing this by adding this code line:
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
to the top of my ruleset...and my ruleset above is correct.
my eth0 is physically connected to ADSL modem (it is not USB port ADSL modem) but when you connected to the Internet through PPPOE (i don't have fix ip, only dynamic ip) , pppd will create another interface name ppp0. (you can check it using ifconfig after execute the pppoe connection). and this ppp0 wil be my gateway interface to the internet.

thanks again and bye..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MASQUERADE Target not found (IPTABLES) bksmart Linux - Networking 15 07-27-2005 08:57 PM
iptables masquerade deconfliction ttucker Linux - Networking 15 08-01-2004 06:04 PM
iptables - true nat AND masquerade rebuke Linux - Security 3 11-11-2003 02:02 PM
Masquerade - iptables amphion Linux - Security 6 06-08-2003 09:59 PM
Iptables Forward + Masquerade + Vmware ! sapilas Linux - Networking 2 12-07-2002 06:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration