Mal wieder iptables mit OpenVPN

Hi,

auf meinem default gateway habe ich eine VPN Verbindung in ein anderes Netz aufgebaut:

Code:
root@spiderman:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:30:1b:be:cc:47  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::230:1bff:febe:cc47/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13252012 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13293998 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9033318127 (8.4 GiB)  TX bytes:9020685367 (8.4 GiB)
          Interrupt:254 Base address:0xe000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:82792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82792 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8244720 (7.8 MiB)  TX bytes:8244720 (7.8 MiB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:XXX.XXX.XXX.XXX  P-t-P:188.110.232.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:8563998 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4831784 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:8365372789 (7.7 GiB)  TX bytes:442213817 (421.7 MiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.15.15.1  P-t-P:10.15.15.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1255  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tun1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.12.53.1  P-t-P:10.12.53.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1225  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tun2      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.9.0.6  P-t-P:10.9.0.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:252 (252.0 B)  TX bytes:17760 (17.3 KiB)

root@spiderman:~#

Durch tun2 führen auch einige Routen:

Code:
root@spiderman:~# route -n | grep tun2
10.9.0.5        0.0.0.0         255.255.255.255 UH    0      0        0 tun2
10.9.0.1        10.9.0.5        255.255.255.255 UGH   0      0        0 tun2
192.168.1.0     10.9.0.5        255.255.255.0   UG    0      0        0 tun2
192.168.0.0     10.9.0.5        255.255.255.0   UG    0      0        0 tun2
root@spiderman:~#

Von einem Host aus sollte jetzt die 192.168.0.254 pingbar sein - ist sie aber leider nicht. Von dem Default Gateway aus geht es:

Code:
root@spiderman:~# ping 192.168.0.254
PING 192.168.0.254 (192.168.0.254) 56(84) bytes of data.
64 bytes from 192.168.0.254: icmp_seq=1 ttl=63 time=121 ms
64 bytes from 192.168.0.254: icmp_seq=2 ttl=63 time=61.3 ms
^C
--- 192.168.0.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 61.321/91.191/121.062/29.872 ms
root@spiderman:~#

Jetzt habe ich mal wieder iptables unter Verdacht. Sieht jemand was da Probleme verursachen könnte?

Code:
###################################
# SETUP
###################################
modprobe ip_conntrack
echo 1  >  /proc/sys/net/ipv4/ip_forward
echo 0  >  /proc/sys/net/ipv4/ip_dynaddr
echo 1  >  /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 0  >  /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1  >  /proc/sys/net/ipv4/conf/all/rp_filter
echo 61 >  /proc/sys/net/ipv4/ip_default_ttl
echo 1  >  /proc/sys/net/ipv4/tcp_abort_on_overflow
echo 30 >  /proc/sys/net/ipv4/tcp_fin_timeout
echo 3  >  /proc/sys/net/ipv4/tcp_syn_retries
echo 3  >  /proc/sys/net/ipv4/tcp_synack_retries

###################################
# CLEAR ALL AND SET DEFAULTS
###################################
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -t nat -F
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

###################################
# ALLOW ALL TRAFFIC ON LOOPBACK
###################################
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

###################################
# EXCEPTIONS TO THE INPUT POLICY
###################################
# allow all traffic from the inside
iptables -A INPUT -i eth0 -j ACCEPT

# allow port 22 from the outside
iptables -A INPUT -i ppp0 -p tcp --dport 22 -j ACCEPT

# allow port 25 from the WiSo vCenter
iptables -A INPUT -i ppp0 -p tcp --dport 25 -s 131.188.76.71 -j ACCEPT

# allow port 443 from the outside
iptables -A INPUT -i ppp0 -p tcp --dport 443 -j ACCEPT

# allow port 1194 from the outside
iptables -A INPUT -i ppp0 -p tcp --dport 1194 -j ACCEPT

# allow icmp from the outside
iptables -A INPUT -i ppp0 -p icmp -j ACCEPT

# allow related
iptables -A INPUT -i ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT

###################################
# EXCEPTIONS TO THE FORWARD POLICY
###################################
# allo all traffic to pass from the inside to the inside
iptables -A FORWARD -i eth0 -o eth0 -j ACCEPT

# allow all traffic to pass from the inside to the outside
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT

# and allow related traffic to be forwarded to the inside
iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

# enable source nat
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

###################################
# VPN
###################################
# allow all input and output from and to tun devices
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A OUTPUT -o tun+ -j ACCEPT

# allow all forwarding to and from tun devices
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -o tun+ -j ACCEPT

# allow all related traffic
iptables -A FORWARD -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT

cu
serow
 
verdacht:

das ziel deines ping keinnt keine route zurück ...

verifizierbar duch:

richte mal ein source nat für deinen host ein der nicht pingen kann und maskiere ihn gegenüber deinem ping ziel ... wenn danach ping durch geht und zurück kommt, kennt dein ping ziel keine route zurück ...
 
Zurück
Oben