Indice   FAQ  
Iscriviti  Login
Indice RouterOS RouterOS

OPENVPN LOCAL NETWORK ONLY

Tutto su questo sistema operativo linux based - Configurazioni, dubbi, problematiche &....

OPENVPN LOCAL NETWORK ONLY

Messaggioda robertom » ven 27 mag 2022, 10:57

Ho un piccolo problema
ho attivato OPENVPN, ma tutto il traffico passa dal mikrotik anche la navigazione internet.

quando un client si collega in VPN, come posso a dargli l'accesso alla sola rete locale e non ad internet?

questa è la configurazione

grazie



# may/24/2022 18:11:20 by RouterOS 6.47.10
# software id = JTY8-JMN3
#
# model = RB2011UiAS-2HnD
# serial number = ***********
/interface bridge
add admin-mac=DC:2C:6E:44:4F:4B auto-mac=no comment=defconf name=bridge
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-g/n channel-width=20/40mhz-XX \
disabled=no distance=indoors frequency=auto installation=indoor mode=\
ap-bridge ssid=MikroTik wireless-protocol=802.11 wps-mode=disabled
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk eap-methods="" \
mode=dynamic-keys supplicant-identity=MikroTik wpa-pre-shared-key=\
********* wpa2-pre-shared-key=***********
/ip pool
add name=dhcp ranges=192.168.1.115-192.168.1.170
add name=ovpn ranges=172.16.100.2-172.16.100.254
/ip dhcp-server
add address-pool=dhcp disabled=no interface=bridge lease-time=1h name=defconf
/ppp profile
add dns-server=172.16.100.1 local-address=ovpn name=open_vpn remote-address=\
ovpn use-compression=no use-encryption=required
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether7
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
add bridge=bridge comment=defconf interface=sfp1
add bridge=bridge comment=defconf interface=wlan1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/interface ovpn-server server
set auth=sha1 certificate=server cipher=aes256 default-profile=open_vpn \
enabled=yes require-client-certificate=yes
/ip address
add address=192.168.1.1/24 comment=defconf interface=ether2 network=\
192.168.1.0
add address=192.168.20.2/24 interface=ether1 network=192.168.20.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=172.16.100.0/24 comment=vpn dns-server=8.8.8.8 gateway=\
172.16.100.1 netmask=24
add address=192.168.1.0/24 comment=defconf gateway=192.168.1.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8
/ip dns static
add address=192.168.1.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=accept chain=input comment=VPN dst-port=1194 log=yes protocol=tcp
add action=accept chain=input comment=WINBOX dst-port=8291 protocol=tcp
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
"defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
/ip route
add distance=1 gateway=192.168.20.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set ssh disabled=yes
/lcd
set read-only-mode=yes time-interval=hour
/lcd interface pages
set 0 interfaces="sfp1,ether1,ether2,ether3,ether4,ether5,ether6,ether7,ether8\
,ether9,ether10"
/ppp secret
add comment="UTENTE *******" name=****** password=********** profile=open_vpn \
service=ovpn

/system clock
set time-zone-name=Europe/Rome
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
robertom
Mikrotik Curious User
Mikrotik Curious User
 
Messaggi: 4
Iscritto il: mer 9 feb 2022, 22:20
Uso routerOS dalla Versione: v6.x

Re: OPENVPN LOCAL NETWORK ONLY

Messaggioda TSI-Troccoli » dom 29 mag 2022, 14:21

Nella regola di SRC NAT ti basta specificare una source address list con le sole subnet locali che devono essere mascherate per andare verso internet.
Avatar utente
TSI-Troccoli
MikroTIK Guru
MikroTIK Guru
 
Messaggi: 184
Iscritto il: dom 20 mar 2016, 21:42
Uso routerOS dalla Versione: v5.x

Re: OPENVPN LOCAL NETWORK ONLY

Messaggioda robertom » dom 29 mag 2022, 15:06

aggiungendo alla regola la source address list 192.168.1.0/24, il client collegato in VPN non naviga + nemmeno con la connessione locale. a me serve che riesca a navigare con quella locale senza passare dalla VPN

grazie
robertom
Mikrotik Curious User
Mikrotik Curious User
 
Messaggi: 4
Iscritto il: mer 9 feb 2022, 22:20
Uso routerOS dalla Versione: v6.x

Re: OPENVPN LOCAL NETWORK ONLY

Messaggioda TSI-Troccoli » mar 31 mag 2022, 15:16

Se nella regola di source nat non è specificata l'interfaccia di uscita allora vanno escluse le subnet locali dalla regola di nat facendo una address list che le contenga e andandola a inserire come dst address list mettendo anche la negazione con il !
Avatar utente
TSI-Troccoli
MikroTIK Guru
MikroTIK Guru
 
Messaggi: 184
Iscritto il: dom 20 mar 2016, 21:42
Uso routerOS dalla Versione: v5.x

Re: OPENVPN LOCAL NETWORK ONLY

Messaggioda abbio90 » mar 7 giu 2022, 8:25

Nel client basta che togli il flag da add default route e aggiungi manualmente le rotte
Scopri https://foisfabio.it - Tutorial sul Network
Avatar utente
abbio90
Mikrotik-Pro 1° Liv
Mikrotik-Pro 1° Liv
 
Messaggi: 521
Iscritto il: lun 26 giu 2017, 19:11
Località: Oristano
Uso routerOS dalla Versione: v4.x
Certificazioni Mikrotik: MTCNA

Re: OPENVPN LOCAL NETWORK ONLY

Messaggioda robertom » lun 13 giu 2022, 15:38

questa è la configurazione del client

client
dev tun
proto tcp-client
remote *****************
port ************
nobind
persist-key
persist-tun
tls-client
remote-cert-tls server
ca CA.crt
cert client.crt
key client.key
verb 4
mute 10
cipher AES-256-CBC
auth SHA1
auth-user-pass auth.cfg
auth-nocache
redirect-gateway def1

devo eliminare ultima riga?
robertom
Mikrotik Curious User
Mikrotik Curious User
 
Messaggi: 4
Iscritto il: mer 9 feb 2022, 22:20
Uso routerOS dalla Versione: v6.x



Torna a RouterOS

Chi c’è in linea

Visitano il forum: Nessuno e 3 ospiti