Hello, I am creating VPN client for my team. I have completed L2TP, PPTP and IKEv2 section. Now I need to implement OpenVPN. Can somebody help me with creating OpenVPN client using VB.net. I have the code almost. However, it is not working well for me.
Here process.start throws file not found.
Shell not working..showing is not a method
Interaction.shell working but not connecting
What I have tried:
Public Sub myConnection()
proto = "udp"
serverf = "--client --dev tun --remote " & IPServer & " --proto " & proto & " --port " & "1194" & " --lport " & "1194" & _
"--keepalive 20 60 --reneg-sec 432000 --resolv-retry infinite --cipher AES-128-CBC --fast-io --pull --tun-mtu 1500 --auth-user-pass data\user.txt " & _
"--persist-key --persist-tun --ca data\vpnbook.ca --verb 3 --redirect-gateway --route-delay 2 --explicit-exit-notify 2 " & _
" --log data\logfile.tmp --status data\status.dat 1 "
SelectServer = serverf
End Sub
Private Sub ovconnection()
loadsettings()
tnew = 0
Try
pingurl = " -t"
Catch ex As Exception
End Try
If lb_con.Content = "Connect" Then
If tb1_server.Text = "" Then
MessageBox.Show("Please select your server!")
Else
lb1.Content = "Connecting"
lb_con.Content = "Connecting"
myConnection()
process.Start(Forms.Application.StartupPath & "\bin\openvpn " & SelectServer, AppWinStyle.Hide)
End If
ElseIf lb_con.Content = "Disconnect" Then
Dim g As String
g = "taskkill /f /im openvpn.exe"
Interaction.Shell("cmd /c" & g, vbHide)
g = "taskkill /f /im ping.exe"
Interaction.Shell("cmd /c" & g, vbHide)
lb1.Content = "Disconnected"
lb_con.Content = "Connect"
ElseIf lb_con.Content = "Connecting" Then
If MsgBox("Do You want to Disconnect VPN", MsgBoxStyle.YesNo, "VPN") = vbYes Then
c = 0
Dim g As String
g = "taskkill /f /im openvpn.exe"
Interaction.Shell("cmd /c" & g, vbHide)
g = "taskkill /f /im ping.exe"
Interaction.Shell("cmd /c" & g, vbHide)
lb1.Content = "Disconnected"
lb_con.Content = "Connect"
End If
End If
End Sub