b***@cec.wustl.edu
2008-06-17 03:29:55 UTC
The machine running the openvpn server is also the router for a small
192.168.1.0/24 LAN. Machines on the LAN connect to the Internet using the
router, 192.168.1.1, as a gateway. The openvpn server is set up in
"bridged mode". I want openvpn clients to connect to the Internet through
through the router, so I've included the following directive in my
server.conf:
push "redirect-gateway def1"
On a linux client, this effectively makes the default gateway the tap0
interface belonging to the openvpn client. The corresponding routing table
entry looks something like this:
default * 0.0.0.0 U 0 0 0 tap0
Note the asterisk -- the default gateway is not associated with an IP
address. This works fine if the client wants to talk to other machines on
the 192.168.1.0/24 LAN. It doesn't work when the client wants to connect
to the Internet at large; for that, the default gateway would have to
include the IP address of the router. If I add such a gateway manually:
route add default gw 192.168.1.1
Everything works great. The corresponding routing table entry looks like:
default 192.168.1.1 0.0.0.0 UG 0 0 0 tap0
Note the IP address in place of the asterisk.
So my question is, how do I get redirect-gateway to do this for me? Why
doesn't redirect-gateway produce a default gateway with an IP address?
I've tried adding:
push "route-gateway 192.168.1.1"
To server.conf, but it hasn't helped. Any ideas?
192.168.1.0/24 LAN. Machines on the LAN connect to the Internet using the
router, 192.168.1.1, as a gateway. The openvpn server is set up in
"bridged mode". I want openvpn clients to connect to the Internet through
through the router, so I've included the following directive in my
server.conf:
push "redirect-gateway def1"
On a linux client, this effectively makes the default gateway the tap0
interface belonging to the openvpn client. The corresponding routing table
entry looks something like this:
default * 0.0.0.0 U 0 0 0 tap0
Note the asterisk -- the default gateway is not associated with an IP
address. This works fine if the client wants to talk to other machines on
the 192.168.1.0/24 LAN. It doesn't work when the client wants to connect
to the Internet at large; for that, the default gateway would have to
include the IP address of the router. If I add such a gateway manually:
route add default gw 192.168.1.1
Everything works great. The corresponding routing table entry looks like:
default 192.168.1.1 0.0.0.0 UG 0 0 0 tap0
Note the IP address in place of the asterisk.
So my question is, how do I get redirect-gateway to do this for me? Why
doesn't redirect-gateway produce a default gateway with an IP address?
I've tried adding:
push "route-gateway 192.168.1.1"
To server.conf, but it hasn't helped. Any ideas?