-
Notifications
You must be signed in to change notification settings - Fork 0
/
v2ray.service.template
25 lines (22 loc) · 1005 Bytes
/
v2ray.service.template
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
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
User=root
ExecStartPre=/usr/sbin/iptables -t nat -N V2RAY
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -d ${IPV4_ADDRESS} -j RETURN
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -d ${REMOTE_HOST_ADDRESS} -j RETURN
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
ExecStartPre=/usr/sbin/iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 1010
ExecStartPre=/usr/sbin/iptables -t nat -A OUTPUT -j V2RAY
ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
ExecStop=/usr/sbin/iptables -t nat -F V2RAY
ExecStop=/usr/sbin/iptables -t nat -D OUTPUT -j V2RAY
ExecStop=/usr/sbin/iptables -t nat -X V2RAY
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target