Acties:
  • 0 Henk 'm!

  • 3dmaster
  • Registratie: December 2004
  • Laatst online: 10-09 14:55
Ik probeer tussen twee edgerouter x 'en een vpn verbinding op te zetten. Een edgerouter zit op een vaste plek en de andere is 'mobiel' dus komt telkens vanaf een ander ip binnen.

Nu wilde ik een simpele server-client opzetten middels deze handleiding:
https://help.ubnt.com/hc/...with-TLS-and-Multiple-WAN

enige verschil is dat ik maar 1 wan heb maar dat maakt verder niet echt uit.

Config vpn-server side
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
firewall {
    all-ping enable
    broadcast-ping disable
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name WAN_IN {
        default-action drop
        description "WAN to internal"
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        default-action drop
        description "WAN to router"
        rule 10 {
            action accept
            description "established / related"
            destination {
                group {
                }
            }
            log disable
            protocol all
            source {
                group {
                }
            }
            state {
                established enable
                invalid disable
                new disable
                related enable
            }
        }
        rule 20 {
            action accept
            description OpenVPN
            destination {
                port 1194
            }
            log disable
            protocol udp
            state {
                established enable
                related enable
            }
        }
        rule 30 {
            action accept
            destination {
                group {
                    address-group ADDRv4_eth1
                }
                port 22
            }
            log disable
            protocol tcp
            state {
                established enable
                invalid disable
                new enable
                related enable
            }
        }
        rule 40 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        description "Local 2"
        duplex auto
        speed auto
    }
    ethernet eth1 {
        address dhcp
        description Internet
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_LOCAL
            }
        }
        speed auto
    }
    ethernet eth2 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth3 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth4 {
        description Local
        duplex auto
        speed auto
    }
    loopback lo {
    }
    openvpn vtun0 {
        hash sha256
        mode server
        openvpn-option -comp-lzo
        server {
            client mobielerouter {
                ip 10.99.99.2
            }
            push-route 192.168.178.0/24
            subnet 10.99.99.0/24
        }
        tls {
            ca-cert-file /config/auth/cacert.pem
            cert-file /config/auth/server.pem
            dh-file /config/auth/dhp.pem
            key-file /config/auth/server.key
        }
    }
    switch switch0 {
        address 192.168.178.1/24
        description Local
        mtu 1500
        switch-port {
            interface eth0 {
            }
            interface eth2 {
            }
            interface eth3 {
            }
            interface eth4 {
            }
            vlan-aware disable
        }
    }
}


Config client
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
firewall {
    all-ping enable
    broadcast-ping disable
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name WAN_IN {
        default-action drop
        description "WAN to internal"
        rule 10 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 20 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    name WAN_LOCAL {
        default-action drop
        description "WAN to router"
        rule 10 {
            action accept
            description OpenVPN
            destination {
                port 1194
            }
            log disable
            protocol udp
        }
        rule 20 {
            action accept
            description "Allow established/related"
            state {
                established enable
                related enable
            }
        }
        rule 30 {
            action drop
            description "Drop invalid state"
            state {
                invalid enable
            }
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        description "Local 2"
        duplex auto
        speed auto
    }
    ethernet eth1 {
        address dhcp
        description Internet
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_LOCAL
            }
        }
        speed auto
    }
    ethernet eth2 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth3 {
        description Local
        duplex auto
        speed auto
    }
    ethernet eth4 {
        description Local
        duplex auto
        speed auto
    }
    loopback lo {
    }
    openvpn vtun0 {
        hash sha256
        mode client
        openvpn-option --comp-lzo
        remote-host <*ip adres*>
        tls {
            ca-cert-file /config/auth/cacert.pem
            cert-file /config/auth/mobielerouter.pem
            key-file /config/auth/mobielerouter.key
        }
    }
    switch switch0 {
        address 192.168.2.1/24
        description Local
        mtu 1500
        switch-port {
            interface eth0 {
            }
            interface eth2 {
            }
            interface eth3 {
            }
            interface eth4 {
            }
            vlan-aware disable
        }
    }
}


De client geeft continue dit in zijn log
code:
1
2
3
4
5
6
7
8
Aug 15 20:30:35 ubnt openvpn[1205]: Socket Buffers: R=[180224->131072] S=[180224->131072]
Aug 15 20:30:36 ubnt openvpn[1205]: UDPv4 link local: [undef]
Aug 15 20:30:36 ubnt openvpn[1205]: UDPv4 link remote: [AF_INET]<ip-address>:1194
Aug 15 20:31:37 ubnt openvpn[1205]: TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Aug 15 20:31:37 ubnt openvpn[1205]: TLS Error: TLS handshake failed
Aug 15 20:31:37 ubnt openvpn[1205]: SIGUSR1[soft,tls-error] received, process restarting
Aug 15 20:31:37 ubnt openvpn[1205]: Restart pause, 2 second(s)
Aug 15 20:31:39 ubnt openvpn[1205]: WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.


op de server komt volgens mij niks binnen want daar zie ik qua openvpn alleen eenmalig bij de boot
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Aug 15 20:12:12 RouterStudio openvpn[1224]: OpenVPN 2.3.2 mipsel-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Aug  3 2017
Aug 15 20:12:12 RouterStudio openvpn[1224]: MANAGEMENT: unix domain socket listening on /tmp/openvpn-mgmt-intf
Aug 15 20:12:12 RouterStudio openvpn[1224]: Diffie-Hellman initialized with 1024 bit key
Aug 15 20:12:12 RouterStudio openvpn[1224]: WARNING: file '/config/auth/server.key' is group or others accessible
Aug 15 20:12:12 RouterStudio openvpn[1224]: Socket Buffers: R=[180224->131072] S=[180224->131072]
Aug 15 20:12:12 RouterStudio openvpn[1224]: TUN/TAP device vtun0 opened
Aug 15 20:12:12 RouterStudio openvpn[1224]: TUN/TAP TX queue length set to 100
Aug 15 20:12:12 RouterStudio openvpn[1224]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Aug 15 20:12:12 RouterStudio openvpn[1224]: /sbin/ip link set dev vtun0 up mtu 1500
Aug 15 20:12:12 RouterStudio openvpn[1224]: /sbin/ip addr add dev vtun0 10.99.99.1/24 broadcast 10.99.99.255
Aug 15 20:12:12 RouterStudio openvpn[1227]: UDPv4 link local (bound): [undef]
Aug 15 20:12:12 RouterStudio openvpn[1227]: UDPv4 link remote: [undef]
Aug 15 20:12:12 RouterStudio openvpn[1227]: MULTI: multi_init called, r=256 v=256
Aug 15 20:12:12 RouterStudio openvpn[1227]: IFCONFIG POOL: base=10.99.99.2 size=252, ipv6=0
Aug 15 20:12:12 RouterStudio openvpn[1227]: Initialization Sequence Completed


Ziet iemand de fout? Ik ben er al een hele avond mee aan het knutselen maar ik zie het niet :F

Last night I lay in bed looking up at the stars in the sky and I thought to myself, where the heck is the ceiling.


Acties:
  • 0 Henk 'm!

  • Jeroen_ae92
  • Registratie: April 2012
  • Laatst online: 12-09 16:54
Waarom wil je een client-server setup en niet een site to site openvpn? Die is namelijk veel makkelijker te configureren, beveiligen en qua routing opties is het eenvoudiger.

Maar als ik even snel je config bekijk, heb je op je client config kant de certificaten in de juiste dir staan en ge-chmod naar 600? En een masq rule voor je destination network?

U+


Acties:
  • +2 Henk 'm!

  • Sneezydevil
  • Registratie: Januari 2002
  • Laatst online: 08-09 10:28
Volgens mij accepteer je geen "new" verkeer op poort 1194 op je WAN_LOCAL:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
        rule 20 {
            action accept
            description OpenVPN
            destination {
                port 1194
            }
            log disable
            protocol udp
            state {
                established enable
                related enable
            }
        }


Dus bij de state moet volgens mij ook nog staan "new enable"

Acties:
  • 0 Henk 'm!

  • Steefph
  • Registratie: Juli 2002
  • Laatst online: 11-09 22:48
Ik weet niet wat bij jou "mobiel" is maar, misschien verstandig om het verkeer over poort 443 te laten lopen en in TCP mode. Dit voorkomt dat als je achter een dichtgetimmerde firewall komt te zitten dat de verbinding wel tot stand komt :)

Alles is terug te redeneren naar 4


Acties:
  • 0 Henk 'm!

  • 3dmaster
  • Registratie: December 2004
  • Laatst online: 10-09 14:55
Sneezydevil schreef op woensdag 16 augustus 2017 @ 08:19:
Volgens mij accepteer je geen "new" verkeer op poort 1194 op je WAN_LOCAL:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
        rule 20 {
            action accept
            description OpenVPN
            destination {
                port 1194
            }
            log disable
            protocol udp
            state {
                established enable
                related enable
            }
        }


Dus bij de state moet volgens mij ook nog staan "new enable"
Aaarg. Zelf dus continue overheen gekeken. Die 30 graden gisteren in het serverhok heeft me de das omgedaan :F

Het werkt nu.

Last night I lay in bed looking up at the stars in the sky and I thought to myself, where the heck is the ceiling.