VPN a nas a přístup k ní

Problematika administrace LAN či WIFI sítí

Moderátor: Mods_senior

Uživatelský avatar
ITCrowd
Tvůrce článků
Guru Level 13.5
Guru Level 13.5
Příspěvky: 23591
Registrován: březen 10
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod ITCrowd » 15 črc 2019 08:16

ITCrowd píše:A připojuješ se jak? Přes jakého klienta? A klient říká co? A ping na nějaké jiné zařízení v síti funguje?
A zkoušíš to jak? Na vnitřní síti?
A dej sem první dvě čísla tvé veřejné IP adresy.
Zkusili jste to vypnout a zapnout? Problémy řeším pouze v tématech. Do SZ mi proto píšete zbytečně.
Základní diagnostika WiFi Jak na diagnostiku sítě Router jako switch Proč je nesmysl chtít router s velkým dosahem Vybíráme router

Reklama
VonMoskovna
nováček
Příspěvky: 10
Registrován: srpen 17
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod VonMoskovna » 15 črc 2019 13:38

Zkouším to přes mobilní internet, takže ne z mojí sítě a fakt se připojím nemám důvod vám lhát . Ta adresa začíná 95.82
ale z té mobilní sítě se připojím, takže veřejná musí být.

Co se týče rady od dvorakj zadal jsem to do configu openvpn clienta ale nic se nezměnilo.
Tady jsou chyby z logu jen jsem smazal ty poslední dva bajty veř ip...

Mon Jul 15 13:26:44 2019 Warning: address 192.168.1.1 is not a network address in relation to netmask 255.255.255.0
Mon Jul 15 13:26:44 2019 ROUTE: route addition failed using CreateIpForwardEntry: Parametr není správný. [status=87 if_index=7]
Mon Jul 15 13:26:44 2019 Route addition via IPAPI failed [adaptive]
Mon Jul 15 13:26:44 2019 Route addition fallback to route.exe
Mon Jul 15 13:26:44 2019 env_block: add PATH=C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Mon Jul 15 13:26:44 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Mon Jul 15 13:26:44 2019 Initialization Sequence Completed
Mon Jul 15 13:26:44 2019 MANAGEMENT: >STATE:1563190004,CONNECTED,SUCCESS,10.1.0.2,95.82.,1194,,
Mon Jul 15 13:26:59 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:08 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:19 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:29 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:39 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:50 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:27:50 2019 AEAD Decrypt error: bad packet ID (may be a replay): [ #7 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings
Mon Jul 15 13:27:59 2019 write to TUN/TAP : Unknown error (code=122)
Mon Jul 15 13:28:09 2019 write to TUN/TAP : Unknown error (code=122)

dvorakj
Master Level 7
Master Level 7
Příspěvky: 4834
Registrován: březen 12
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod dvorakj » 15 črc 2019 18:31

jeste vypis konfiguracniho souboru...
a pravidlo na firewallu, ze muzes pristupovat do vnitrni site z vpn

VonMoskovna
nováček
Příspěvky: 10
Registrován: srpen 17
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod VonMoskovna » 16 črc 2019 23:00

Konfigurační soubor:
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one. On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server? Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote 95.82. 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing. Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server. Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nobody

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here. See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets. Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description. It's best to use
# a separate .crt/.key file pair
# for each client. A single ca
# file can be used for all clients.
ca ca.crt
cert notebook.crt
key notebook.key

# Verify server certificate by checking that the
# certicate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
# http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
# digitalSignature, keyEncipherment
# and the extendedKeyUsage to
# serverAuth
# EasyRSA can do this for you.
remote-cert-tls server

# If a tls-auth key is used on the server
# then every client must also have the key.
#tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
# Note that v2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
#comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20
route 192.168.1.1 255.255.255.0 10.1.0.0


a pravidla do firewallu jsem dal tyto
iptables -I INPUT 1 -p udp -dport 1194 -j ACCEPT
iptables -I FORWARD 1 -source 192.168.1.1/24 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT

Zkoušel jsem to i bez nich a připojím se uplně stejně.

dvorakj
Master Level 7
Master Level 7
Příspěvky: 4834
Registrován: březen 12
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod dvorakj » 17 črc 2019 00:21

vzdyt route do site tam stejne nemas.
priklad: soubor.ovpn

client
dev tap
proto tcp-client
remote verejna_ip port
ca ca.crt # certifikat certifikacni autority
cert achilles-home.crt # klientsky certifikát
key achilles-home.key # klientsky klic
remote-cert-tls server
tls-client
port 61194
#ping 15
#ping-restart 45
#ping-timer-rem
persist-tun
persist-key
#mute-replay-warnings
#verb 6
cipher AES-256-CBC
#auth SHA1
#pull
reneg-sec 0
auth-nocache
auth-user-pass password.txt
dhcp-option DNS 8.8.8.8
route 192.168.50.0 255.255.255.0 10.10.10.1
route 192.168.51.0 255.255.255.0 10.10.10.1
route 192.168.52.0 255.255.255.0 10.10.10.1

dvorakj
Master Level 7
Master Level 7
Příspěvky: 4834
Registrován: březen 12
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod dvorakj » 18 črc 2019 21:21

zajimalo by me, jak to dopadlo

VonMoskovna
nováček
Příspěvky: 10
Registrován: srpen 17
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod VonMoskovna » 19 črc 2019 00:45

Takže jestli to správně chápu ke každému zařízení ke kterému chci přistupovat tak musím udělat tu route ?
Ja myslel, že právě jen jednu do té LAN sítě (192.168.1.1).
A ještě jedna otázka ta adresa za maskou tam má být adresa VPN serveru nebo moje přidělená adresa kterou mi přidělí VPN server ?

Uživatelský avatar
Microsheep
Level 4.5
Level 4.5
Příspěvky: 1656
Registrován: leden 10
Pohlaví: Muž
Stav:
Offline

Re: VPN a nas a přístup k ní

Příspěvekod Microsheep » 19 črc 2019 07:45

Route do sítě ve VPN configu má, poslední řádek: route 192.168.1.1 255.255.255.0 10.1.0.0
Nicméně dle konfigurace, co si poskytoval, by měla routa vypadat:
route 192.168.1.0 255.255.255.0 10.0.0.1

Protože:
Tvoje lokální síť je teda 192.168.1.0/24
Když vytočíš VPN, dostaneš adresu 10.0.0.2 a VPN má 10.0.0.1

- Můžeš si to jednoduše ověřit, vytoč VPN a do cmd "route print" v případě, že tam danou route neuvidíš, musíš jí do konfigurace přidat. (bavíme se tedy o tom, že ta VPN se vytočí - což tvrdíš, že ano >> ikonka by měla zezelenat), taky je dobré použít tracert nikoliv ping, pokud chceš vidět kudy se provoz snaží projít.

Pochopil jsi to správně, stačí ti jedna routa do sítě, nikoliv ke každému zařízení.
Adresa za maskou je kam má ten provoz poslat do jaké brány, aby se dostal do té sítě, co potřebuješ.
Počítače v lokální síti route nepotřebují v případě, že VPN server dělá zároveň i jejich bránu, což v tvém případě je, pokud jsem správně pochopil.


  • Mohlo by vás zajímat
    Odpovědi
    Zobrazení
    Poslední příspěvek
  • Přístup k flask app (spuštěné na VM - linux) z internetu (prohlížeče) Příloha(y)
    od d-pozz » 08 říj 2023 20:31 » v Internet a internetové prohlížeče
    34
    7604
    od d-pozz Zobrazit poslední příspěvek
    20 říj 2023 16:41
  • Přístup na domácí server (WebDAV) z lokální sítě i z internetu
    od remkren » 30 pro 2023 17:19 » v Administrace sítě
    5
    1160
    od Microsheep Zobrazit poslední příspěvek
    31 pro 2023 08:29

Zpět na “Administrace sítě”

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 3 hosti