[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: VLAN und VPN mit OpenWRT



Am 07.01.2015 um 21:56 schrieb Steffen Weichert:
> Am Tue, den 06. Jan 2015 um 12:15 +0100 schrieb debgeri:
>
>> Gut das mit den VLANs bekomme ich hin, das wichtigste ist aber nun
>> wie man nun mit openvpn ins Internet kommt, also von INNEN nach AUßEN.
> Moin,
>
> ich habe seit Jahren einen ähnlichen Aufbau, der zuverlässig
> funktioniert. OpenVPN hatte ich davor auf meinem "Server" laufen und
> habe dessen Config einfach zu OpenWRT kopiert.
>
> root@router:~# cat /etc/config/openvpn
> package openvpn
>
> #################################################
> # Sample to include a custom config file.       #
> #################################################
>
> config openvpn master_zuhause
>
>         # Set to 1 to enable this instance:
>         option enable 1
>
>         # Include OpenVPN configuration
>         option config /etc/openvpn/master-zuhause.conf
>
>
> root@router:~# cat /etc/openvpn/master-zuhause.conf
> #
> local 10.20.30.160                      # nur am WLAN verfuegbar
>
> port 1194                               # Standardport
> proto udp                               # Standardprotokoll
>
> dev tun                                 # tun-Device nutzen (Routing)
>
> cd /etc/openvpn                         # hier liegen die config dateien
>
> ca keys/ca.crt                          #
> cert keys/master-zuhause.crt            #
> key keys/master-zuhause.key             #
>
> dh keys/dh1024.pem                      #
>
> crl-verify keys/crl.pem                 # das darf kein symlink sein,
>                                         # sonst permission denied
>
> server 192.168.30.0 255.255.255.0       # das openvpn-netz ist 192.168.30.0/24
>
> client-config-dir keys                  # clientspeziefische config
>                                         # jeder "Schluessel" bekommt
>                                         # seine eigene IP
>
> script-security 2
> learn-address /etc/openvpn/led-status.sh
>
> push "redirect-gateway"
> push "dhcp-option DNS 10.20.30.160"
> push "dhcp-option WINS 10.20.30.160"
> push "dhcp-option DOMAIN nachbar.zuhause"
>
> client-to-client                        # alle koennen sich sehen
>
> keepalive 20 120                        #
>
> persist-key                             #
> persist-tun                             #
>
> comp-lzo                                # Komprimierung einschalten
>
> root@router:~# ls -l /etc/openvpn/keys/
> -rw-------    1 root     root           370 Apr  6  2012 alex
> -rw-------    1 root     root           102 Apr  6  2012 angel
> -rw-------    1 root     root          1318 Apr  6  2012 ca.crt
> -rw-------    1 root     root           552 Apr  6  2012 crl.pem
> -rw-------    1 root     root           245 Apr  6  2012 dh1024.pem
> -rw-------    1 root     root           338 Apr  6  2012 eeedeb
> -rw-------    1 root     root           335 Apr  6  2012 eeewin
> -rw-------    1 root     root           876 Apr  6  2012 index.txt
> -rw-------    1 root     root           345 Apr  6  2012 lifebook
> -rw-------    1 root     root          4042 Apr  6  2012 master-zuhause.crt
> -rw-------    1 root     root           887 Apr  6  2012 master-zuhause.key
> -rw-------    1 root     root           345 Apr  6  2012 notebook
> -rw-------    1 root     root           164 Apr  6  2012 rechnerliste.txt
> -rw-------    1 root     root             3 Apr  6  2012 serial
>
> root@router:~# cat /etc/config/network
> ...
> config interface 'wlan'
>         option type 'bridge'
>         option _orig_ifname 'radio0.network1 wlan1'
>         option _orig_bridge 'true'
>         option proto 'static'
>         option ipaddr '10.20.30.160'
>         option netmask '255.255.255.0'
>
> config interface 'vpn_tun'
>         option proto 'none'
>         option ifname 'tun0'
>         option auto '1'
>         option delegate '0'
>
> root@router:~# cat /etc/config/firewall
> ...
> config zone
>         option name 'wlan'
>         option forward 'REJECT'
>         option output 'ACCEPT'
>         option network 'wlan'
>         option input 'REJECT'
>
> config zone
>         option name 'vpn_tun'
>         option input 'ACCEPT'
>         option forward 'REJECT'
>         option output 'ACCEPT'
>         option network 'vpn_tun'
> ...
> config forwarding
>         option dest 'wan'
>         option src 'vpn_tun'
>
> ...
> config rule
>         option target 'ACCEPT'
>         option src 'wlan'
>         option proto 'udp'
>         option dest_port '67'
>         option name 'wlan-dhcp'
>
> config rule
>         option target 'ACCEPT'
>         option src 'wlan'
>         option name 'wlan-selber'
>         option dest_ip '10.20.30.160'
>
>
> Eine kurze Erklärung dazu: Bei mir ist das wlan offen und deswegen
> erstmal input und forward REJECT. Anschließend habe ich DHCP (udp 67)
> und die IP-Adresse vom wlan freigegeben. OpenVPN ist an die wlan
> IP-Adresse gekoppelt und der VPN-Verkehr geht über vpn_tun.
> wlan und vpn_tun haben ihre eigene Firewallzone, aber nur vpn_tun hat
> eine Weiterleitung nach wan (also Internet). Eigentlich ganz einfach ;)
>
> HTH und tschüß
> Steffen
Hallo Steffen,

vielen Dank für die Hilfe!
Ich werde mir das mal anschauen, und ausprobieren.

Kann man das mit nur einem VLAN koppeln, so dass nur das eine VLAN per
vpn ins
Internet kann, so das jedes VLAN seine unabhängige Regel hat?




-------------------------------------------------

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  


Reply to: