Re: weird iptables behaviour



Fabio <nsafve_DELETE_ME_@xxxxxx> wrote:
Hello,
I've got a strange problem with IP Masquerade:
PC1 is connected to internet and PC2 uses PC1
as the gateway.
From PC2 i can ping and even traceroute any URL
(for example ping and traceroute www.wikipedia.org
works great) but i can open very few web pages.
I only can see there 3 sites:
www.mozilla.org www.beppegrillo.it www.google.com
but I can't open for example www.yahoo.com and much more.
More than that is I can use skype from PC2, so I absolutely
don't have a clue about what to do.
This is my network's diagram:

[INTERNET]<-->(eth0)[PC1](eth1)<--->(eth0)[PC2]

On PC1:
eth0: 192.168.0.1 (with a cable to the modem)
eth1: 192.168.1.1 (with a crossed cable to PC2)

On PC2:
eth0: 192.168.1.2 (with a crossed cable to PC1)

Try doing "ifconfig eth0 mtu 1492" on PC2.

iptables is configured via the following script:

-------- START SCRIPT -----------

An unusual script. I'd suggest instead,

---

#!/bin/bash
modprobe ip_tables
modprobe ipt_state
modprobe ip_conntrack
modprobe ip_conntrack_ftp ip_nat_ftp
modprobe iptable_nat
modprobe ipt_MASQUERADE
modprobe ipt_limit
modprobe ipt_LOG
#modprobe iptable_mangle

iptables -N no-conns-from-ppp0
iptables -A no-conns-from-ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A no-conns-from-ppp0 -m state --state NEW -i ! ppp0 -j ACCEPT
iptables -A no-conns-from-ppp0 -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT
iptables -A no-conns-from-ppp0 -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT
iptables -A no-conns-from-ppp0 -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT
iptables -A no-conns-from-ppp0 -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
#iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN \
#-j TCPMSS --clamp-mss-to-pmtu
iptables -A no-conns-from-ppp0 -i ppp0 -m limit -j LOG --log-prefix \
"Bad packet from ppp0:"
iptables -A no-conns-from-ppp0 -i ! ppp0 -m limit -j LOG --log-prefix \
"Bad packet not from ppp0:"
iptables -A no-conns-from-ppp0 -j DROP

iptables -A INPUT -j no-conns-from-ppp0
iptables -A FORWARD -j no-conns-from-ppp0

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

---

I've used the script but without mangle table PMTU clamping (commented
out) - so no guarantee on that. Most sites should be accessible with the
PC2 MTU set to 1492 and no clamping. And if you don't need/want pings
and ping-replies then the lines with icmp-type's 0 and 8 can be dropped.
The lines with other icmp-type's should remain as is. If LOGging becomes
annoying then just truncate the lines with -m limit in them starting at
-j LOG.

Just for the record, the core of this script was taken from one written
by Rusty Russell.
http://help.phys.unsw.edu.au/doc/HOW-TO/packet-filtering-HOWTO.txt

--
Clifford Kite

.



Relevant Pages

  • Re: weird iptables behaviour
    ... PC1 is connected to internet and PC2 uses PC1 ... (for example ping and traceroute www.wikipedia.org ... # clamp MTU for new TCP connections to world ...
    (comp.os.linux.networking)
  • question about pppd + routing problem on freebsd 5.3
    ... I issued these route commands to the PC1 ... On the PC2 side Im' using kernel ppp + mgetty and on the client kernel ppp. ... From the PC1 I can only ping to 192.168.1.21 with success and I cannot ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Set up a home... network doesnt work
    ... I notice that although each PC can ping the other successfully using IP address they can't ping using computer name. ... PC1 can see the shared folders of PC2 and access them. ... Ethernet adapter Local Area Connection: ...
    (microsoft.public.windowsxp.network_web)
  • Re: Cant connect to a pc
    ... onto PC1 with admin account but I am unable to ping or connect to PC2. ...
    (microsoft.public.windowsxp.network_web)
  • XP kennt neue IP nicht
    ... Wenn ich jetzt ein "ping ... PC1" auf den lokalen PC mache, ... auf PC2 wird auf die alte IP zugegriffen und natürlich kein reply ... Ein ping mit der neuen IP-Adresse des PC2 funktioniert. ...
    (microsoft.public.de.german.windowsxp.networking)