I am trying to setup VPN from openwrt swanctl to pfsense for 0.0.0.0/0 remote network.
My goal is: when VPN is up, all traffic should go to the tunnel, but if is down, traffic should be routed to default gw.
What I got: tunnel for small remote network (192.168.0.0/24) is working perfect.
But if I change remote network on both ends to 0.0.0.0/0 - and boot up openwrt it is pinging for a while (like 15 secounds) and then any conneciton, from computer connected to the Openwrt - is lost (no ping, no ssh, no connection to the device, no Internet on computer conected to the OpenWRT).
NAT on the pfsense site is configured correctly and ready, as I have the same connection architecture on the same PfSense with RutxOS router - working fine.
Moreover, I can see packets flow between pfsense and Openwrt!
I assume the problem is baypassing local traffic, but I have no idea how to fix this.
I have installed PRB package, but not sure it this is correct solution and how to configure it.
Please help!
ubus call system board
{
"kernel": "6.6.73",
"hostname": "OpenWrt",
"system": "MediaTek MT7621 ver:1 eco:3",
"model": "Cudy WR1300 v3",
"board_name": "cudy,wr1300-v3",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "24.10.0",
"revision": "r28427-6df0e3d02a",
"target": "ramips/mt7621",
"description": "OpenWrt 24.10.0 r28427-6df0e3d02a",
"builddate": "1738624177"
}
}
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 'fd43:a6c1:71b4::/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'
option ipv6 '0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '10.48.96.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option device 'wan'
option proto 'dhcp'
config interface 'wan6'
option device 'wan'
option proto 'dhcpv6'
cat /etc/config/wireless - basically disabled
config wifi-device 'radio0'
option type 'mac80211'
option path '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0'
option band '2g'
option channel '1'
option htmode 'HT20'
option disabled '1'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'OpenWrt'
option encryption 'none'
config wifi-device 'radio1'
option type 'mac80211'
option path '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0'
option band '5g'
option channel '36'
option htmode 'VHT80'
option disabled '1'
config wifi-iface 'default_radio1'
option device 'radio1'
option network 'lan'
option mode 'ap'
option ssid 'OpenWrt'
option encryption 'none'
cat /etc/config/dhcp
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'
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'
cat /etc/config/firewall - basically, everythins is open
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option synflood_protect '1'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'any'
list proto 'all'
option src '*'
option dest '*'
option target 'ACCEPT'
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 zone
option name 'vpn'
option network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option mtu_fix '1'
config forwarding
option src 'lan'
option dest 'vpn'
config forwarding
option src 'vpn'
option dest 'lan'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option proto 'esp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-ISP-ISAKMP'
option src 'wan'
option src_port '500'
option dest_port '500'
option proto 'udp'
option family 'ipv4'
option target 'ACCEPT'
config include 'pbr'
option fw4_compatible '1'
option type 'script'
option path '/usr/share/pbr/firewall.include'
cat /etc/config/ipsec
config 'ipsec'
list 'interface' 'wan'
option 'zone' 'vpn'
config 'crypto_proposal' 'ike_proposal'
option 'encryption_algorithm' 'aes256'
option 'hash_algorithm' 'sha256'
option 'dh_group' 'modp2048'
config 'crypto_proposal' 'esp_proposal'
#option 'is_esp' '1'
option 'encryption_algorithm' 'aes256'
option 'hash_algorithm' 'sha256'
option 'dh_group' 'modp2048'
config 'tunnel' 'tun_soho'
list 'remote_subnet' '0.0.0.0/0'
list 'local_subnet' '10.48.96.0/24'
option 'rekeytime' '86400s'
option 'startaction' 'start'
option 'closeaction' 'start'
option 'dpdaction' 'restart'
option 'keyexchange' 'ikev2'
list 'crypto_proposal' 'esp_proposal'
config 'remote' 'acme'
option 'enabled' '1'
option 'gateway' 'XXX_PUBLIC_IP'
option 'local_ip' 'any'
option 'pre_shared_key' 'XXX'
option 'authentication_method' 'psk'
option 'remote_identifier' 'XXX'
option 'local_identifier' 'XXX'
list 'tunnel' 'tun_soho'
list 'crypto_proposal' 'ike_proposal'
option 'rekeytime' '86400s'
option 'keyingtries' '5'
option 'mobike' '0'
option 'fragmentation' 'accept'
/etc/rc.local
( ipsec stop; sleep 10; ipsec start; sleep 10; /etc/init.d/swanctl reload & )
exit 0