AKZN Notes

Archives for My Lazy and Forgetful Mind

VLAN OpenWRT as DHCP Server/client and Mikrotik as DHCP Server/client on a Single Ethernet Port

Why ?
I want to use OpenWRT on Orange Pi Zero, but OPiZ only have one ethernet port. So, how i can use that single port as dhcp server (to give internet), and dhcp client (to get internet).

Mikrotik Setting


Configure DHCP Server and vlan interface

  1. Configure MIkrotik DHCP server as usual, for this notes sake, I configure dhcp server as :

    interface : ether2
    ip > addresses : 192.168.88.1/24
    ip > fi > nat masquarade ether2
    ip > route > dst-address = 192.168.88.0/24 gateway=ether2

  2. Add vlan on interface, on some article ,vlan naming convention use ip third subnet as name, In this case, Mikrotik dhcp server ip is 192.168.[88].1 so vlan id is 88

    /interface vlan
    add name=vlan-88  interface=ether2  vlan-id=88

Configure DHCP Client

  1. Configure mikrotik to accept lease ip from openwrt,

    Interface : ether2
    ip > addresses : 10.5.51.254 network 10.5.51.1 (ip dhcp server openwrt)
    ip > route > dst-address=10.5.51.1 gateway=ether2
    ip > route > dst-address=10.5.51.0/24 gateway=10.5.51.1 (to be able to ping from local)

OpenWRT Setting


DHCP Server

default dhcp server setting on lan or bridge interface should works, on this case I set bridge-lan interface using ip 10.5.51.1/24

VLAN DHCP CLient

CLI version source Openwrt DOCs

Add Virtual Device

notes below are using LUCI.

  1. Network > interfaces > devices > add new
    device type choose vlan (802.1q)
  2. base device use eth0 (or any physical eth on device)
  3. Vlan id 88 (as per this notes)
  4. device name eth0.88 (or any of your choices)

Add Virtual Interface

  1. Network > interfaces > interfaces > add new
  2. Name VLAN88 (or any of your choices)
  3. Protocol DHCP Static
  4. Device : eth0.88

Save and restart openwrt device.


Common Problem

  • cant ping if using unmanaged switch, this is because unmanaged switch usually only has 1500 MTU, and VLAN add 4 more byte to 1504 making random error.

Leave a Reply

Your email address will not be published.