kaliii / badvpn

Automatically exported from code.google.com/p/badvpn
Other
0 stars 0 forks source link

calling net.ipv4.dhcp on tun device fails #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call net.ipv4.dhcp on a tun device created with openvpn

What version of the product are you using? On what operating system?
badvpn-ncd version 1.999.128

Please provide any additional information below.

I want to find the default gateway of a tun device created with openvpn, so 
that I can update routing tables appropriately.
I try using net.ipv4.dhcp("tun0") and I get the following error: 
BDHCPClient_Init failed

Original issue reported on code.google.com by vapn...@gmail.com on 14 Feb 2014 at 3:37

GoogleCodeExporter commented 9 years ago
I'm pretty sure you can't do DHCP on a TUN device (as opposed to TAP). Have you 
tried whether dhcpcd works?

Original comment by ambr...@gmail.com on 14 Feb 2014 at 4:05

GoogleCodeExporter commented 9 years ago
I tried dhclient which didn't give any errors which is why I assumed it was OK 
(and the fact that dhcp works at the application layer). However, on trying 
dhcpcd I do get an error: "err, tun0: interface is not Ethernet, FireWire, 
InfiniBand or Token Ring"

Original comment by vapn...@gmail.com on 14 Feb 2014 at 4:59

GoogleCodeExporter commented 9 years ago
Am currently writing a template to get the information from "ip route" output 
using regular expressions. If you can think of an easier way please tell me.

Original comment by vapn...@gmail.com on 14 Feb 2014 at 5:00

GoogleCodeExporter commented 9 years ago
Well, the answer at this time is simply that it's not supported. Use TAP, if 
you can, or assign addresses some other way than DHCP.

Original comment by ambr...@gmail.com on 14 Feb 2014 at 5:01

GoogleCodeExporter commented 9 years ago
Have you tried letting openvpn assign the address? I know that integrating such 
tools like VPN clients is painful, but it can be done. For inspiration you can 
check my PPOoE code, 
https://code.google.com/p/badvpn/source/browse/trunk/ncd/examples/router/pppoe.n
cdi

Original comment by ambr...@gmail.com on 14 Feb 2014 at 5:14

GoogleCodeExporter commented 9 years ago
Yes openvpn automatically assigns the ip address & gateway to a tun device in 
the main routing table, but I need to know what they are so that I can update 
other routing tables. Anyway, I've done it now: I wrote a template to get the 
information from iproute2. I will send you a copy.

Original comment by vapn...@gmail.com on 15 Feb 2014 at 1:35

GoogleCodeExporter commented 9 years ago
Not expecting this to be implemented anytime soon since it's a very rare 
configuration not even supported by dhcpcd.

Original comment by ambr...@gmail.com on 17 Feb 2014 at 10:07