Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure pppoe with macvlan interface? #181

Closed
onlymash opened this issue Nov 14, 2020 · 7 comments
Closed

How to configure pppoe with macvlan interface? #181

onlymash opened this issue Nov 14, 2020 · 7 comments
Labels

Comments

@onlymash
Copy link

There are only macvlan-dhcp and macvlan-static in the examples, but macvlan-pppoe does not exist. I want to implement pppoe and dhcp for a single WAN interface.
I know this is possible in openwrt, now my router runs archlinux.
arch wiki Router

@joukewitteveen
Copy link
Owner

If it is possible in OpenWRT, then I would like to think it is within the scope of netctl :-).
Let's see whether it is already possible. If not, we need to find out how to do it manually and then implement it in netctl.

I am not entirely sure what you want. Would something like the following achieve what you are after?

/etc/netctl/MyPPP

Description='My PPPoE connection'
BindsToInterfaces=eth0
Interface=ppp1
Connection=ppp
User='example@yourprovider.com'
Password='very secret'

# etc.

/etc/netctl/MyMacVLAN

Description='Virtual LAN on the MyPPP connection'
BindsToInterfaces=ppp1
After=(MyPPP)
Interface=mac0
Connection=macvlan

# etc.

@onlymash
Copy link
Author

My configuration process is as follows.
Although the wan0.2 interface was created, if not specify the IP, the running state is failed

$ cat wan0.1
Description='Virtual LAN with random MAC address on interface wan0'
Interface=wan0.1
Connection=macvlan
BindsToInterfaces=wan0
Mode="bridge"
IP=static
Address="192.168.200.2/24"
Gateway="192.168.200.1"
DNS=("192.168.200.1")

$ cat wan0.2
Description='Virtual LAN with random MAC address on interface wan0'
Interface=wan0.2
After=(wan0.1)
Connection=macvlan
BindsToInterfaces=wan0
Mode="bridge"

$ cat pppoe 
Description='wan0.2 PPPoE connection'
Interface=wan0.2
After=(wan0.2)
Connection=pppoe
User='username'
Password='password'
...

$ sudo netctl start wan0.1
$ sudo netctl start wan0.2
$ sudo netctl start pppoe

$ netctl status wan0.2
● netctl@wan0.2.service - Networking for netctl profile wan0.2
     Loaded: loaded (/usr/lib/systemd/system/netctl@.service; static)
     Active: failed (Result: exit-code) since Wed 2020-11-18 12:33:26 HKT; 2min 43s ago
       Docs: man:netctl.profile(5)
    Process: 979 ExecStart=/usr/lib/netctl/network start wan0.2 (code=exited, status=1/FAILURE)
   Main PID: 979 (code=exited, status=1/FAILURE)

Nov 18 12:33:26 arch-router systemd[1]: Starting Networking for netctl profile wan0.2...
Nov 18 12:33:26 arch-router network[979]: Starting network profile 'wan0.2'...
Nov 18 12:33:26 arch-router systemd[1]: Started Networking for netctl profile wan0.2.
Nov 18 12:33:26 arch-router network[979]: Neither IP, nor IP6 was specified
Nov 18 12:33:26 arch-router network[979]: Failed to bring the network up for profile 'wan0.2'
Nov 18 12:33:26 arch-router systemd[1]: netctl@wan0.2.service: Main process exited, code=exited, status=1/FAILURE
Nov 18 12:3``3:26 arch-router systemd[1]: netctl@wan0.2.service: Failed with result 'exit-code'.

$ ip r
default via 192.168.200.1 dev wan0.1 
10.152.64.1 dev ppp0 proto kernel scope link src 10.152.75.190 
192.168.0.0/24 dev br-lan proto kernel scope link src 192.168.0.1 
192.168.200.0/24 dev wan0.1 proto kernel scope link src 192.168.200.2

$ sudo ip route replace default via 0.0.0.0 dev ppp0
$ ip r
default dev ppp0 
10.152.64.1 dev ppp0 proto kernel scope link src 10.152.75.190 
192.168.0.0/24 dev br-lan proto kernel scope link src 192.168.0.1 
192.168.200.0/24 dev wan0.1 proto kernel scope link src 192.168.200.2


$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:44 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c683:4fff:fe10:7144/64 scope link 
       valid_lft forever preferred_lft forever
3: lan0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq master br-lan state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:45 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c683:4fff:fe10:7145/64 scope link 
       valid_lft forever preferred_lft forever
4: lan1: <NO-CARRIER,BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc fq master br-lan state DOWN group default qlen 1000
    link/ether xx:xx:xx:xx:xx:46 brd ff:ff:ff:ff:ff:ff
5: lan2: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq master br-lan state UP group default qlen 1000
    link/ether ``xx:xx:xx:xx:xx:47 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c683:4fff:fe10:7147/64 scope link 
       valid_lft forever preferred_lft forever
6: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ea:4c:4c:99:27:aa brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global br-lan
       valid_lft forever preferred_lft forever
    inet6 fd00::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::e84c:4cff:fe99:27aa/64 scope link 
       valid_lft forever preferred_lft forever
7: wan0.1@wan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ca:39:d3:a4:92:c7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.2/24 brd 192.168.200.255 scope global wan0.1
       valid_lft forever preferred_lft forever
    inet6 fe80::c839:d3ff:fea4:92c7/64 scope link 
       valid_lft forever preferred_lft forever
8: wan0.2@wan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ``c2:46:f3:c1:9e:b5 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c046:f3ff:fec1:9eb5/64 scope link 
       valid_lft forever preferred_lft forever
9: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq state UNKNOWN group default qlen 3
    link/ppp 
    inet 10.152.75.190 peer 10.152.64.1/32 scope global ppp0
       valid_lft forever preferred_lft forever

@joukewitteveen
Copy link
Owner

Ah, so you want to run PPPoE inside the macvlan. How about this?

/etc/netctl/MyMACVLAN

Description='Virtual LAN for the MyPPP connection'
BindsToInterfaces=eth0
Interface=mac0
Connection=macvlan
Mode=bridge
IP=no

/etc/netctl/MyPPP

Description='My PPPoE connection'
After=(MyMACVLAN)
Interface=mac0
Connection=pppoe
User='example@yourprovider.com'
Password='very secret'

# etc.

@onlymash
Copy link
Author

After I add IP=no to wan0.2 and reboot the system, pppoe will fail

$ netctl status pppoe
● netctl@pppoe.service - wan0.2 PPPoE connection
     Loaded: loaded (/usr/lib/systemd/system/netctl@.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/netctl@pppoe.service.d
             └─profile.conf
     Active: failed (Result: exit-code) since Thu 2020-11-19 05:18:57 HKT; 2min 41s ago
       Docs: man:netctl.profile(5)
    Process: 489 ExecStart=/usr/lib/netctl/network start pppoe (code=exited, status=1/FAILURE)
   Main PID: 489 (code=exited, status=1/FAILURE)

Nov 19 05:18:57 arch-router systemd[1]: Starting wan0.2 PPPoE connection...
Nov 19 05:18:57 arch-router network[489]: Starting network profile 'pppoe'...
Nov 19 05:18:57 arch-router network[489]: The interface of network profile 'pppoe' is already up
Nov 19 05:18:57 arch-router systemd[1]: netctl@pppoe.service: Main process exited,

@onlymash
Copy link
Author

wan0.2 interface is in the up state, pppoe stops the next action

@joukewitteveen
Copy link
Owner

Makes sense, I guess this is a situation where it is okay to add ForceConnect=yes to /etc/netctl/MyPPP.

@onlymash
Copy link
Author

Thanks, it solved my problem perfectly

$ ping 192.168.200.1 -c 4
PING 192.168.200.1 (192.168.200.1) 56(84) bytes of data.
64 bytes from 192.168.200.1: icmp_seq=1 ttl=64 time=0.862 ms
64 bytes from 192.168.200.1: icmp_seq=2 ttl=64 time=0.401 ms
64 bytes from 192.168.200.1: icmp_seq=3 ttl=64 time=0.751 ms
64 bytes from 192.168.200.1: icmp_seq=4 ttl=64 time=0.874 ms

--- 192.168.200.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3025ms
rtt min/avg/max/mdev = 0.401/0.722/0.874/0.191 ms

$ ping github.com -c 4
PING github.com (192.30.255.113) 56(84) bytes of data.
64 bytes from lb-192-30-255-113-sea.github.com (192.30.255.113): icmp_seq=1 ttl=47 time=230 ms
64 bytes from lb-192-30-255-113-sea.github.com (192.30.255.113): icmp_seq=2 ttl=47 time=231 ms
64 bytes from lb-192-30-255-113-sea.github.com (192.30.255.113): icmp_seq=3 ttl=47 time=231 ms
64 bytes from lb-192-30-255-113-sea.github.com (192.30.255.113): icmp_seq=4 ttl=47 time=230 ms

--- github.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 230.470/230.611/230.971/0.207 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants