Hi,
The best internet connection I can have in my location (B) is based on 5G cell network. Unfortunately, the ISP does not provide a public IP.
So I want to use the public IP from another location (A) to reach my network & devices at location (B).
For this, I have configured an OpenWrt device at location B (Netgear EX7300v2) to run an OpenVPN client. It creates a bridge (TAP) with Location A's OpenVPN bridge server. Note that I have no control over the OpenVPN server configuration as it's part of Location A's ISP-provided router.
The WiFi radio on the OpenWrt device is disabled, so it's a 1-ethernet-port device connected directly to Location B's ISP 5G router via ethernet. It has 2 interfaces configured:
- eth0: static IP 192.168.4.2 in the LAN firewall zone
- tap0: static IP 192.168.1.100 in the WAN firewall zone
Here is a quick diagram:
From a connectivity standpoint, everything seems to work fine:
- the OpenWrt device can be reached from devices in both Locations
- the OpenWrt device can reach devices in both Locations
- the OpenWrt device can reach the internet (google.com) using either interface
pings
root@EX7300v2-OpenWrt:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.4.1 0.0.0.0 UG 10 0 0 eth0
default 192.168.1.254 0.0.0.0 UG 20 0 0 tap0
192.168.1.0 * 255.255.255.0 U 20 0 0 tap0
192.168.4.0 * 255.255.255.0 U 10 0 0 eth0
root@EX7300v2-OpenWrt:~#
root@EX7300v2-OpenWrt:~# ping 192.168.4.1
PING 192.168.4.1 (192.168.4.1): 56 data bytes
64 bytes from 192.168.4.1: seq=0 ttl=64 time=0.804 ms
64 bytes from 192.168.4.1: seq=1 ttl=64 time=0.696 ms
^C
--- 192.168.4.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.696/0.750/0.804 ms
root@EX7300v2-OpenWrt:~# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254): 56 data bytes
64 bytes from 192.168.1.254: seq=0 ttl=64 time=68.947 ms
64 bytes from 192.168.1.254: seq=1 ttl=64 time=76.258 ms
^C
--- 192.168.1.254 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 68.947/72.602/76.258 ms
root@EX7300v2-OpenWrt:~# ping 192.168.1.40
PING 192.168.1.40 (192.168.1.40): 56 data bytes
64 bytes from 192.168.1.40: seq=0 ttl=64 time=81.982 ms
64 bytes from 192.168.1.40: seq=1 ttl=64 time=41.417 ms
^C
--- 192.168.1.40 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 41.417/61.699/81.982 ms
root@EX7300v2-OpenWrt:~# ping google.com
PING google.com (142.250.179.110): 56 data bytes
64 bytes from 142.250.179.110: seq=0 ttl=112 time=34.609 ms
64 bytes from 142.250.179.110: seq=1 ttl=112 time=31.884 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 31.884/33.246/34.609 ms
root@EX7300v2-OpenWrt:~# ping -I eth0 google.com
PING google.com (172.217.20.174): 56 data bytes
64 bytes from 172.217.20.174: seq=0 ttl=112 time=33.134 ms
64 bytes from 172.217.20.174: seq=1 ttl=112 time=32.614 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 32.614/32.874/33.134 ms
root@EX7300v2-OpenWrt:~# ping -I tap0 google.com
PING google.com (142.250.179.110): 56 data bytes
64 bytes from 142.250.179.110: seq=0 ttl=117 time=70.606 ms
64 bytes from 142.250.179.110: seq=1 ttl=117 time=77.091 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 70.606/73.848/77.091 ms
On location A's ISP router, port 48041 is opened and forwarded to 192.168.1.100.
On the OpenWrt device, the same port is opened and forwarded to 192.168.4.1 on port 80 (Location B's ISP router web interface).
Problem: connecting to http://IPofLocationA:48041 doesn't work (even when using an internet connection different from Location A or B).
From adding some logging in the firewall, I can see that the rule I put in is triggered.
root@EX7300v2-OpenWrt:~# logread -e "Gateway management"
Mon Jan 27 11:09:15 2025 kern.warn kernel: [29865.652792] Gateway management: IN=tap0 OUT= MAC=52:5d:68:29:63:c7:14:0c:76:b0:5c:bc:08:00 SRC=37.170.13.66 DST=192.168.1.100 LEN=60 TOS=0x00 PREC=0x20 TTL=56 ID=50453 DF PROTO=TCP SPT=40457 DPT=48041 WINDOW=64240 RES=0x00 SYN URGP=0
But I am not sure how to troubleshoot further.
Am I missing a traffic rule or anything else?
Thanks for the help
configs
root@EX7300v2-OpenWrt:~# uci export network
package 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 'fd3c:6ced:effd::/48'
config interface 'lan1'
option proto 'static'
option device 'eth0'
option ipaddr '192.168.4.2'
option netmask '255.255.255.0'
option gateway '192.168.4.1'
option broadcast '192.168.2.255'
option delegate '0'
option ip6assign '60'
list dns '192.168.4.1'
option metric '10'
config device
option name 'eth0'
option ipv6 '1'
config interface 'bridgedVPN'
option proto 'static'
option device 'tap0'
option ipaddr '192.168.1.100'
option netmask '255.255.255.0'
option gateway '192.168.1.254'
list dns '192.168.1.254'
option metric '20'
option ip6assign '60'
config device
option name 'tap0'
option macaddr '52:5D:68:29:63:C7'
option acceptlocal '0'
root@EX7300v2-OpenWrt:~# uci export firewall
package firewall
config defaults
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option log '1'
list network 'lan1'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option mtu_fix '1'
option log '1'
list network 'bridgedVPN'
option masq '1'
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 'Gateway management'
option src 'wan'
option src_dport '48041'
option dest_ip '192.168.4.1'
option dest_port '80'
option log '1'
list proto 'tcp'
root@EX7300v2-OpenWrt:~# cat /etc/openvpn/bridged.conf
client
remote <Location A public IP> <port>
proto udp
nobind
dev-type tap
dev tap0
log /var/log/bridged.log
pull
auth-user-pass <auth file>
fragment 1452
mssfix 1452
explicit-exit-notify 3
data-ciphers-fallback AES-256-CBC
remote-cert-tls server
verify-x509-name "C=FR, O=XXXXX SA, CN=XXXX OpenVPN server XXXX"
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>
<extra-certs>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</extra-certs>
<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>