Skip to contentSkip to conversation

after script

Openvpn-devel Hans Fugal 2 participants 2 messages Oct 23, 2004

lore
Share & tools
lore

Hans Fugal

author
#0 lore raw

I spent a couple of hours last night trying to figure out a way to do everything I wanted to on my wireless LAN, and was having difficulty doing so. Before I go into details of what I was trying to do, doing it would be immensely easy if there was an --after, similar to --up but run after everything is set up. I thought that was what up was, at first, but apparently not.

It all boils down to wanting to use DHCP. There are a couple of reasons for this, not the least of which it's a testbed for a larger setup at work. What's more, I would like to use the option "redirect-gateway" on my wlan because A) I set up my firewall to not forward traffic that doesn't come over the vpn, so that eventually I can turn off WEP if I feel like it and nobody can mooch my internet connection, and B) so nobody can sniff any of my activity. If I have the up script background the dhcp client, I get a dhcp address. But the routing fails. I could use route-delay, but it doesn't seem very robust as sometimes dhcp just might take too long. I did figure out a way to write an up script to do this (see below) but it doesn't feel right. (but at least it works)

#!/bin/sh

# up script for falcon-wlan
(
  ifup $1 # starts DHCP
  ip route change default via 172.17.0.3 # 172.17.0.0/24 is the vpn
subnet (bridging)
) & # if I don't background, dhcp requests don't go over the vpn
# end script

For one thing, the ip route stuff isn't nearly as robust as the "redirect-gateway" option, although I could duplicate its intelligence if needed. (In practice this will probably do)

I mostly am looking for a more elegant solution because others occasionally use this wlan, like my brother, and I don't want configuration to be too complicated. Am I missing something from my manpage reading, or can you suggest a more elegant way to do this? Or might an after option be possible?

Signature · 1 line
De gustibus non disputandum est.
#1 lore raw
Quoted 6 lines · Hans Fugal

I spent a couple of hours last night trying to figure out a way to do everything I wanted to on my wireless LAN, and was having difficulty doing so. Before I go into details of what I was trying to do, doing it would be immensely easy if there was an --after, similar to --up but run after everything is set up. I thought that was what up was, at first, but apparently not.

It's probably --route-up you want to use, if you want it executed AFTER the connection is established.

Quoted 4 lines

It all boils down to wanting to use DHCP. There are a couple of reasons for this, not the least of which it's a testbed for a larger setup at work. What's more, I would like to use the option "redirect-gateway" on my wlan because A) I set up my firewall to not

Quoted 8 lines

forward traffic that doesn't come over the vpn, so that eventually I can turn off WEP if I feel like it and nobody can mooch my internet connection, and B) so nobody can sniff any of my activity. If I have the up script background the dhcp client, I get a dhcp address. But the routing fails. I could use route-delay, but it doesn't seem very robust as sometimes dhcp just might take too long. I did figure out a way to write an up script to do this (see below) but it doesn't feel right. (but at least it works)

I didn't understand exactly what you want todo...

When you say DHCP, do you mean that you want a DHCP server on the server side to hand out IP addresses to the clients?

Is using --ifconfig-pool to hand out IP addresses to the client out of the question?

It would surly be easiest to use --ifconfig-pool, as then openvpn is responsible both for setting the pushed IP address, as well as routes that can also be pushed to the client.

Are the clients using a specific O/S or do you want to support all O/S supported by OpenVPN?

--
_____________________________________________________________

Mathias Sundman                  (^)   ASCII Ribbon Campaign
OpenVPN GUI for Windows           X    NO HTML/RTF in e-mail
http://www.nilings.se/openvpn    / \   NO Word docs in e-mail