Hello All,
I have set up two routing tables on my FreeBSD 10 stable router.
cat /etc/pf.conf output
My openvpn server.conf
All the help is appreciated.
Thanks guys
I have set up two routing tables on my FreeBSD 10 stable router.
- On fib0, I have OpenVPN server for access to my local network (10.10.10.0/24).
- On fib1, I have transmission daemon listening on 10.10.10.10:9091.
netstat -r4 outputs below
Code:
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 10.20.21.93 UGS tun0
10.10.10.0 link#6 U lagg0
bnx link#6 UHS lo0
10.10.11.0 10.10.11.2 UGS tun1
10.10.11.1 link#9 UHS lo0
10.10.11.2 link#9 UH tun1
10.10.12.0 link#7 U vlan0
10.20.21.93 link#8 UHS tun0
10.138.1.5 link#10 UH tun2
10.138.1.6 link#10 UHS lo0
xx.xx.xx.xx link#8 UHS lo0
localhost link#5 UH lo0
Code:
Routing tables (fib: 1)
Internet:
Destination Gateway Flags Netif Expire
default 10.138.1.5 UGS tun2
10.10.10.0 link#6 U lagg0
10.10.11.2 link#9 UH tun1
10.10.12.0 link#7 U vlan0
10.10.12.10 link#7 UHS lo0
10.20.21.93 link#8 UH tun0
10.138.1.5 link#10 UH tun2
localhost link#5 UH lo0
cat /etc/pf.conf output
Code:
## Macros
# Interfaces
ext = "tun0"
int = "lagg0"
vpn = "tun1"
v2p = "tun2"
localnet = $int:network
vpnnet = "10.10.11.0/24"
broken="224.0.0.22 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 169.254.0.0/16, 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 169.254.0.0/16, 240.0.0.0/4, 255.255.255.255/32"
## Tables
# Open ports
tcps = "{22}"
udps = "{1194}"
p2p = "{4662,4665,4672,51413,60595}"
table <fail2ban> persist
## Options
set block-policy drop
set state-policy if-bound
set loginterface $ext
set skip on lo
## Traffic Normalization
scrub in all no-df max-mss 1440
## Translation
# NAT
nat on $ext from $localnet to any -> ($ext)
nat on $ext from $vpnnet to any -> ($ext)
# Filters
antispoof quick for $ext
block out quick inet6 all
block in quick inet6 all
block in quick from {$broken no-route} to any
block in quick on $ext from <fail2ban> to any
block in log all
pass inet proto icmp icmp-type echoreq keep state
pass in on $ext inet proto tcp from any to any port $tcps
pass in on $ext inet proto udp from any to any port $udps
pass in on $v2p inet proto {tcp, udp} from any to any port $p2p rtable 1
pass in on $int all
pass in on $vpn all
pass out all
My openvpn server.conf
Code:
port 1194
proto udp
dev tun1
ca ./keys/ca.crt
cert ./keys/server.crt
key ./keys/server.key
dh ./keys/dh2048.pem
server 10.10.11.0 255.255.255.0
route 10.10.10.0 255.255.255.0
push "route 10.10.10.0 255.255.255.0"
route 10.10.12.0 255.255.255.0
push "route 10.10.12.0 255.255.255.0"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 10.10.10.10"
push "dhcp-option DOMAIN blabla.hehe"
client-to-client
keepalive 10 120
tls-auth ./keys/ta.key 0
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append /var/log/openvpn.log
plugin /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so login
verb 3
All the help is appreciated.
Thanks guys