本文共 2918 字,大约阅读时间需要 9 分钟。
在家办公肿么办,利用vyatta在办公室架设一台***,可以让你在家接入办公室网络进行办公,
机房在外地肿么办,利用vyatta在机房架设一台***,可以让你在办公室接入机房内网进行运维。
这里使用pptp,优点是快速方便,使用windows自带客户端即可。
接之前的环境,
eth0为内网,地址10.0.0.100/24
eth1为外网,地址192.168.122.100/24
有一点需要注意,eth1能够访问公网还不够,必须有真实的公网地址,否则你从家里是拨不进来的。
- 将192.168.122.100替换为你的公网地址
- set *** pptp remote-access outside-address 192.168.122.100
-
- 设置内网IP起始结束地址
- set *** pptp remote-access client-ip-pool start 10.0.0.240
- set *** pptp remote-access client-ip-pool stop 10.0.0.245
-
- 设置验证模式
- set *** pptp remote-access authentication mode local
-
- 设置用户名和密码
- set *** pptp remote-access authentication local-users username user01 password user01password
-
- commit
值得关注的是***的防火墙设置,除了端口1723外,还需要放行gre协议,这里贴出一份:
- set firewall all-ping enable
- set firewall syn-cookies enable
-
- set firewall name *** description "allow *** from office only"
- set firewall name *** rule 10 description "allow port 1723"
- set firewall name *** rule 10 action accept
- set firewall name *** rule 10 protocol tcp
- set firewall name *** rule 10 destionation address 192.168.122.100
- set firewall name *** rule 10 destination port 1723
- set firewall name *** rule 10 source address xxx.xxx.xx.xx
- set firewall name *** rule 10 state new enable
- set firewall name *** rule 10 state established enable
- set firewall name *** rule 10 state related enable
-
- set firewall name *** rule 20 description "allow gre"
- set firewall name *** rule 20 action accept
- set firewall name *** rule 20 protocol gre
- set firewall name *** rule 20 destination address 192.168.122.100
- set firewall name *** rule 20 source address xxx.xxx.xx.xx
- set firewall name *** rule 20 state established enable
- set firewall name *** rule 20 state related enable
-
- set interfaces ethernet eth1 firewall local name ***
-
- commit
- save
最后将防火墙规则设置成eth1的local,是因为vyatta自己就是***服务器。
vyatta支持多种***方式,pptp、l2tp,open***等。
上面讲述的是pptp拨号的***,适合家庭到办公室,或者办公室到机房的运维,但是pptp缺点是加密不够,SSL加密,安全性较差。
open***在安全上做得比较好,TLS加密,缺点仅是需要专门的open***客户端,可到官网下载。
安装配置仅摘抄以前的笔记,仅供参考
- cd /usr/share/doc/open***/example/easy-rsa/2.0
- source ./vars
- ./clean-all
- ./build-ca
- ./build-key-server server
- ./build-key client
- ./build-dh
- rsync -av --delete keys /config/auth/
-
- set interface open*** vtun0
- set interface open*** vtun0 encryption aes256
- set interface open*** vtun0 hash sha1
- set interface open*** vtun0 mode server
- set interface open*** vtun0 local-port 1194
- set interface open*** vtun0 protocol udp
- set interface open*** vtun0 server subnet 192.168.10.0/24
- set interface open*** vtun0 tls ca-cert-file /config/auth/ca.crt
- set interface open*** vtun0 tls cert-file /config/auth/server.crt
- set interface open*** vtun0 tls dh-file /conffig/auth/dh1024.pem
- set interface open*** vtun0 tls key-file /config/auth/server.key
- set interface open*** vtun0 open***-option “--push route 192.168.10.0 255.255.255.0 --push route 192.168.2.0 255.255.255.0 –comp-lzo”
- commit
- save
客户端配置
- dev tun
- client
- remote 12.34.56.78
- ca ca.crt
- cert client.crt
- key client.key
如果是不同机房之间互通,则要架设site到site的***,详见官方文档。
转载地址:http://tnavl.baihongyu.com/