OpenVPN DHCP bridge

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
barneby
OpenVpn Newbie
Posts: 4
Joined: Mon Jul 10, 2017 6:43 am

OpenVPN DHCP bridge

Post by barneby » Mon Jul 10, 2017 6:50 am

Hello,
I'm trying to set the OpenVPN server as a bridge with a DHCP bridge.
My configuration looks like this:
  • Code: Select all

    mode server
    tls-server
    port 443
    proto tcp
    proto tcp-server
    dev tap0
    script-security 2 system
    up up.sh
    down down.sh
    sndbuf 0
    rcvbuf 0
    ca ca.crt
    cert server.crt
    key server.key
    dh dh.pem
    auth SHA512
    tls-auth ta.key 0
    server-bridge
    client-to-client
    keepalive 10 120
    cipher AES-256-CBC
    comp-lzo
    user nobody
    group nogroup
    persist-key
    persist-tun
    status openvpn-status.log
    verb 3
    crl-verify crl.pem
    
Up.sh looks like this:
  • Code: Select all

    #!/bin/sh
    
    # the tap interface name is passed as first argument
    
    bridge=br0
    
    brctl addif "$bridge" "$1"
    
    dhclient -v tap0
    
    
And down.sh looks like this: The bridge in /etc/network/interfaces is set as follows:
  • Code: Select all

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth0
    
    auto br0
    iface br0 inet dhcp
        bridge_ports eth0
    
Unfortunately, every time I try to run OpenVPN, it does so in the log, and when I connect the client, it will not get an ip address.
  • Code: Select all

    čec 10 08:40:43 vpn kernel: br0: port 2(tap0) entered forwarding state
    čec 10 08:40:43 vpn kernel: br0: port 2(tap0) entered forwarding state
    čec 10 08:40:43 vpn dhclient[1363]: Listening on LPF/tap0/36:7a:63:47:06:9e
    čec 10 08:40:43 vpn dhclient[1363]: Sending on   LPF/tap0/36:7a:63:47:06:9e
    čec 10 08:40:43 vpn dhclient[1363]: Sending on   Socket/fallback
    čec 10 08:40:43 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 3
    čec 10 08:40:43 vpn openvpn[1357]: Listening on LPF/tap0/36:7a:63:47:06:9e
    čec 10 08:40:43 vpn openvpn[1357]: Sending on   LPF/tap0/36:7a:63:47:06:9e
    čec 10 08:40:43 vpn openvpn[1357]: Sending on   Socket/fallback
    čec 10 08:40:43 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 3
    čec 10 08:40:46 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 4
    čec 10 08:40:46 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 4
    čec 10 08:40:50 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 4
    čec 10 08:40:50 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 4
    čec 10 08:40:54 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 11
    čec 10 08:40:54 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 11
    čec 10 08:40:58 vpn kernel: br0: port 2(tap0) entered forwarding state
    čec 10 08:41:05 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 17
    čec 10 08:41:05 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 17
    čec 10 08:41:22 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7
    čec 10 08:41:22 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7
    čec 10 08:41:29 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7
    čec 10 08:41:29 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7
    čec 10 08:41:36 vpn dhclient[1363]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 8
    čec 10 08:41:36 vpn openvpn[1357]: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 8
    čec 10 08:41:44 vpn dhclient[1363]: No DHCPOFFERS received.
    čec 10 08:41:44 vpn dhclient[1363]: No working leases in persistent database - sleeping.
    čec 10 08:41:44 vpn openvpn[1357]: No DHCPOFFERS received.
    čec 10 08:41:44 vpn openvpn[1357]: No working leases in persistent database - sleeping.
    čec 10 08:41:44 vpn ovpn-server[1382]: GID set to nogroup
    čec 10 08:41:44 vpn ovpn-server[1382]: UID set to nobody
    čec 10 08:41:44 vpn ovpn-server[1382]: Listening for incoming TCP connection on [undef]
    čec 10 08:41:44 vpn ovpn-server[1382]: TCPv4_SERVER link local (bound): [undef]
    čec 10 08:41:44 vpn ovpn-server[1382]: TCPv4_SERVER link remote: [undef]
    čec 10 08:41:44 vpn ovpn-server[1382]: MULTI: multi_init called, r=256 v=256
    čec 10 08:41:44 vpn ovpn-server[1382]: MULTI: TCP INIT maxclients=1024 maxevents=1028
    čec 10 08:41:44 vpn ovpn-server[1382]: Initialization Sequence Completed
    čec 10 08:41:44 vpn systemd[1]: Started OpenVPN connection to server.
    
Do not you know where the error is? I use the debian jessie operating system.
Thank you.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN DHCP bridge

Post by TinCanTech » Mon Jul 10, 2017 11:58 am

barneby wrote:Up.sh looks like this:

Code: Select all

    #!/bin/sh

    # the tap interface name is passed as first argument
Really ?
barneby wrote:

Code: Select all

mode server
<s>
up up.sh
down down.sh
Please see:
HOWTO: Request Help ! {2}

barneby
OpenVpn Newbie
Posts: 4
Joined: Mon Jul 10, 2017 6:43 am

Re: OpenVPN DHCP bridge

Post by barneby » Mon Jul 10, 2017 2:55 pm

Ok edited the files as follows:
up.sh
  • Code: Select all

    #!/bin/sh
    
    bridge=br0
    interface=tap0
    
    brctl addif "$bridge" "$interface"
    
    dhclient -v "$interface"
    
    
down.sh
  • Code: Select all

    #!/bin/sh
    
    interface=tap0
    
    dhclient -r "$interface"
    
But it still tells me the same mistake. In /viewtopic.php?f=30&t=22603#p68963 I did not find the answer to my problem.
Thank you.

barneby
OpenVpn Newbie
Posts: 4
Joined: Mon Jul 10, 2017 6:43 am

Re: OpenVPN DHCP bridge

Post by barneby » Tue Jul 11, 2017 7:54 pm

Nobody wants to help me? :(

Post Reply