# Using MPD5 for PPPoE/vlan



## HiddenWolf (Apr 10, 2015)

I switched internet providers to xs4all.nl fibre this week.

I am running a FreeBSD 10.1 server as a router and firewall, running pf, dhcpd and various jailed services. Previously, I got an IP over DHCP from my cable modem. xs4all uses PPPoE and various vlans to deliver internet, voice and tv.

I'm primarily concerned with the IP part, which means that I had to reconfigure my machine to connect over PPPoE and set up vlan6. I got it to work using ppp, but performance is really poor, 40/20mbits where I should get close to 100/100.

I got the advice to try using MPD, but I am out of my depth and a lot of the information I can find is in Russian, which I don't speak.

I used http://gjppp.home.xs4all.nl/vdsl-pppoe/ as a tutorial for the mpd.conf, link up and link down scripts, even though the user is using vdsl as opposed to fiber.

I've embedded mpd.conf, the link up script, and the relevant bits of rc.conf, and the output of mpd5. My apologies for the wall of text that follows. I did replace my IP's with 0.0.0.0*
Running mpd5 manually results in a 'parameter negotiation failed' error. I am hoping that someone spots the error or can tell me how to debug this.


```
## mpd.conf

startup:

default:

    load xs4all


xs4all:

    create bundle static B1

    set iface up-script /etc/mpd5/mpd-linkup.sh

    set iface down-script /etc/mpd5/mpd-linkdown.sh

    set ipcp ranges 0.0.0.0/0 0.0.0.0/0

    set bundle enable ipv6cp


    create link static L1 pppoe

    set link action bundle B1

    set link max-redial 0

    set link mtu 1492

    set link keep-alive 10 60


    set auth authname ****@xs4all.nl

    set auth password ****


    set pppoe iface vlan6

    set pppoe service ""

    open
```
Linkup:

```
#! /bin/sh

# Usage: mpd-linkup.sh interface



[ -z "$1" ] && exit 1



route delete        default

route delete -inet6 default



route add           default -interface $1 -mtu 1492

route add    -inet6 default -interface $1 -mtu 1492

ifconfig $1 mtu 1492



/etc/rc.d/pf restart



Start dhcp6c

killall -9 dhcp6c && sleep 10

cat << EOF | sed "s/INTERFACE/$1/g" > /var/tmp/dhcp6c.$1.conf

interface INTERFACE {

        send ia-pd 0;

};



id-assoc pd {

};

EOF



# Wait for ng0 to be set up before running DHCPv6

sleep 3

/usr/local/sbin/dhcp6c -c /var/tmp/dhcp6c.$1.conf -p /var/run/dhcp6c.$1.pid $1
```

Relevant bits of rc.conf

```
## Basic networking

hostname="hostname"                                        # Set hostname

ifconfig_igb0_name="wan0"                                            # Rename interface

ifconfig_em0_name="lan0"                                            # Rename interface



cloned_interfaces="vlan6"

ifconfig_lan0="inet 10.0.0.1/24"

ifconfig_lan0_ipv6="IP HERE"

ifconfig_wan0="up"

ifconfig_igb0_ipv6="inet6 ifdisabled -nud -auto_linklocal -accept_rtadv"

ifconfig_vlan6="vlandev wan0 vlan 6 up"



# Enable routing

gateway_enable="YES"

ipv6_gateway_enable="YES"



## Use MPD5 for PPPoE

mpd_enable="YES"
```
mpd5

```
Multi-link PPP daemon for FreeBSD



process 1789 started, version 5.7 (root@101amd64-default-job-07 22:41  8-Apr-2015)

[B1] Bundle: Interface ng1 created

[L1] [L1] Link: OPEN event

[L1] LCP: Open event

[L1] LCP: state change Initial --> Starting

[L1] LCP: LayerStart

[L1] PPPoE: Connecting to ''

PPPoE: rec'd ACNAME "dr11.d12"

[L1] PPPoE: connection successful

[L1] Link: UP event

[L1] LCP: Up event

[L1] LCP: state change Starting --> Req-Sent

[L1] LCP: SendConfigReq #1

[L1]   PROTOCOMP

[L1]   MRU 1492

[L1]   MAGICNUM 0ce8fa17

[L1] LCP: SendConfigReq #2

[L1]   PROTOCOMP

[L1]   MRU 1492

[L1]   MAGICNUM 0ce8fa17

[L1] LCP: rec'd Configure Request #94 (Req-Sent)

[L1]   AUTHPROTO PAP

[L1]   MAGICNUM 16d1ade9

[L1] LCP: SendConfigAck #94

[L1]   AUTHPROTO PAP

[L1]   MAGICNUM 16d1ade9

[L1] LCP: state change Req-Sent --> Ack-Sent

[L1] LCP: rec'd Configure Ack #2 (Ack-Sent)

[L1]   PROTOCOMP

[L1]   MRU 1492

[L1]   MAGICNUM 0ce8fa17

[L1] LCP: state change Ack-Sent --> Opened

[L1] LCP: auth: peer wants PAP, I want nothing

[L1] PAP: using authname "****@xs4all.nl"

[L1] PAP: sending REQUEST #1 len: 29

[L1] LCP: LayerUp

[L1] PAP: rec'd ACK #1 len: 5

[L1] LCP: authorization successful

[L1] Link: Matched action 'bundle "B1" ""'

[L1] Link: Join bundle "B1"

[B1] Bundle: Status update: up 1 link, total bandwidth 64000 bps

[B1] IPCP: Open event

[B1] IPCP: state change Initial --> Starting

[B1] IPCP: LayerStart

[B1] IPV6CP: Open event

[B1] IPV6CP: state change Initial --> Starting

[B1] IPV6CP: LayerStart

[B1] IPCP: Up event

[B1] IPCP: state change Starting --> Req-Sent

[B1] IPCP: SendConfigReq #1

[B1]   IPADDR 0.0.0.0

[B1]   COMPPROTO VJCOMP, 16 comp. channels, no comp-cid

[B1] IPV6CP: Up event

[B1] IPV6CP: state change Starting --> Req-Sent

[B1] IPV6CP: SendConfigReq #1

[B1] IPCP: rec'd Configure Reject #1 (Req-Sent)

[B1]   COMPPROTO VJCOMP, 16 comp. channels, no comp-cid

[B1] IPCP: SendConfigReq #2

[B1]   IPADDR 0.0.0.0

[B1] IPV6CP: rec'd Configure Ack #1 (Req-Sent)

[B1] IPV6CP: state change Req-Sent --> Ack-Rcvd

[B1] IPCP: rec'd Configure Nak #2 (Req-Sent)

[B1]   IPADDR 0.0.0.0*

[B1]     0.0.0.0* is OK

[B1] IPCP: SendConfigReq #3

[B1]   IPADDR 0.0.0.0*

[B1] IPCP: rec'd Configure Ack #3 (Req-Sent)

[B1]   IPADDR 0.0.0.0*

[B1] IPCP: state change Req-Sent --> Ack-Rcvd

[B1] IPCP: rec'd Configure Request #231 (Ack-Rcvd)

[B1]   IPADDR 0.0.0.0*

[B1]     0.0.0.0* is OK

[B1] IPCP: SendConfigAck #231

[B1]   IPADDR 0.0.0.0*

[B1] IPCP: state change Ack-Rcvd --> Opened

[B1] IPCP: LayerUp

[B1]   0.0.0.0* -> 194.109.5.175

[B1] system: command "/etc/mpd5/mpd-linkup.sh ng1 inet 0.0.0.0*/32 0.0.0.0* '-' '' '' '00:00:00:00:00:00'" returned 32512

[B1] IPCP: parameter negotiation failed

[B1] IPCP: state change Opened --> Stopping

[B1] IPCP: SendTerminateReq #4

[B1] IPCP: LayerDown

[B1] system: command "/etc/mpd5/mpd-linkdown.sh ng1 inet 0.0.0.0*/32 0.0.0.0* '-' '00:00:00:00:00:00'" returned 32512

[B1] IPV6CP: rec'd Configure Request #238 (Ack-Rcvd)

[B1] IPV6CP: SendConfigAck #238

[B1] IPV6CP: state change Ack-Rcvd --> Opened

[B1] IPV6CP: LayerUp

[B1]   0225:90ff:fe86:be9a -> 02a0:a50f:fc78:5530

[B1] system: command "/etc/mpd5/mpd-linkup.sh ng1 inet6 fe80:::::be9a%ng1 fe80:::::ng1 '-' '00:00:00:00:00:00'" returned 32512

[B1] IPV6CP: parameter negotiation failed

[B1] IPV6CP: state change Opened --> Stopping

[B1] IPV6CP: SendTerminateReq #2

[B1] IPV6CP: LayerDown

[B1] system: command "/etc/mpd5/mpd-linkdown.sh ng1 inet6 fe80:::::be9a%ng1 fe80:::::%ng1 '-' '00:00:00:00:00:00'" returned 32512

[B1] IPCP: rec'd Terminate Ack #4 (Stopping)

[B1] IPCP: state change Stopping --> Stopped

[B1] IPCP: LayerFinish

[B1] IPV6CP: rec'd Terminate Ack #2 (Stopping)

[B1] IPV6CP: state change Stopping --> Stopped

[B1] IPV6CP: LayerFinish

[B1] Bundle: No NCPs left. Closing links...

[B1] Bundle: closing link "L1"...

[L1] Link: CLOSE event

[L1] LCP: Close event

[L1] LCP: state change Opened --> Closing

[L1] Link: Leave bundle "B1"

[B1] Bundle: Status update: up 0 links, total bandwidth 9600 bps

[B1] IPCP: Close event

[B1] IPCP: state change Stopped --> Closed

[B1] IPV6CP: Close event

[B1] IPV6CP: state change Stopped --> Closed

[B1] IPCP: Down event

[B1] IPCP: state change Closed --> Initial

[B1] IPV6CP: Down event

[B1] IPV6CP: state change Closed --> Initial

[L1] LCP: SendTerminateReq #3

[L1] LCP: LayerDown

[L1] LCP: rec'd Terminate Ack #3 (Closing)

[L1] LCP: state change Closing --> Closed

[L1] LCP: LayerFinish

[L1] Link: DOWN event

[L1] LCP: Down event

[L1] LCP: state change Closed --> Initial
```


----------



## rickvanderzwet (Nov 30, 2016)

You can do this without the use of `mpd` The following case employs XS4ALL FTTH (Fiber To The Home) with as (optional) extra a VAS IP range. 

/etc/ppp/ppp.conf

```
default:
  set log Phase tun command # you can add more detailed logging if you wish
  set ifaddr 10.0.0.1/0 10.0.0.2/0

xs4all_ftth:
  set device PPPoE:re0vlan6    # replace re0 with your Ethernet device
  set authname xs4all@xs4all.nl
  set authkey 1234
  set dial
  set login
  add default HISADDR
```

/etc/rc.conf

```
hostname="routerZW"
gateway_enable="YES"

# We cannot use the default vlan interface syntax re0.6 since ppp does not
# support interfaces with a dot in the name.
ifconfig_re0="up"
vlans_re0="re0vlan6"
create_args_re0vlan6="vlan 6 up"

# Start PPPoE connection
ppp_enable="YES"
ppp_mode="ddial"
ppp_profile="xs4all_ftth"

# Firewall configuration is left as excersise to the reader
#
# Internal network
ifconfig_re1="inet 192.168.178.1/24 up"


# NAT on internal network
natd_interface="tun0"
natd_enable="YES"
natd_flags="-dynamic"

#
# Optional VAS VLAN configuration, to expose the VAS IP addresses 
# to internal network port this is seperated by VLAN tagging as I do not 
# like to  mix-up to internal clients by accident.
#
# Make sure to change this to your own VAS range.
# Leave this block out when not used.
#
vlans_re1="re1vlan6"
create_args_re1vlan6="vlan 6 up"
ifconfig_re1vlan6="inet 80.127.152.25/29 up"
```


----------

