Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Witam
Jestem nowy na forum więc na wstępie proszę o wyrozumiałość :)
Mam problem z połączeniem VPN.
Skonfigurowałem OpenVPN, niby klient łączy się z serwerem, jest jednak problem,
po nawiązaniu połączenia otrzymuję ip, niestety nie mogę spingować żadnego hosta, odpowiada tylko serwer(w puli adresów VPN).
Podejrzewam że problem leży w konfiguracji firewalla, jednak nie mogę sobie z tym poradzić i proszę o pomoc.
Mój config firewalla oparłem na tutku dostępnym tutaj: http://forum.dug.net.pl/viewtopic.php?id=19604
(dokładniej zmieniłem tylko adres na swój - 10.3.0.2).
Config mojego serwera VPN wygląda następująco:
dev tap0 port 5000 proto udp ifconfig 10.3.0.1 255.255.0.0 status /tmp/openvpn-status.log ping 15 ping-restart 45 ping-timer-rem verb 3 secret /etc/openvpn/static.key inactive 3600 push "ping 10" push "ping-restart 60" push "route 192.168.1.0 255.255.255.0"
Proszę o pomoc...
Pozdrawiam
Offline
Skąd pewność, że to firewall, a nie brak przekazywania pakietów? (do włączenia w kernelu przez sysctl).
Pokaz wynik z konsoli serwera vpn:
sysctl -a 2>/dev/null | grep 'net.ipv4.ip_forward'
Pokaż też swój skrypt do firewalla.
Ostatnio edytowany przez Jacekalex (2013-02-08 22:16:27)
Offline
w dmesgu mam coś takiego
[14441795.028024] tap0: no IPv6 routers present [14444014.506767] process `sysctl' is using deprecated sysctl (syscall) net.ipv6.neigh.default.retrans_time; Use net.ipv6.neigh.default.retrans_time_ms instead.
reguły które odpaliłem w iptables:
reguły które odpaliłem do iptables: echo "1" > /proc/sys/net/ipv4/ip_forward #forwardowanie pakietow iptables -A INPUT -i tap0 -j ACCEPT iptables -A FORWARD -o tap0 -j ACCEPT #otwieranie portow dla serwera i klienta openvpn iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 5000 -j ACCEPT #openvpn iptables -A INPUT -p udp -m state --state NEW -m udp --dport 5000 -j ACCEPT #openvpn #routing dla adresu ip klienta ip addr add 192.168.1.167/24 dev eth0 #dodajamy translacje adresów i nat iptables -t nat -A POSTROUTING -o eth0 -s 10.3.0.2 -j SNAT --to 192.168.1.167 iptables -t nat -A PREROUTING -i eth0 -d 192.168.1.167 -j DNAT --to 10.3.0.2 # przekazywanie pakietów z i do tunelu iptables -A FORWARD -s 10.3.0.2 -d 0/0 -j ACCEPT iptables -A FORWARD -d 10.3.0.2 -s 0/0 -j ACCEPT # a to prewencyjnie iptables -A INPUT -s 10.3.0.2 -j ACCEPT iptables -A OUTPUT -d 10.3.0.2 -j ACCEPT
a wynik o który prosiłeś:
net.ipv6.neigh.lo.base_reachable_time_ms = 30000 net.ipv6.neigh.eth0.mcast_solicit = 3 net.ipv6.neigh.eth0.ucast_solicit = 3 net.ipv6.neigh.eth0.app_solicit = 0 net.ipv6.neigh.eth0.retrans_time = 250 net.ipv6.neigh.eth0.base_reachable_time = 30 net.ipv6.neigh.eth0.delay_first_probe_time = 5 net.ipv6.neigh.eth0.gc_stale_time = 60 net.ipv6.neigh.eth0.unres_qlen = 3 net.ipv6.neigh.eth0.proxy_qlen = 64 net.ipv6.neigh.eth0.anycast_delay = 100 net.ipv6.neigh.eth0.proxy_delay = 80 net.ipv6.neigh.eth0.locktime = 0 net.ipv6.neigh.eth0.retrans_time_ms = 1000 net.ipv6.neigh.eth0.base_reachable_time_ms = 30000 net.ipv6.neigh.eth1.mcast_solicit = 3 net.ipv6.neigh.eth1.ucast_solicit = 3 net.ipv6.neigh.eth1.app_solicit = 0 net.ipv6.neigh.eth1.retrans_time = 250 net.ipv6.neigh.eth1.base_reachable_time = 30 net.ipv6.neigh.eth1.delay_first_probe_time = 5 net.ipv6.neigh.eth1.gc_stale_time = 60 net.ipv6.neigh.eth1.unres_qlen = 3 net.ipv6.neigh.eth1.proxy_qlen = 64 net.ipv6.neigh.eth1.anycast_delay = 100 net.ipv6.neigh.eth1.proxy_delay = 80 net.ipv6.neigh.eth1.locktime = 0 net.ipv6.neigh.eth1.retrans_time_ms = 1000 net.ipv6.neigh.eth1.base_reachable_time_ms = 30000 net.ipv6.neigh.tap0.mcast_solicit = 3 net.ipv6.neigh.tap0.ucast_solicit = 3 net.ipv6.neigh.tap0.app_solicit = 0 net.ipv6.neigh.tap0.retrans_time = 250 net.ipv6.neigh.tap0.base_reachable_time = 30 net.ipv6.neigh.tap0.delay_first_probe_time = 5 net.ipv6.neigh.tap0.gc_stale_time = 60 net.ipv6.neigh.tap0.unres_qlen = 3 net.ipv6.neigh.tap0.proxy_qlen = 64 net.ipv6.neigh.tap0.anycast_delay = 100 net.ipv6.neigh.tap0.proxy_delay = 80 net.ipv6.neigh.tap0.locktime = 0 net.ipv6.neigh.tap0.retrans_time_ms = 1000 net.ipv6.neigh.tap0.base_reachable_time_ms = 30000 net.ipv6.xfrm6_gc_thresh = 2048 net.ipv6.conf.all.forwarding = 0 net.ipv6.conf.all.hop_limit = 64 net.ipv6.conf.all.mtu = 1280 net.ipv6.conf.all.accept_ra = 1 net.ipv6.conf.all.accept_redirects = 1 net.ipv6.conf.all.autoconf = 1 net.ipv6.conf.all.dad_transmits = 1 net.ipv6.conf.all.router_solicitations = 3 net.ipv6.conf.all.router_solicitation_interval = 4 net.ipv6.conf.all.router_solicitation_delay = 1 net.ipv6.conf.all.force_mld_version = 0 net.ipv6.conf.all.use_tempaddr = 0 net.ipv6.conf.all.temp_valid_lft = 604800 net.ipv6.conf.all.temp_prefered_lft = 86400 net.ipv6.conf.all.regen_max_retry = 5 net.ipv6.conf.all.max_desync_factor = 600 net.ipv6.conf.all.max_addresses = 16 net.ipv6.conf.all.accept_ra_defrtr = 1 net.ipv6.conf.all.accept_ra_pinfo = 1 net.ipv6.conf.all.accept_ra_rtr_pref = 1 net.ipv6.conf.all.router_probe_interval = 60 net.ipv6.conf.all.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.all.proxy_ndp = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.all.optimistic_dad = 0 net.ipv6.conf.all.mc_forwarding = 0 net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.all.accept_dad = 1 net.ipv6.conf.default.forwarding = 0 net.ipv6.conf.default.hop_limit = 64 net.ipv6.conf.default.mtu = 1280 net.ipv6.conf.default.accept_ra = 1 net.ipv6.conf.default.accept_redirects = 1 net.ipv6.conf.default.autoconf = 1 net.ipv6.conf.default.dad_transmits = 1 net.ipv6.conf.default.router_solicitations = 3 net.ipv6.conf.default.router_solicitation_interval = 4 net.ipv6.conf.default.router_solicitation_delay = 1 net.ipv6.conf.default.force_mld_version = 0 net.ipv6.conf.default.use_tempaddr = 0 net.ipv6.conf.default.temp_valid_lft = 604800 net.ipv6.conf.default.temp_prefered_lft = 86400 net.ipv6.conf.default.regen_max_retry = 5 net.ipv6.conf.default.max_desync_factor = 600 net.ipv6.conf.default.max_addresses = 16 net.ipv6.conf.default.accept_ra_defrtr = 1 net.ipv6.conf.default.accept_ra_pinfo = 1 net.ipv6.conf.default.accept_ra_rtr_pref = 1 net.ipv6.conf.default.router_probe_interval = 60 net.ipv6.conf.default.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.default.proxy_ndp = 0 net.ipv6.conf.default.accept_source_route = 0 net.ipv6.conf.default.optimistic_dad = 0 net.ipv6.conf.default.mc_forwarding = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.default.accept_dad = 1 net.ipv6.conf.lo.forwarding = 0 net.ipv6.conf.lo.hop_limit = 64 net.ipv6.conf.lo.mtu = 16436 net.ipv6.conf.lo.accept_ra = 1 net.ipv6.conf.lo.accept_redirects = 1 net.ipv6.conf.lo.autoconf = 1 net.ipv6.conf.lo.dad_transmits = 1 net.ipv6.conf.lo.router_solicitations = 3 net.ipv6.conf.lo.router_solicitation_interval = 4 net.ipv6.conf.lo.router_solicitation_delay = 1 net.ipv6.conf.lo.force_mld_version = 0 net.ipv6.conf.lo.use_tempaddr = -1 net.ipv6.conf.lo.temp_valid_lft = 604800 net.ipv6.conf.lo.temp_prefered_lft = 86400 net.ipv6.conf.lo.regen_max_retry = 5 net.ipv6.conf.lo.max_desync_factor = 600 net.ipv6.conf.lo.max_addresses = 16 net.ipv6.conf.lo.accept_ra_defrtr = 1 net.ipv6.conf.lo.accept_ra_pinfo = 1 net.ipv6.conf.lo.accept_ra_rtr_pref = 1 net.ipv6.conf.lo.router_probe_interval = 60 net.ipv6.conf.lo.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.lo.proxy_ndp = 0 net.ipv6.conf.lo.accept_source_route = 0 net.ipv6.conf.lo.optimistic_dad = 0 net.ipv6.conf.lo.mc_forwarding = 0 net.ipv6.conf.lo.disable_ipv6 = 0 net.ipv6.conf.lo.accept_dad = -1 net.ipv6.conf.eth0.forwarding = 0 net.ipv6.conf.eth0.hop_limit = 64 net.ipv6.conf.eth0.mtu = 1500 net.ipv6.conf.eth0.accept_ra = 1 net.ipv6.conf.eth0.accept_redirects = 1 net.ipv6.conf.eth0.autoconf = 1 net.ipv6.conf.eth0.dad_transmits = 1 net.ipv6.conf.eth0.router_solicitations = 3 net.ipv6.conf.eth0.router_solicitation_interval = 4 net.ipv6.conf.eth0.router_solicitation_delay = 1 net.ipv6.conf.eth0.force_mld_version = 0 net.ipv6.conf.eth0.use_tempaddr = 0 net.ipv6.conf.eth0.temp_valid_lft = 604800 net.ipv6.conf.eth0.temp_prefered_lft = 86400 net.ipv6.conf.eth0.regen_max_retry = 5 net.ipv6.conf.eth0.max_desync_factor = 600 net.ipv6.conf.eth0.max_addresses = 16 net.ipv6.conf.eth0.accept_ra_defrtr = 1 net.ipv6.conf.eth0.accept_ra_pinfo = 1 net.ipv6.conf.eth0.accept_ra_rtr_pref = 1 net.ipv6.conf.eth0.router_probe_interval = 60 net.ipv6.conf.eth0.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.eth0.proxy_ndp = 0 net.ipv6.conf.eth0.accept_source_route = 0 net.ipv6.conf.eth0.optimistic_dad = 0 net.ipv6.conf.eth0.mc_forwarding = 0 net.ipv6.conf.eth0.disable_ipv6 = 0 net.ipv6.conf.eth0.accept_dad = 1 net.ipv6.conf.eth1.forwarding = 0 net.ipv6.conf.eth1.hop_limit = 64 net.ipv6.conf.eth1.mtu = 1500 net.ipv6.conf.eth1.accept_ra = 1 net.ipv6.conf.eth1.accept_redirects = 1 net.ipv6.conf.eth1.autoconf = 1 net.ipv6.conf.eth1.dad_transmits = 1 net.ipv6.conf.eth1.router_solicitations = 3 net.ipv6.conf.eth1.router_solicitation_interval = 4 net.ipv6.conf.eth1.router_solicitation_delay = 1 net.ipv6.conf.eth1.force_mld_version = 0 net.ipv6.conf.eth1.use_tempaddr = 0 net.ipv6.conf.eth1.temp_valid_lft = 604800 net.ipv6.conf.eth1.temp_prefered_lft = 86400 net.ipv6.conf.eth1.regen_max_retry = 5 net.ipv6.conf.eth1.max_desync_factor = 600 net.ipv6.conf.eth1.max_addresses = 16 net.ipv6.conf.eth1.accept_ra_defrtr = 1 net.ipv6.conf.eth1.accept_ra_pinfo = 1 net.ipv6.conf.eth1.accept_ra_rtr_pref = 1 net.ipv6.conf.eth1.router_probe_interval = 60 net.ipv6.conf.eth1.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.eth1.proxy_ndp = 0 net.ipv6.conf.eth1.accept_source_route = 0 net.ipv6.conf.eth1.optimistic_dad = 0 net.ipv6.conf.eth1.mc_forwarding = 0 net.ipv6.conf.eth1.disable_ipv6 = 0 net.ipv6.conf.eth1.accept_dad = 1 net.ipv6.conf.tap0.forwarding = 0 net.ipv6.conf.tap0.hop_limit = 64 net.ipv6.conf.tap0.mtu = 1500 net.ipv6.conf.tap0.accept_ra = 1 net.ipv6.conf.tap0.accept_redirects = 1 net.ipv6.conf.tap0.autoconf = 1 net.ipv6.conf.tap0.dad_transmits = 1 net.ipv6.conf.tap0.router_solicitations = 3 net.ipv6.conf.tap0.router_solicitation_interval = 4 net.ipv6.conf.tap0.router_solicitation_delay = 1 net.ipv6.conf.tap0.force_mld_version = 0 net.ipv6.conf.tap0.use_tempaddr = 0 net.ipv6.conf.tap0.temp_valid_lft = 604800 net.ipv6.conf.tap0.temp_prefered_lft = 86400 net.ipv6.conf.tap0.regen_max_retry = 5 net.ipv6.conf.tap0.max_desync_factor = 600 net.ipv6.conf.tap0.max_addresses = 16 net.ipv6.conf.tap0.accept_ra_defrtr = 1 net.ipv6.conf.tap0.accept_ra_pinfo = 1 net.ipv6.conf.tap0.accept_ra_rtr_pref = 1 net.ipv6.conf.tap0.router_probe_interval = 60 net.ipv6.conf.tap0.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.tap0.proxy_ndp = 0 net.ipv6.conf.tap0.accept_source_route = 0 net.ipv6.conf.tap0.optimistic_dad = 0 net.ipv6.conf.tap0.mc_forwarding = 0 net.ipv6.conf.tap0.disable_ipv6 = 0 net.ipv6.conf.tap0.accept_dad = 1 net.ipv6.ip6frag_high_thresh = 262144 net.ipv6.ip6frag_low_thresh = 196608 net.ipv6.ip6frag_time = 60 net.ipv6.route.gc_thresh = 1024 net.ipv6.route.max_size = 4096 net.ipv6.route.gc_min_interval = 0 net.ipv6.route.gc_timeout = 60 net.ipv6.route.gc_interval = 30 net.ipv6.route.gc_elasticity = 0 net.ipv6.route.mtu_expires = 600 net.ipv6.route.min_adv_mss = 4 net.ipv6.route.gc_min_interval_ms = 500 net.ipv6.icmp.ratelimit = 1000 net.ipv6.bindv6only = 0 net.ipv6.ip6frag_secret_interval = 600 net.ipv6.mld_max_msf = 64 net.phonet.local_port_range = 64 127 net.nf_conntrack_max = 65536 net.unix.max_dgram_qlen = 10 crypto.fips_enabled = 0 sunrpc.rpc_debug = 0 sunrpc.nfs_debug = 0 sunrpc.nfsd_debug = 0 sunrpc.nlm_debug = 0 sunrpc.transports = tcp 1048576 sunrpc.transports = udp 32768 sunrpc.udp_slot_table_entries = 16 sunrpc.tcp_slot_table_entries = 16 sunrpc.min_resvport = 665 sunrpc.max_resvport = 1023 sunrpc.tcp_fin_timeout = 15
Offline
Z pewnością nie ten wynik, pytałem o wynik polecenia:
sysctl -a 2>/dev/null | grep 'net.ipv4.ip_forward'
Prawidłowy wynik:
sysctl -a 2>/dev/null | grep 'net.ipv4.ip_forward' net.ipv4.ip_forward = 1
A u Ciebie jest listing na pół metra, ale bez tej wartości, którą powinien odfiltrować grep, i w ogóle bez parametrów ipv4 kernela.
Zobacz też routing na serwerze i u klienta, bo jest możliwość, że OpenVPN nie ustawia tras routingu, jak trzeba.
Masz może konfig klienta Openvpn?
Ostatnio edytowany przez Jacekalex (2013-02-09 00:09:27)
Offline
Wystarczy sysctl net.ipv4.ip_forward zamiast tego grepa, że się tak wtrącę.
Offline
By klienci mogli się widzieć nawzajem potrzeba do konfiguracji serwera dopisać
client-to-client
Konfiguracja firewall czy przekazywania nie ma tutaj nic do rzeczy. Pakiety od klienta do klienta nie wychodzą poza interfejs tap0 (tj. nie powinno).
Zobacz jednak na to http://backreference.org/2010/05/02/controlling-cli … s-in-openvpn/ być może nie możesz użyć trybu client-to-client, bo chcesz monitorować ruch pomiędzy klientami (to tak jakbyś faktycznie był routerem wtedy między nim, bo tak naprawdę jest, wszystko odbywa się na pulach o masce /30).
Zerknij też tutaj http://openvpn.net/index.php/open-source/documentation/howto.html w poszukiwaniu client-to-client.
Tak BTW bezpieczeństwa oraz elastyczniejszego zarządzania klientami, zainteresuj się certyfikatami :) jako metodą uwierzytelniania.
Offline
Jacekalex:
jest tak jak napisałeś:
root@hanibal:~# sysctl -a 2>/dev/null | grep 'net.ipv4.ip_forward' net.ipv4.ip_forward = 1
client to client zaraz obadam...
edit:
client to client nie jest mi do szczęścia potrzebne, ja nie chcę osiągnąć możliwości połączenia się z innym klientem vpn.
Założenie jest takie, że chciałbym po połączeniu się w tunelu między klientem(moim komputerem) a serwerem umieszczonym w jakiejśtam lokalizacji móc nawiązać połączenie z hostami lokalnymi(w podsieci 192.168.1.0/24). W tym momencie przy w/w konfiguracji vpn mogę połączyć się z serwerem vpn, dostaję zadany adres ip z puli ip tunelu (10.3.0.2, gdzie serwer ma 10.3.0.1) i na tym kończy się zabawa. Pingując lokalny adres serwera nie mam odpowiedzi, natomast pingując adres vpnowski serwer odpowiada.
Dlatego właśnie podejrzewam problem z firewallem.
Generalne potrzebuję tunelu do pulpitów zdalnych i podobnych zabawek, nic skomplikowanego tam się dziać nie będzie.
edit2:
config clienta:
dev tap proto udp remote adresip 5000 ping 15 ping-restart 45 ping-timer-rem push "ping 10" push "ping-restart 60" ifconfig 10.3.0.2 255.255.0.0 resolv-retry infinite nobind mute-replay-warnings secret static.key verb 1 float
Ostatnio edytowany przez machlo1 (2013-02-10 16:32:24)
Offline
Spróbuj debugować firewalla przez moduł TRACE użyty w tablicy RAW, wtedy w logach napisze dokładnie, co się dzieje z każdym pakietem.
Tylko nie próbuj włączać takiego debugowania na długo, bo w 2 godziny Ci cały dysk logi zeżrą.
Sznurek:
http://backreference.org/2010/06/11/iptables-debugging/
Chociaż z drugiej strony piszesz, że to firewall, a to równie dobrze może być spartolony routing, który OpenVPN ustawia w sposób daleki od doskonałości.
Tu też może być błąd, i jest bardzo prawdopodobny.
Pozdrawiam
;-)
Offline
Mam identyczną sytuację, czy coś udało się wyjaśnić?
Offline
Czy zrobiłeś bridge z interfejsem tap? Jeśli tak, to załącz konfigurację FW i interfejsów.
Offline