0

I have followed the guideline to setup VLAN interface on eth0 but failed to auto get IP address from my upstream dhcp server. I have checked tcpdump and don't see any dhcp traffic on VLAN interfaces. Is there any missing in my configuration?

  1. apt-get install vlan

  2. echo "8021q" >> /etc/modules & modprobe 8021q

  3. Setup vlan interface

cat /etc/network/interfaces.d/vlans
auto eth0.20
iface eth0.20 inet manual
vlan-raw-device eth0

auto eth0.23
iface eth0.23 inet manual
vlan-raw-device eth0

auto eth0.24
iface eth0.24 inet manual
vlan-raw-device eth0
  1. Restart networking service systemctl restart networking
3
  • "I have followed the guideline" - what guideline? This uses Debian networking which is not used & incompatible with Raspberry Pi OS dhcpcd
    – Milliways
    Commented Nov 3, 2022 at 0:12
  • @Milliways Are you sure about the incompability? I tested it on Raspberry OS 2022-09-22 and it creates a vlan interface and start dhcpd to retrieve a IP address.
    – MatsK
    Commented Nov 3, 2022 at 15:06
  • @MatsK attempts to use Debian networking while dhcpcd is running creates contention (although it can be done if properly configured) but the OP has provided no evidence. Your answer is a kludge which "works" because it causes dhcpcd to disable itself when it invokes DHCP.
    – Milliways
    Commented Nov 3, 2022 at 21:25

1 Answer 1

1

Change inet manual to inet dhcp so the VLAN subinterfaces gets a DHCP address.

inet manual Does not define an IP address for an interface

inet dhcp Get a DHCP IP address for the interface

And do the upstream offer DHCP on the VLANs 20, 23 and 24 ?

PS. Please post the tcpdump command for clarity.

4
  • Thanks. It works. May I know how to change default eth0 up but without any IP address? I have looked at "wiki.debian.org/…" -Bringing up an interface without an IP address, but not sure which file should be edited.
    – ce13
    Commented Nov 3, 2022 at 14:49
  • I dont understand what you would like to accomplish.
    – MatsK
    Commented Nov 3, 2022 at 14:57
  • In Pi I have eth0, eth0.20, eth0.23 and eth0.24 and I just want to enable eth0 interface without getting any IP, may be just change the eth0 to "manual" but not sure how to do it.
    – ce13
    Commented Nov 3, 2022 at 15:05
  • Just add to your /etc/network/interfaces.d/vlans file auto eth0 and iface eth0 inet manual If I understand you right. And please mark my answer as an answer to your question.
    – MatsK
    Commented Nov 3, 2022 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.