Hi,
I have the following setup:
- Server with 1 interface having 5 IPs assigned, running OpenVPN-Server
- Client with 1 interface behind a router, running OpenVPN-Client
The OpenVPN-Connection works fine. I now want to route all traffic arriving on one of the 5 IPs of the server through the OpenVPN Tunnel to my Client.
The server and the clients run both ipfw(8).
I hesitate to "play around" as I fear to make the server unreachable which would involve a one hour car drive to fix this. That's why I want to discuss this first.
I guess I have to
a) Run natd(8) on the server like
b)
c)
I fear that I break something because my current ipfw(8) setup uses keep-state which makes it a bit tricky with natd(8).
Right now I have
How would you set this up? Goal: access <ip4> of the server from somewhere and the access is made to the client (routed through the VPN)
I have the following setup:
- Server with 1 interface having 5 IPs assigned, running OpenVPN-Server
- Client with 1 interface behind a router, running OpenVPN-Client
The OpenVPN-Connection works fine. I now want to route all traffic arriving on one of the 5 IPs of the server through the OpenVPN Tunnel to my Client.
The server and the clients run both ipfw(8).
I hesitate to "play around" as I fear to make the server unreachable which would involve a one hour car drive to fix this. That's why I want to discuss this first.
I guess I have to
a) Run natd(8) on the server like
natd -a <one-of-the-5-IPs>
b)
ipfw add divert natd from any to <one-of-the-5-IPs> in via <iface>
c)
ipfw add divert natd from <one-of-the-5-IPs> to any out via <iface>
I fear that I break something because my current ipfw(8) setup uses keep-state which makes it a bit tricky with natd(8).
Right now I have
Code:
00100 count ip from any to any in via re0
00101 count ip from any to any out via re0
00102 count ip from any to <ip1> in via re0
00103 count ip from <ip1> to any out via re0
00104 count ip from any to <ip2> in via re0
00105 count ip from <ip2> to any out via re0
00106 count ip from any to <ip3> in via re0
00107 count ip from <ip3> to any out via re0
00108 count ip from any to <ip4> in via re0
00109 count ip from <ip4> to any out via re0
00110 count ip from any to <ip5> in via re0
00111 count ip from <ip5> to any out via re0
00200 deny log ip from me to any in via re0
00201 deny log tcp from any to any in via re0 tcpflags syn,fin
00202 deny ip from any to 0.0.0.0/8 via re0
00203 deny ip from any to 10.0.0.0/8 via re0
00204 deny ip from any to 127.0.0.0/8 via re0
00205 deny ip from 127.0.0.0/8 to any via re0
00206 deny ip from any to 169.254.0.0/16 via re0
00207 deny ip from any to 172.16.0.0/12 via re0
00208 deny ip from any to 192.0.2.0/24 via re0
00209 deny ip from any to 192.168.0.0/16 via re0
00210 deny ip from any to 224.0.0.0/4 via re0
00211 deny ip from any to 240.0.0.0/4 via re0
00212 allow ip from any to any via lo0
00300 allow ip from any to any via tun0
10000 deny ip from table(1) to me via re0
20300 check-state
20400 deny tcp from any to any in established
20500 allow tcp from me to any out via re0 setup keep-state
20501 allow udp from me to any out via re0 keep-state
20502 allow ip from me to any out via re0
20600 allow tcp from any to <ip2> dst-port 22 in via re0 setup keep-state
20602 allow tcp from any to <ip2> dst-port 25 in via re0 setup keep-state
20604 allow tcp from any to <ip1> dst-port 53 in via re0 setup keep-state
20606 allow tcp from any to <ip2> dst-port 80 in via re0 setup keep-state
20610 allow tcp from any to <ip1> dst-port 443 in via re0 setup keep-state
20612 allow tcp from any to <ip2> dst-port 11965 in via re0 setup keep-state
20700 allow udp from any to <ip1> dst-port 53 in via re0 keep-state
20702 allow udp from any to any dst-port 1194 in via re0 keep-state
20703 allow udp from any to <ip5> dst-port 9987 in via re0 keep-state
20800 allow icmp from any to me in via re0 icmptypes 0,3,8,11
20801 allow icmp from me to any out via re0 icmptypes 4,8,12
21000 deny ip from any to any dst-port 135 in via re0
21002 deny ip from any to any dst-port 137 in via re0
21004 deny ip from any to any dst-port 138 in via re0
21006 deny ip from any to any dst-port 139 in via re0
21008 deny ip from any to any dst-port 445 in via re0
21010 deny udp from any to any dst-port 520 in via re0
21012 deny udp from any to any dst-port 694 in via re0
22000 allow ip from any to <ip1> in via re0 frag
60000 deny log ip from any to any
65535 deny ip from any to any
How would you set this up? Goal: access <ip4> of the server from somewhere and the access is made to the client (routed through the VPN)