edgerouter lite
我之前是tun模式的openvpn site-to-site,网络拓扑很简单,local tun <-> remote tun,简单配个ip就行,edgerouter上直接使用interface-route 跳转到local tun就行了。
后来换用了softether,tap模式,于是需要自己配置IP和路由表。我简单地把firewall modify的地址组切到新的设备上,但是之前的 google dns 和 sniproxy 都保留在openvpn侧。但是最近openvpn被查的厉害,ssh也是被盯上了,所以不得不切换设备到 softether 的 tap 上。
1 2 3 4 5 |
listen 192.168.12.2:3543 { proto tls table https_hosts device tap_vbr } |
测试,发现连接超时。测试使用的域名是 download.oracle.com,解析的ip是 106.187.61.57。
路由上tcpdump
1 |
tcpdump -n -i tap_vbr |
看到的请求却是:
1 2 3 4 |
14:22:04.471223 ARP, Request who-has 106.187.61.57 tell 192.168.99.50, length 28 14:22:05.471221 ARP, Request who-has 106.187.61.57 tell 192.168.99.50, length 28 14:22:06.475322 ARP, Request who-has 106.187.61.57 tell 192.168.99.50, length 28 ... |
所以。。。加路由吧。
因为公司是固定IP,所以之前配的是 system gateway-address。
这个时候直接配静态路由会报错:
1 2 |
root@ubnt# set protocols static route 0.0.0.0/0 next-hop 192.168.99.1 distance 100 Error: can not combine system gateway and static default route |
先删后加
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@ubnt# delete system gateway-address [edit] root@ubnt# commit [edit] root@ubnt# set protocols static route 0.0.0.0/0 next-hop my.static.gateway.address distance 10 [edit] root@ubnt# set protocols static route 0.0.0.0/0 next-hop 192.168.99.1 distance 100 [edit] root@uebnt# commit [edit] root@ubnt# save Saving configuration to '/config/config.boot'... Done |
注意一下,delete执行完后需要先commit,否则还会报错。
验证一下
1 2 3 4 5 |
root@ubnt# netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 my.st.gw.addr 0.0.0.0 UG 0 0 0 eth1 0.0.0.0 192.168.99.1 0.0.0.0 UG 0 0 0 tap_vbr |
如果执行命令前会纠结是否生效,简单 route add 测试一下即可。无比保证vpn的metric比默认网关的大。
另,interface-route + route 的混合模式没测试。