Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Published: 2022-02-15

Last modified: 2022-0203-1501

Problem

Info

I want to utilize proxy to route node network traffic through it.

Solution

Edit the vprotect-node.service env file which is located in
/libopt/systemd/systemvprotect/vprotect-node.serviceenv

Originally this file should look like the one below

Code Block
languagebash
[Unit]
Description = vProtect Node
Wants = vdo.service nfs.service nfslock.service rpcbind.service nfs-server.service nfs-lock.service nfs-idmap.service vprotect-vmware.service
After = syslog.target network.target vprotect-server.service vdo.service

[Service]
User = vprotect
ExecStartPre = /usr/bin/vprotect configureNbd
ExecStart = /usr/bin/vprotect start
ExecStop = /usr/bin/vprotect stop
Type = forking
Restart = on-failure

[Install]
WantedBy = multi-user.target

Add the following lines to the [Service] section.

Code Block
Environment="http_proxy=# ===================================================================
# This is environment variables file used by the vprotect-node
#
# Called From:  vprotect-node.service 
# ===================================================================

# Variable for http proxy 
#http_proxy=""

# Variable for https proxy
#https_proxy=""

# Variable for no proxy
#no_proxy="localhost,127.0.0.1"

Uncomment the following lines and enter the correct proxy address

Code Block
http_proxy="proxy.address:8080"
Environment="https_proxy="proxy.adress:8080"
Environment="no_proxy="localhost,127.0.0.1"
Note

Make sure to change proxy.address to the address of Your proxy, it can be either IP address or FQDN. Also set the correct port, in the example above it is 8080

The vprotect-node.service env file after modification should look like this

Code Block
languagebash
[Unit]
Description = vProtect Node
Wants = vdo.service nfs.service nfslock.service rpcbind.service nfs-server.service nfs-lock.service nfs-idmap.service vprotect-vmware.service
After = syslog.target network.target vprotect-server.service vdo.service

[Service]
User = vprotect
Environment="http_proxy=proxy.address:8080"
Environment="https_proxy=proxy.adress:8080"
Environment="no_proxy=# ===================================================================
# This is environment variables file used by the vprotect-node
#
# Called From:  vprotect-node.service 
# ===================================================================

# Variable for http proxy 
http_proxy="proxy.address:8080"

# Variable for https proxy
https_proxy="proxy.address:8080"

# Variable for no proxy
no_proxy="localhost,127.0.0.1"
ExecStartPre = /usr/bin/vprotect configureNbd
ExecStart = /usr/bin/vprotect start
ExecStop = /usr/bin/vprotect stop
Type = forking
Restart = on-failure

[Install]
WantedBy = multi-user.target

After modifying the file You need to reload a systemd file and restart the vprotect node and server to apply the changes

Code Block
languagebash
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart vprotect-node vprotect-server