Solved OpenVPN problem from outside network

Hi everyone,

I have installed OpenVPN on a FreeBSD 10.3. and everything works fine since I am inside of the LAN, when I connect from internet it can successfully connect to the OpenVPN service but then there is no redirection at all back to internet.

Thank you very much

Ip router: 192.168.1.1
Ip FreeBSD: 192.168.1.20

/usr/local/etc/openvpn/openvpn.conf
Code:
port 1194
proto tcp
dev tap0

ca /usr/local/etc/openvpn/keys/ca.crt
cert /usr/local/etc/openvpn/keys/openvpn-server.crt
key /usr/local/etc/openvpn/keys/openvpn-server.key  # This file should be kept secret
dh /usr/local/etc/openvpn/keys/dh.pem

server-bridge 192.168.1.1 255.255.255.0 192.168.1.250 192.168.1.254

client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
max-clients 10

user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log

/etc/rc.conf
Code:
hostname="Server"

ifconfig_re0="inet 192.168.1.20 netmask 255.255.255.0"
defaultrouter="192.168.1.1"

cloned_interfaces="tap0 tap1 bridge0"
ifconfig_tap0="inet 192.168.1.249/24"
ifconfig_bridge0="addm tap0 addm tap1 addm em0 up"

openvpn_enable="YES"
openvpn_if="tap bridge"
openvpn_configfile="/usr/local/etc/openvpn/openvpn.conf"

sshd_enable="YES"
dumpdev="AUTO"
gateway_enable="YES"
squid_enable=YES
ddclient_enable="YES"
sendmail_enable="NO"
sendmail_msp_queue_enable="NO"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO"


ifconfig
Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether e0:cb:4e:d3:ee:8f
        inet 192.168.1.20 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 00:bd:36:1a:00:00
        inet 192.168.1.249 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        Opened by PID 908
tap1: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 00:bd:3c:1a:00:01
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 02:5a:a5:99:6a:00
        nd6 options=9<PERFORMNUD,IFDISABLED>
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 5 priority 128 path cost 2000000
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 2000000
 
Some hours later I fixed it! Working perfectly!

/usr/local/etc/openvpn/openvpn.conf
Code:
port 1194
proto tcp

dev tap0

ca /usr/local/etc/openvpn/keys/ca.crt
cert /usr/local/etc/openvpn/keys/openvpn-server.crt
key /usr/local/etc/openvpn/keys/openvpn-server.key  # This file should be kept secret
dh /usr/local/etc/openvpn/keys/dh.pem

server-bridge 192.168.1.1 255.255.255.0 192.168.1.250 192.168.1.254

client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
max-clients 10
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log

/etc/rc.conf
Code:
hostname="Server"

gateway_enable="YES"

openvpn_enable="YES"
openvpn_if="tap bridge"
openvpn_configfile="/usr/local/etc/openvpn/openvpn.conf"

cloned_interfaces="tap0 bridge0"
ifconfig_tap0="inet 192.168.1.21 netmask 255.255.255.0 up"
ifconfig_bridge0="addm tap0 addm re0 up"
ifconfig_re0="up"
ifconfig_re0="inet 192.168.1.20 netmask 255.255.255.0"
defaultrouter="192.168.1.1"

sshd_enable="YES"

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

squid_enable=YES
ddclient_enable="YES"
sendmail_enable="NO"
sendmail_msp_queue_enable="NO"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO"
 
Back
Top