Solved PPPoE on my FreeBSD Router

Hi guys, lately I entered the BSD world, so I thought I'd retrieve a small mini-itx board and make a router/fw/dns etc. etc.
to learn a little bit about networks, BSD and to detach myself, as far as possible, from proprietary solutions.

I successfully managed to pull up the routing part, firewall with pf and dns/dhcp with dnsmasq.
I still have a lot to configure, but it works.

I wanted to take the next step, put the modem in bridge-mode ( Draytek Vigor 130 ) and configure PPPoE on the router.

Unfortunately, however, for lack of experience, and lack of knowledge, I found myself immediately bogged down.
Both on a practical and theoretical level.

Now I set up the Draytek ( Internet Access -> MPoA / Dynamic or Static IP -> Bridge-mode , I didn't configure anything else ).
At this point I connect the modem to the WAN port ( configured as such ) of the router, and configure ppp.conf.

Now I have this situation in the various conf files, could you show me the right way? Show me where I'm wrong (both at a practical and theoretical level?).

rc.conf

Code:
### NET ###
cloned_interfaces="vlan1036"
ifconfig_vlan1036="inet 192.168.0.1 netmask 255.255.255.0 vlan 1036 vlandev re0"
ifconfig_re0=up
#defaultrouter="192.168.0.1"      # ISP Gateway IP
ifconfig_re0="inet 192.168.0.2 netmask 255.255.255.0" # IP statico WAN
ifconfig_re1="inet 192.168.1.1 netmask 255.255.255.0" # IP statico LAN

### DNSMASQ ###
dnsmasq_enable="YES"
dnsmasq_conf="/etc/dnsmasq.conf"

# # # FIREWALL & NAT # # #
gateway_enable="YES"
pf_enable="YES"
pf_rules="/etc/firewall"
pf_flags=""


# # # PPP # # #

ppp_enable="YES"
ppp_nat="YES"
ppp_profile="vodafone"

ppp.conf

Code:
default:
 set log Phase Chat tun Command Connect Filter Error Alert
 nat enable no

vodafone:
 rename vodafone
 set device PPPoE:re0
 set ifaddr 0 0 255.255.255.255
 set server /var/run/ppp/vodafone "" 0177
 set authname vodafonedsl
 set authkey vodafonedsl
 set mru 1492
 set mtu 1492
 set timeout 0
 set echoperiod 15
 set lqrperiod 15
 disable ipv6cp
 enable mssfixup dns echo lqr
 set dial
 set login
 set redial 0 0
 add! default HISADDR
 
What are your logs telling you when you try to connect with PPPoE?
 
What are your logs telling you when you try to connect with PPPoE?

Okay this is my routing tables and i'll attach here the ppp.log

netstat -nr:

Code:
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
127.0.0.1          link#3             UH          lo0
192.168.0.0/24     link#1             U           re0
192.168.0.1        link#4             UHS         lo0
192.168.0.2        link#1             UHS         lo0
192.168.1.0/24     link#2             U           re1
192.168.1.1        link#2             UHS         lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               link#3                        UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%tun0/32                    fe80::290:fbff:fe5f:4974%tun0 UGS        tun0

Nevermind i cannot attach the log file.
btw those are the relevants parts:

Code:
Jun 21 23:46:57 fafnir ppp[559]: tun0: Phase: vodafone: Connected!
Jun 21 23:46:57 fafnir ppp[559]: tun0: Phase: vodafone: opening -> dial
Jun 21 23:46:57 fafnir ppp[559]: tun0: Phase: vodafone: dial -> carrier
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: Disconnected!
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: carrier -> hangup
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: Connect time: 5 secs: 0 octets in, 0 octets out
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: 0 packets in, 0 packets out
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase:  total 0 bytes/sec, peak 0 bytes/sec on Sun Jun 21 23:46:57 2020
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: hangup -> opening
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: Enter pause (0) for redialing.
Jun 21 23:47:02 fafnir ppp[559]: tun0: Chat: vodafone: Redial timer expired.
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: Connected!
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: opening -> dial
Jun 21 23:47:02 fafnir ppp[559]: tun0: Phase: vodafone: dial -> carrier
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: vodafone: Disconnected!
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: vodafone: carrier -> hangup
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: vodafone: Connect time: 5 secs: 0 octets in, 0 octets out
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: vodafone: 0 packets in, 0 packets out
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase:  total 0 bytes/sec, peak 0 bytes/sec on Mon Jun 22 11:56:23 2020
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: vodafone: hangup -> closed
Jun 22 11:56:28 fafnir ppp[599]: tun0: Phase: bundle: Dead
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: vodafone: Disconnected!
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: vodafone: carrier -> hangup
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: vodafone: Connect time: 6 secs: 0 octets in, 0 octets out
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: vodafone: 0 packets in, 0 packets out
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase:  total 0 bytes/sec, peak 0 bytes/sec on Mon Jun 22 18:45:41 2020
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: vodafone: hangup -> closed
Jun 22 18:45:47 fafnir ppp[623]: tun0: Phase: bundle: Dead
 
I would also say that actually my Draytek Vigor 130 is in Bridge-Mode,without any VLAN-ID tags enabled.
So theoritically i have to setup all in the freebsd machine.

P.S: are there some parts of my configuration that are wrong?
because I'd like to get the following things with this machine:

router
firewall (pf)
dhcp and dns server ( dnsmasq )
pppoe.

I was able to get routing, fw, dhcp and dns but not the ppp part
 
I restrained myself from commenting but now I am doing. I am not an expert so you can take my comment with a pinch of salt. I couldn't get pop working unlike many others in this forum. The only PPPoE port available is not regularly maintained. I however had luck with PfSense since that's the team's focus among other things.
 
I would also say that actually my Draytek Vigor 130 is in Bridge-Mode,without any VLAN-ID tags enabled.
So theoritically i have to setup all in the freebsd machine.
If your ISP requires VLAN tagging, you need to set up a vlan(4) interface that does the tagging and operate ppp(8) on the vlan interface instead of the real hardware interface, otherwise you will never see a response to the PADI packets sent by your PPPoE client. Setting up the vlan interface at boot-time is done via rc.conf(5). Assuming you need a VLAN tag of 7 (which is commonly used by many DSL ISPs):
Code:
cloned_interfaces="vlan7"
create_args_vlan7="vlan 7 vlandev re0"
Then in your /etc/ppp/ppp.conf change the PPPoE device to use vlan7 instead of re0:
Code:
set device PPPoE:vlan7
P.S: are there some parts of my configuration that are wrong?
Personally I'd prefer to have pf(4) do the NAT rather than have ppp(8) handle it, but YMMV.
 
It's been a while since I switched from DSL to cable, but if I remember correctly my DSL ISP didn't require authentication for PPPoE. I also checked a few Vodafone DSL configurations I found while googling and they seem to use PPPoA instead of PPPoE. Double check with your own provider which one you actually need.
 
Oh, whoops, the handbook even has a PPPoE specific section


Didn't see "ddial" in there, maybe that's the key.
 
If your ISP requires VLAN tagging, you need to set up a vlan(4) interface that does the tagging and operate ppp(8) on the vlan interface instead of the real hardware interface, otherwise you will never see a response to the PADI packets sent by your PPPoE client. Setting up the vlan interface at boot-time is done via rc.conf(5). Assuming you need a VLAN tag of 7 (which is commonly used by many DSL ISPs):
Code:
cloned_interfaces="vlan7"
create_args_vlan7="vlan 7 vlandev re0"
Then in your /etc/ppp/ppp.conf change the PPPoE device to use vlan7 instead of re0:
Code:
set device PPPoE:vlan7

Personally I'd prefer to have pf(4) do the NAT rather than have ppp(8) handle it, but YMMV.

Oh that's actually worked, thank you some much man :)
 
Back
Top