我正在尝试在桥接模式下设置openvpn。我之前在openbsd路由器上做过这个。现在我有一台运行openbsd的内部机器。客户端是Windows 7笔记本电脑。
设置如下。
我家里的本地局域网是10.0.10.0 255.255.255.0,网关是10.0.10.1,vpn服务器是10.0.10.15
我将端口9999 udp public转发到10.0.10.15。
在服务器上:/etc/hostname.tun0
link0 up
/etc/bridgename.bridge0
add pcn0
add tun0
up
/etc/openvpn.conf
dev-type tap
dev tun0
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
user nobody
group nobody
daemon openvpn
chroot /var/empty
port 9999
proto udp
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh1024.pem
management 127.0.0.1 9998 /etc/openvpn/mgmt.pwd
server-bridge 10.0.10.1 255.255.255.0 10.0.10.240 10.0.10.244
push "route 10.0.10.0 255.255.255.0"
ifconfig-pool-persist ipp.txt
client-to-client
tls-auth /etc/openvpn/keys/ta.key 0
cipher AES-256-CBC
max-clients 5
status openvpn-status.log
log-append openvpn.log
verb 4
mute 20
在客户端:openvpn.conf:
client
remote xxx.xxx.xxx.xxx 9999 #my ip is really here
proto udp
dev tap
dev-node VPN
nobind
comp-lzo
link-mtu 1590
persist-key
persist-tun
keepalive 10 120
management 127.0.0.1 9090 "mgmt.pwd"
ns-cert-type server
ca "ca.crt"
cert "tim-work-laptop.crt"
key "tim-work-laptop.key"
tls-client
tls-auth "ta.key" 1
cipher AES-256-CBC
pull
verb 2
当我在服务器上运行ifconfig -a时:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33204
priority: 0
groups: lo
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
pcn0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
lladdr 08:00:27:04:df:8c
priority: 0
groups: egress
media: Ethernet none
status: active
inet6 fe80::a00:27ff:fe04:df8c%pcn0 prefixlen 64 scopeid 0x1
inet 10.0.10.15 netmask 0xffffff00 broadcast 10.0.10.255
enc0: flags=0<> mtu 1536
priority: 0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
priority: 0
groups: tun
bridge0: flags=0<> mtu 1500
priority: 0
groups: bridge
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33204
priority: 0
groups: pflog
我的防火墙配置是打开的,因为它是一个内部盒子:
int_if="pcn0"
vpn_if="tun0"
br_if="bridge0"
vpn="9999"
ntp="123"
dns="53"
#set require-order no
set skip on lo
scrub in
pass in proto udp from any to any port $ntp
pass in proto {tcp,udp} from any to any port $dns
pass in # to establish keep-state
#vpn/bridge info
pass in quick on $int_if proto udp from any to $int_if port $vpn
pass in quick on {$vpn_if,$br_if} proto {tcp,udp,icmp} from any to any
pass out quick on {$vpn_if,$br_if} proto {tcp,udp,icmp} from any to any
Windows客户端连接,按预期给我一个10.0.10.240的ip,openvpn gui图标为绿色。但是,我无法在家里的本地局域网上ping任何内容,包括10.0.10.15。
有任何想法吗?
我正在使用以下指南:http : //blog.innerewut.de/2005/07/04/openvpn-2-0-on-openbsd http://openvpn.net/index.php/open-source/documentation /howto.html http://www.kernel-panic.it/openbsd/vpn/vpn4.html