Skip to content

Instantly share code, notes, and snippets.

@ibndias
Last active December 23, 2022 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibndias/959888ac94f60dadaeeeb6b5c2ed9d17 to your computer and use it in GitHub Desktop.
Save ibndias/959888ac94f60dadaeeeb6b5c2ed9d17 to your computer and use it in GitHub Desktop.
OpenVPN CCTV Raspberry

STEPS FOR RUNNING OPENVPN PROJECT

[DEVICES AND APPLICATIONS NEEDED ]

  1. VIEWER = PC/Laptop, RJ45 cable, OMX Player (1 set)
  2. CCTV (for each) = CCTV device, Power Cable, RJ-45 (3 sets)
  3. Wifi Router+ Power (1 pcs)
  4. RPI (4 pcs)
  5. CMOD A7 35T (4 pcs)
  6. Jumper Cable

[OS]

-Hostname: vpn_gateway[n] n=1/2/3 -Username: pi -Pass: 1234 -Open VPN automatically run after OS booting -(-) DHCP not running automatically [maybe for next project]

[RPI]

-It needs 4 pcs (1 viewer, 3 CCTV)
-RPI PIN    1. RJ45  -  To computer client (for viewer only)
                        To CCTV HIKVISIN model DS-2CD211F
            2. SPI PIN  =   SPIO CS0    (GPIO 8)    (PIN24) <---> PIN 22 CMODA7 35T (CS)
                            SPIO MOSI   (GPIO 10)   (PIN19) <---> PIN 20 CMODA7 35T (MOSI)
                            SPIO MISO   (GPIO 9)    (PIN21) <---> PIN 21 CMODA7 35T (MISO)
                            SPIO SCLK   (GPIO 11)   (PIN23) <---> PIN 23 CMODA7 35T (SCK)
                            3.3V PWR    (PIN 1)             <---> PIN 24 CMODA7 35T (VU)
                            GND PWR     (PIN 6)             <---> PIN 25 CMODA7 35T (GND)

##[DIAGRAM]

[ Viewer PC ] <---RJ-45---> [ RPI ] <--WIFI-->  |^^^^^^^^^^^^^^^| <---WIFI------>[ RPI ]<---------->  CCTV
                              |                 |               |      |            |
                        Jumper Cable            |               |      |        Jumper Cable
                              |                 |               |      |            |
                          [CMOD A7]             |               |      |        [CMOD A7]  
                                                |               |      |
                                                |   Internet    |      --WIFI--> [ RPI ]<---------->  CCTV
                                                |               |      |            |
                                                |   (OpenVPN    |      |            |
                                                |   Server)     |      |        [CMOD A7]
                                                |               |      |
                                                |               |      --WIFI--> [ RPI ]<---------->  CCTV
                                                |               |                   |
                                                |               |                   |
                                                |_______________|               [CMOD A7]

[HIKVISION CCTV]

-To reset the device --

Do this step if you can not login to the CCTV device only

  1. Open the casing
  2. Power ON
  3. Press and Hold RESET BUTTON for 30 s
  4. Switch OFF
  5. Re-power ON

-For Setting CCTV

PIN RJ-45 CCTV <----> pin RJ-45 RPI
  1. Install with SADP Apps (SADP HiTools by HIKVISION)
  2. Connect Laptop and CCTV devices to the router (without connected to RPI and FPGA)
  3. Check the IP for each CCTV Device on SADP Apps (will be apear automatically)
  4. Login to each decive and setting the CCTV IP into VPN IP (this demo using 10.1.10.1XX) [XX=Different for each CCTV]
  • The ACTIVATION CODE = Admin123!
  • Password/Key = Admin123!
  1. Check list CCTV one by one and modified each IP devices.

[RUNNING STEP]

  1. Setting each RPI OpenVPN param in file /boot/vpn/bridge-up.sh
bridge_addr="10.1.10.102" #10.1.10.10X
  1. If there is an error run
    ps aux | grep openvpn
    sudo pkill openvpn
    sudo openvpn --config /boot/vpn/client.opvn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment