---
# System prepended metadata

title: TWCC VM - NCHC VPN

---

# TWCC VM - NCHC VPN

login to VM
安裝 openfortivpn
不要用預設路由 會造成VM斷線失連
所以要設定 set-routes = 0
手動查找要連的服務主機IP
然後加入 路由表
就可以開始用了

### install vpn tool
$ apt-get install openfortivpn

### config vpn connection
$ vi /etc/openfortivpn/config

```
# config file for openfortivpn, see man openfortivpn(1)
host = vpn-hc.nchc.org.tw
port = 443
username = 
password = 
set-routes = 0
trusted-cert = fcf8010a3c12408e44fc3d949843b9fb16b46f26dcc5d179beff8f9600541bb5
```
### start vpn
$ sudo openfortivpn &

### look for host you want to connect by vpn
$ nslookup gitlab.nchc.org.tw
Server:		140.110.16.1
Address:	140.110.16.1#53

Name:	gitlab.NCHC.org.tw
Address: 140.110.144.105

### add to vpn route
$ sudo route add -host 140.110.144.105/32 dev ppp0

### make sure route correct
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.211.254 0.0.0.0         UG    100    0        0 ens3
1.1.1.1         0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
140.110.144.105 0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
169.254.169.254 192.168.211.2   255.255.255.255 UGH   100    0        0 ens3
192.168.211.0   0.0.0.0         255.255.255.0   U     0      0        0 ens3

### git clone

git clone https://gitlab.nchc.org.tw/cp4d/cp4d_gitbook.git

### disable vpn
$ sudo pkill openfortivpn

### my