First I try to explain what exactly i try to achive.
ISP: I connect to my isp using PPPOE. I get one ipv4 address and an /64 ipv6subnet.
Let's keep ipv6 out of the picture for now since I am trying to get an /58 subnet.
My Switch:
Is a managed mikrotik switch running swOS. I plan to setup the switch to filter traffic on specific ports based on VLAN tags and set up specific ports to only able to communicate with other specific ports later. As of now non of this is configured and the switch is using the default config.
My Networkzones:
WAN: My OpenWrt box is directly connected to an Fritzbox Router with PPPOE passthrough enabled. The Fritzbox therefore basically acts only as a modem.
Using PPPOE passthrough seems to be the way to go since it is the only way to prevent a double DNAT from happening.
LAN: My trusted home network. IP range 10.0.0.0/16 untagged. In this network all trusted devices will conntect to each other. There are more than 255 devices at the moment and number is still growing so I used an /16 subnet. Devices in this zone can access the Internet, DMZ and WLAN zones.
DMZ: IP range 10.10.0.0/16 VLAN 10. Servers runningsServices that are accessable from the internet. Like my PlexServer or the SiaCoin Daemon. Devices in this Network can access each other and the internet but not device in other zones.
WLAN: IP range 10.20.0.0/16 VLAN 20. My private WLAN. All devices in this WLAN are trusted. Devices in this zone can access the Internet, DMZ, and LAN. I am still thinking about to integrate this in the LAN network so maybe this will be removed.
PWLAN: IP range 10.30.0.0/16 VLAN 30. My public WLAN for Visitors. Devices in this zone can access the internet.
CobraLAN: IP range 10.40.0.0/16 VLAN 40.My company workspace at home running some dev environments on virtual servers. Devices in this zone can access the internet.
CobraVPN: IP range 10.50.0.0./16 VLAN 50. IPs for devices connected with VPN. This is for connecting into the dev environment from anywhere. VPN Connections should be able to be opened from LAN Zone and from the Internet. Devices at this zone can access the internet and CobraLAN.
Basically when I start my workday I want to open the VPN and only act inside my dev environment. Regardles if I am sitting at home(LAN) or somewhere on an busines trip (WAN). I do not want to connect two LANs so I do not have a second router at he other end, I just want a device to be able to setup the VPN and act like a device inside the private network.
As requested here are the configs.
I did not change them at the console. I only used the GUI and tried to set up things.
cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd18:254d:0d95::/48'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '10.0.0.1'
option netmask '255.255.0.0'
option ip6assign '64'
option ip6hint '0000'
config interface 'wan'
option device 'wan'
option proto 'pppoe'
option username '<username>'
option password '<password>'
option ipv6 'auto'
option ip6assign '64'
option ip6hint 'FFFF'
config interface 'cobraVPN'
option proto 'wireguard'
option private_key '<privateKeyWG1'
option listen_port '51820'
option delegate '0'
list addresses '10.50.0.1/32'
list addresses 'fd18:254d:d95:32::1/128'
config device
option type '8021q'
option ifname 'br-lan'
option vid '40'
option name 'br-lan.40'
config interface 'cobraLAN'
option proto 'static'
option device 'br-lan.40'
option ipaddr '10.40.0.1'
option netmask '255.255.0.0'
option ip6assign '64'
option ip6hint '0028'
config wireguard_cobraVPN
option description 'Bilal'
option public_key '<publicKeyWG1>'
option private_key '<privateKeyWG1>'
option preshared_key '<presharedKey>'
option route_allowed_ips '1'
option endpoint_host '<ddns url>'
option endpoint_port '51820'
option persistent_keepalive '25'
list allowed_ips '10.50.0.1'
list allowed_ips '10.50.0.2'
cat /etc/config/dhcp
config dnsmasq
option domainneeded '1'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option localservice '1'
option ednspacket_max '1232'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
list ra_flags 'managed-config'
list ra_flags 'other-config'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
config host
option name 'MikroTik'
option ip '10.0.0.2'
option mac 'xx:xx:xx:xx:xx:xx'
option hostid '::2'
config host
option name 'AMATERASU'
option ip '10.0.0.10'
option mac ' xx:xx:xx:xx:xx:xx '
option hostid '::10'
cat /etc/config/firewall
config defaults
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
option flow_offloading '1'
option flow_offloading_hw '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
list network 'wan'
list network 'cobraVPN'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'
config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'
config redirect
option dest 'lan'
option target 'DNAT'
option name 'Plex Server'
list proto 'tcp'
option src 'wan'
option src_dport '32400'
option dest_ip '10.0.0.10'
option dest_port '32400'
config redirect
option dest 'lan'
option target 'DNAT'
option name 'Sia Coin'
option family 'ipv4'
list proto 'tcp'
option src 'wan'
option src_dport '9981-9985'
option dest_ip '10.0.0.10'
option dest_port '9981-9985'
config zone
option name 'cobra'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
list network 'cobraLAN'
config zone
option name 'cobraVPN'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config forwarding
option src 'cobraVPN'
option dest 'wan'
config rule
option name 'Allow-WireGuard'
list proto 'udp'
option src 'wan'
option dest '*'
option dest_port '51820'
option target 'ACCEPT'
THe wiregard client config is copied from the GUI
[Interface]
PrivateKey = <privateKeyWG1>
ListenPort = 51820
[Peer]
PublicKey = <PublicKeyWG1>
PresharedKey = <PresharedKey>
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = <ddns url>:51820
PersistentKeepAlive = 25
Firewall rules are far from finished. I did not touch them to much. Since I havend used iptables in ages and it still seams overcomplicated compared to setups like on watchguard firewalls.
So for the purpose of my problem please ignore DMZ, WLAN and PWLAN Zone, since they are just precreated as palceholders for thinks to come.