Hello. Once upon a time I asked how to set up WireGuard on a router. I finally managed to do it. To do this, I just created an interface with these settings
And then specified Firewall Settings >> Create / Assign firewall-zone >> wan
Now all Internet traffic from all devices connected to the router goes through WireGuard. YouTube works everywhere. But this is not quite what I need. I need WireGuard to work only on a smartphone and TV. But not on PC. I heard that with the help of Policy-Based Routing this can be done. But I dont know how.
Once again more clearly. How to set up Policy-Based Routing in such a way that one local device accesses the Internet via WireGuard. And another local device went online without WireGuard. What do I need to change in my current settings to do this?
As explained in the PBR readme, it is very easy to do that. You select the source address and the interface. As simple as that and really hard to mess it up.
config pbr 'config'
option verbosity '2'
option strict_enforcement '1'
option resolver_set 'none'
option ipv6_enabled '0'
list ignored_interface 'vpnserver'
list ignored_interface 'wgserver'
option boot_timeout '30'
option rule_create_option 'add'
option procd_reload_delay '1'
option webui_show_ignore_target '0'
list webui_supported_protocol 'all'
list webui_supported_protocol 'tcp'
list webui_supported_protocol 'udp'
list webui_supported_protocol 'tcp udp'
list webui_supported_protocol 'icmp'
option enabled '1'
config include
option path '/usr/share/pbr/pbr.user.aws'
config include
option path '/usr/share/pbr/pbr.user.netflix'
config policy
option name 'Plex/Emby Local Server'
option interface 'wan'
option src_port '8096 8920 32400'
option enabled '0'
config policy
option name 'Plex/Emby Remote Servers'
option interface 'wan'
option dest_addr 'plex.tv my.plexapp.com emby.media app.emby.media tv.emby.media'
option enabled '0'
config policy
option src_addr '192.168.1.11 192.168.1.20 192.168.1.30'
option interface 'Cloudflare'
option name 'CLOUDFLARE For ALL'
config policy
option name '192.168.1.10'
option src_addr '192.168.1.10'
option interface 'wan'
/etc/init.d/pbr
root@K14M:~# /etc/init.d/pbr
Syntax: /etc/init.d/pbr [command]
Available commands:
start Start the service
stop Stop the service
restart Restart the service
reload Reload configuration files (or restart if service does not implement reload)
enable Enable service autostart
disable Disable service autostart
enabled Check if service is started on boot
status Generates output required to troubleshoot routing issues
Use '-d' option for more detailed output
Use '-p' option to automatically upload data under VPR paste.ee account
WARNING: while paste.ee uploads are unlisted, they are still publicly available
List domain names after options to include their lookup in report
version Show version information
on_firewall_reload Run service on firewall reload
on_interface_reload Run service on indicated interface reload
running Check if service is running
status Service status
trace Start with syscall trace
info Dump procd service info
root@K14M:~#
Naturally, I doubt it. If a person asks me what I have already written, but he probably did not read carefully or is poorly versed in the topic once he asks a question about what I have already answered. Right?