Temat: Brak internetu na komputerze po połączeniu z openvpn

Po połączeniu się z serwerem przestaje mi działać internet na komputerze podpiętym do routera. Sieć lokalna działa. Router pinguje tylko adresy IP. Po dodaniu DNS do resolv.conf router rozpoznaje nazwy. Na routerze zewnętrze IP jest podmienione na to z serwera i to jest OK. Pomimo tych zmian na routerze w dalszym ciągu nie działa internet.
Konfiguracja klienta:

client
dev tap
proto udp
remote plvpn.mydevil.net 1194
nobind
persist-key
persist-tun
ca ca.crt
auth-user-pass

route -n przed połączeniem:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.1        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 br-lan
192.168.1.0     10.0.0.1        255.255.255.0   UG    0      0        0 tun0
82.9.44.0       0.0.0.0         255.255.252.0   U     0      0        0 eth0.2
0.0.0.0         82.9.44.1       0.0.0.0         UG    0      0        0 eth0.2

Po połączeniu:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
178.32.230.230  82.9.44.1       255.255.255.255 UGH   0      0        0 eth0.2
10.0.0.1        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 br-lan
192.168.1.0     10.0.0.1        255.255.255.0   UG    0      0        0 tun0
82.9.44.0       0.0.0.0         255.255.252.0   U     0      0        0 eth0.2
172.30.0.0      0.0.0.0         255.255.0.0     U     0      0        0 tap0
0.0.0.0         172.30.0.1      128.0.0.0       UG    0      0        0 tap0
128.0.0.0       172.30.0.1      128.0.0.0       UG    0      0        0 tap0
0.0.0.0         82.9.44.1       0.0.0.0         UG    0      0        0 eth0.2

ifconfig:

br-lan    Link encap:Ethernet  HWaddr 
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:131724 errors:0 dropped:0 overruns:0 frame:0
          TX packets:118148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9946065 (9.4 MiB)  TX bytes:145674604 (138.9 MiB)

eth0      Link encap:Ethernet  HWaddr 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:140674 errors:0 dropped:0 overruns:93145 frame:0
          TX packets:138375 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:148776088 (141.8 MiB)  TX bytes:13768277 (13.1 MiB)
          Interrupt:4

eth0.1    Link encap:Ethernet  HWaddr 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5493 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15177 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:977643 (954.7 KiB)  TX bytes:2620713 (2.4 MiB)

eth0.2    Link encap:Ethernet  HWaddr 
          inet addr:82.9.47.45  Bcast:255.255.255.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:134311 errors:0 dropped:0 overruns:0 frame:0
          TX packets:123193 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:145715644 (138.9 MiB)  TX bytes:11146353 (10.6 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:170 errors:0 dropped:0 overruns:0 frame:0
          TX packets:170 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:12567 (12.2 KiB)  TX bytes:12567 (12.2 KiB)

mon.wlan0 Link encap:UNSPEC  HWaddr 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1460729 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:222937924 (212.6 MiB)  TX bytes:0 (0.0 B)

tap0      Link encap:Ethernet  HWaddr 
          inet addr:172.30.0.4  Bcast:172.30.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:7586 (7.4 KiB)  TX bytes:7890 (7.7 KiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.0.0.2  P-t-P:10.0.0.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:1830 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:281222 (274.6 KiB)  TX bytes:308556 (301.3 KiB)

wlan0     Link encap:Ethernet  HWaddr 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:127643 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:11242796 (10.7 MiB)  TX bytes:149092730 (142.1 MiB)

iptables -L:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere            state INVALID
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
syn_flood  tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN
input_rule  all  --  anywhere             anywhere
input      all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere            state INVALID
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
forwarding_rule  all  --  anywhere             anywhere
forward    all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere            state INVALID
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
output_rule  all  --  anywhere             anywhere
output     all  --  anywhere             anywhere

Chain forward (1 references)
target     prot opt source               destination
zone_lan_forward  all  --  anywhere             anywhere
zone_wan_forward  all  --  anywhere             anywhere

Chain forwarding_lan (1 references)
target     prot opt source               destination

Chain forwarding_rule (1 references)
target     prot opt source               destination
           all  --  anywhere             anywhere
           all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             192.168.2.0/24
ACCEPT     all  --  anywhere             192.168.1.0/24
nat_reflection_fwd  all  --  anywhere             anywhere

Chain forwarding_wan (1 references)
target     prot opt source               destination

Chain input (1 references)
target     prot opt source               destination
zone_lan   all  --  anywhere             anywhere
zone_wan   all  --  anywhere             anywhere

Chain input_lan (1 references)
target     prot opt source               destination

Chain input_rule (1 references)
target     prot opt source               destination

Chain input_wan (1 references)
target     prot opt source               destination

Chain nat_reflection_fwd (1 references)
target     prot opt source               destination

Chain output (1 references)
target     prot opt source               destination
zone_lan_ACCEPT  all  --  anywhere             anywhere
zone_wan_ACCEPT  all  --  anywhere             anywhere

Chain output_rule (1 references)
target     prot opt source               destination

Chain reject (5 references)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            reject-with tcp-reset
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable

Chain syn_flood (1 references)
target     prot opt source               destination
RETURN     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 25/sec burst 50
DROP       all  --  anywhere             anywhere

Chain zone_lan (1 references)
target     prot opt source               destination
input_lan  all  --  anywhere             anywhere
zone_lan_ACCEPT  all  --  anywhere             anywhere

Chain zone_lan_ACCEPT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain zone_lan_DROP (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain zone_lan_REJECT (1 references)
target     prot opt source               destination
reject     all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain zone_lan_forward (1 references)
target     prot opt source               destination
zone_wan_ACCEPT  all  --  anywhere             anywhere
forwarding_lan  all  --  anywhere             anywhere
zone_lan_REJECT  all  --  anywhere             anywhere

Chain zone_wan (1 references)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootpc
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request
ACCEPT     udp  --  anywhere             anywhere            udp dpt:8194
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:51413
input_wan  all  --  anywhere             anywhere
zone_wan_REJECT  all  --  anywhere             anywhere

Chain zone_wan_ACCEPT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain zone_wan_DROP (0 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain zone_wan_REJECT (2 references)
target     prot opt source               destination
reject     all  --  anywhere             anywhere
reject     all  --  anywhere             anywhere

Chain zone_wan_forward (1 references)
target     prot opt source               destination
forwarding_wan  all  --  anywhere             anywhere
zone_wan_REJECT  all  --  anywhere             anywhere

2

Odp: Brak internetu na komputerze po połączeniu z openvpn

Domyślny ruch idzie przez tun0. Więc teraz na tym drugim serwerze openwrt zapewnij routing i maskaradę tak, żeby rozpoznawał też pakiety z innej podsieci, z tej właśnie.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: Brak internetu na komputerze po połączeniu z openvpn

tun0 łączy moje dwie sieci i to jest ok. tap0 jest podnoszony po połączeniu z serwerem. Niestety nie mogę ingerować w konfigurację tego serwera.

4

Odp: Brak internetu na komputerze po połączeniu z openvpn

No to masz problem smile ustawiłeś trasę domyślną na tun0. Wszystko co nie wiadome (więc pakietu do internetu) idą przez tun0. Jeżeli tamten nie spodziewa się ich to je ucina po prostu.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5 (edytowany przez pinklerose 2012-05-20 12:42:59)

Odp: Brak internetu na komputerze po połączeniu z openvpn

Czyli co i jak powinienem teraz zrobic? Domyślam się, że jakieś reguły firewalla?
Dodam, że mają działać dwa połączenia vpn. tun0 łączy dwa lany, tap0 ma służyć do posiadania polskiego IP, które potrzebuję do kliku usług. Przed połączeniem z drugim serwerem vpn (tap0) internet działa.

6

Odp: Brak internetu na komputerze po połączeniu z openvpn

Inaczej routing ustawić? zamiast trasy domyślniej przez openvpn zostaw ją taka jak była. Tylko podsieć którą łączyć przez tun0 niech idzie.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: Brak internetu na komputerze po połączeniu z openvpn

Szczerze to nie rozumiem co tun0 ma z tym wspólnego. Po rozłączeniu tun0 w dalszym ciągu brak internetu na komputerze gdy połącze sie z tym drugim vpn (tap0). Ztego co widzę to domyślne są
default         172.30.0.1      128.0.0.0       UG    0      0        0 tap0
default         cpc4-nott16-2-0 0.0.0.0         UG    0      0        0 eth0.2

8

Odp: Brak internetu na komputerze po połączeniu z openvpn

Zostaw tylko jedną domyślną, przez eth0.2

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

9

Odp: Brak internetu na komputerze po połączeniu z openvpn

Chyba się nie rozumiemy. Ta trasa ma być domyślna. Dzięki niej mogę mieć polskie IP. I z takim IP jestem identyfikowany na ruterze "curl ifconfig.me" (bardzo przydatna strona). Teraz chcę żeby to połączenie było dostępne na komputerach podpiętych do routera gdyż po połączeniu z tym vpn internet na komputerach przestaje działać.

10

Odp: Brak internetu na komputerze po połączeniu z openvpn

Więc wracam do pierwszej odpowiedzi - musisz zrobić aby tamta sięć reagowała na twoje pakiety.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

11

Odp: Brak internetu na komputerze po połączeniu z openvpn

I reaguje, router jest klientem i działa w tamtej sieci. Teraz chodzi o to żeby udostępnić połączenie z routera do sieci lan. Tu rozumiem musi pojawić się maskarada. Dodałem do firewalla

iptables -t filter -A FORWARD -s 192.168.2.0/255.255.0.0 -d 0/0 -j ACCEPT
iptables -t filter -A FORWARD -s 0/0 -d 192.168.2.0/255.255.0.0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/16 -d 0/0 -j MASQUERADE

ale to nie to.

12

Odp: Brak internetu na komputerze po połączeniu z openvpn

zrób masquerade na interfejs tun i nie dla 0/0 bo znów zrobiłeś coś w rodzaju defaultroute

13 (edytowany przez pinklerose 2012-05-21 21:22:19)

Odp: Brak internetu na komputerze po połączeniu z openvpn

Dodałem do firewalla takie reguły:

iptables -A FORWARD -i br-lan -s 192.168.2.0/255.255.255.0 -j ACCEPT
iptables -A FORWARD -i br-lan -d 192.168.2.0/255.255.255.0 -j ACCEPT
iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE

Nie działają.

EDIT

Znalazłem rozwiązanie:

iptables -I OUTPUT -o tap+ -j ACCEPT
iptables -I INPUT -i tap+ -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I FORWARD -o tap+ -j ACCEPT
iptables -I FORWARD -i tap+ -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -I POSTROUTING -o tap+ -j MASQUERADE