I do have ISP working on LAN, it only goes down when VPN goes up.
I edited my last reply to make it more clear.
Here's what I did:
Installed OpenWrt and got LAN working with ISP
Configured VPN on LAN to test/learn.
Undid the configurations of the VPN on LAN
Created LAN2
LAN and LAN2 working with ISP
Configured VPN on LAN2
Behaviour according to my last reply
You have a lot of routes being created on "VPN up"
I just followed the wiki.
Only extra is the configs you suggested.
In my first post you can see the configs and routing with your suggestions.
Perhaps we need to make LAN2 your ISP network instead?
Doesn't make much of a difference to me.
Only reason I used LAN2 for VPN was because I want cable ports on the ISP and that was already working with LAN, so I only had to create one wifi and set it to LAN2.
It seemed easier than changing the ports to LAN2.
I understand that. That's the issue. To be honest, I'm not familiar with how OpenVPN creates routes; but since they're created on LAN (using the main routing table), I'm now advising that you setup LAN2 as the network that stays ISP-only (i.e. no VPN), using routing table No. 2.
OK, cool.
You will now change the /etc/config/network rules above to change LAN2 to regular WAN:
All done!
It's working (kinda off).
Browsing is really slow, I can't even use speedtest.net, I get a "latency error".
That is happening because connections on LAN2 (ISP) are using LAN (VPN) DNS, I tried manually setting the DNS on LAN2 but DNS leak test (on LAN2) still shows my VPN IP. Edit: Added what happens to DNS in the table below
I switched the subnets, so:
LAN
Subnet
Connection
DNS
br-lan
192.168.10.0/24
VPN
VPN
br-lan2
192.168.1.0/24
ISP
VPN (should be ISP)
For some weird reason I can't ping 192.168.1.1 when on br-lan2, I have to access to router using 192.168.10.1
Is it because of these?
config rule
option src '192.168.1.0/24'
option dest '192.168.10.0/24'
Since I switched the subnets, I also switched src/dest.
0.0.0.0/1 via xx.xx.0.102 dev tun0
default via xxx.xx.192.1 dev eth0.2 proto static src xxx.xx.196.32
xx.xx.0.1 via xx.xx.0.102 dev tun0
xx.xx.0.102 dev tun0 proto kernel scope link src xx.xx.0.101
xx.xxx.xxx.250 via xxx.xx.192.1 dev eth0.2
xxx.xx.192.0/18 dev eth0.2 proto kernel scope link src xxx.xx.196.32
128.0.0.0/1 via 10.21.0.102 dev tun0
192.168.1.0/24 dev br-lan2 proto kernel scope link src 192.168.1.1
192.168.10.0/24 dev br-lan proto kernel scope link src 192.168.10.1
ip rule
0: from all lookup local
2: from all iif br-lan2 lookup 2
3: from 192.168.1.0/24 lookup 2
32766: from all lookup main
32767: from all lookup default
No, that should permit the traffic - ALSO, YOU PASTED AN INCOMPLETE RULE, IT DOESN'T APPEAR ON THE ROUTING RULES!. Also, did you follow my instructions:
(this is if they are not in the same firewall zone, if they are you must allow forwarding in the same zone)
Different error than speedtest.net but still... Anyway, maybe that will be fixed with proper DNS/rules.
I set it under Network > Interfaces > LAN > Common Configuration > General Setup > Use custom DNS servers
config interface 'lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.10.1'
option netmask '255.255.255.0'
option dns '10.21.0.1'
option ip6assign '60'
And for LAN2 (hoping to avoid using the VPN DNS)
config interface 'lan2'
option type 'bridge'
option ifname 'eth0.1'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option dns '201.31.0.19 201.31.0.20'
option ip6assign '60'
Just tried setting under DHCP-Options, ping: google.com: Temporary failure in name resolution
I tried leaving the DNS in both places and just on DHCP-Options, same result ^
Also tried setting only on LAN2, DHCP-Options and/or Custom DNS, same result ^
New info
I noticed that when the VPN is down LAN2 DNS is according to the Custom DNS rule.
When the VPN is up, LAN2 uses de same DNS than the Custom DNS set in LAN (if any). I'm sure of it because the countries are different (VPN/ISP), so it shows easily in the DNS leak test.
Yeah, it was incomplete, I thought it would be enough for you to know what rule I was talking about, sorry.
At the bottom of /etc/config/firewall (pasted in the previous reply) you can see the full rule, just like you told me to add it.
I have forwards betwen LAN and LAN2 in /etc/config/firewall. Is it something else?
config forwarding
option src 'lan'
option dest 'lan2'
config forwarding
option src 'lan2'
option dest 'lan'
0.0.0.0/1 via xx.xx.0.102 dev tun0
default via xxx.xx.192.1 dev eth0.2 proto static src xxx.xx.196.32
xx.xx.0.1 via xx.xx.0.102 dev tun0
xx.xx.0.102 dev tun0 proto kernel scope link src xx.xx.0.101
xx.xxx.143.250 via xxx.xx.192.1 dev eth0.2
xxx.xx.192.0/18 dev eth0.2 proto kernel scope link src xxx.xx.196.32
128.0.0.0/1 via 10.21.0.102 dev tun0
192.168.1.0/24 dev br-lan2 proto kernel scope link src 192.168.1.1
192.168.10.0/24 dev br-lan proto kernel scope link src 192.168.10.1
/{etc,tmp}/resolv.conf
search lan
nameserver 127.0.0.1
/tmp/resolv.conf.auto
# Interface lan
nameserver 10.21.0.1
# Interface lan2
nameserver 201.31.0.19
nameserver 201.31.0.20
# Interface wan
nameserver 201.21.192.112
nameserver 201.21.192.117
Oh, and happy new years eve!
(If you follow the Gregorian calendar)
How I didn't do what you showed me? I did and the result was no DNS at all.
You even quoted me on this...
Yes, like I already said, when the VPN is down LAN2 (ISP) DNS is whatever I set in Custom DNS
Moved to /etc/config/network
0: from all lookup local
2: from all iif br-lan2 lookup 2
3: from 192.168.1.0/24 lookup 2
4: from 192.168.10.0/24 to 192.168.1.0/24 lookup main
32766: from all lookup main
32767: from all lookup default
DNS still the same thing, when VPN is up on LAN, LAN2 uses the same DNS.
However I only have this firewall rule... Maybe I need to add something else?
config forwarding
option src 'lan'
option dest 'lan2'
config forwarding
option src 'lan2'
option dest 'lan'
Also, in this other thread the guy had the exact same issue (VPN killed other VLAN, which we now have solved) and when he was trying to fix it, he had "DNS issues":
At the moment IP. In my openvpn config file I have something like this:
list remote '12.123.123.123 80'
But I'm thinking about switching to NordVPN next month and I think they use hostname.
These two rules that guy in the other thread used are equivalent to what you told me to do or is it something else entirely?
ip route add default via 192.168.0.1 table 10
ip rule add from 192.168.5.2 table 10
Something to occurred to me. Does it matter that the OpenWrt router is connected to my ISP modem/router which is configured in bridge mode (to avoid double NAT)?
I reading all I can find on routes to actually understand what in happening with all those rules/routes and actually be able to troubleshoot this situation. If there is any material you recommend let me know.
Yes, those commands are similar (default = 0.0.0.0/0). You enter those commands at the system prompt when not using the UCI/web GUI. Please be advised, it's just one route, and one routing rule. You keep mixing terms.
It shouldn't. You should be getting a public IP from the modem.
After studying the material @lleachii recommend and doing some more research I ended up finding another thread about the same thing, which had the solution.
I added the following to Network > Firewall > Custom Rules
ip route add 192.168.1.0/24 dev br-lan table lan
ip route add default via xxx.xx.192.1 src 100.64.196.32 table lan
ip route add 192.168.10.0/24 dev br-lan2 table vpn
ip route add default via xx.xx.0.102 src xx.xx.0.101 table vpn
ip rule add from 192.168.10.0/24 to default lookup vpn prio 16000
ip rule add from 192.168.1.0/24 to default lookup lan prio 16010
ip rule add iif lo to default lookup lan prio 16020
Added vpn and lan tables to /etc/iproute2/rt_tables
#
# reserved values
#
128 prelocal
255 local
254 main
253 default
250 vpn
240 lan
0 unspec
#
# local
#
#1 inr.ruhep
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
option network 'wan wan6'
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 src_ip 'fc00::/6'
option dest_ip 'fc00::/6'
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 include
option path '/etc/firewall.user'
config zone
option name 'vpnclient'
option network 'vpn'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
config zone
option name 'lan2'
option input 'REJECT'
option forward 'REJECT'
option output 'ACCEPT'
option network 'lan2'
config forwarding
option dest 'wan'
option src 'lan'
config forwarding
option dest 'vpnclient'
option src 'lan2'
PS1: For some reason DHCP on LAN2 isn't working, it's not a issue to me, but be aware of it in case you copy the configs. PS2: I can't ping from one LAN to the other. Tried adding the forwarding rules without success.
Still, you are rejecting INPUT from zone LAN2, so the DHCP packets from the hosts in LAN2 will never reach the router, as you don't specifically allow port 67.
I had a closer look in the rules you added. Since you want to have intra-LAN traffic, you must add a route for the other network in the new routing tables. Otherwise packets to the other LAN go to the internet gateway.
ip route add 192.168.10.0/24 dev br-lan2 table lan
ip route add 192.168.1.0/24 dev br-lan table vpn
By adding these two rules I can ping between LANs! Edit: I just notice that I got really weird ping timings
➜ ~ ping 192.168.10.172
PING 192.168.10.172 (192.168.10.172) 56(84) bytes of data.
64 bytes from 192.168.10.172: icmp_seq=1 ttl=63 time=4.01 ms
64 bytes from 192.168.10.172: icmp_seq=2 ttl=63 time=5.81 ms
64 bytes from 192.168.10.172: icmp_seq=3 ttl=63 time=3.44 ms
64 bytes from 192.168.10.172: icmp_seq=4 ttl=63 time=80.10 ms
64 bytes from 192.168.10.172: icmp_seq=5 ttl=63 time=105 ms
64 bytes from 192.168.10.172: icmp_seq=6 ttl=63 time=129 ms
64 bytes from 192.168.10.172: icmp_seq=7 ttl=63 time=153 ms
64 bytes from 192.168.10.172: icmp_seq=8 ttl=63 time=173 ms
64 bytes from 192.168.10.172: icmp_seq=9 ttl=63 time=196 ms
64 bytes from 192.168.10.172: icmp_seq=10 ttl=63 time=48.8 ms
64 bytes from 192.168.10.172: icmp_seq=11 ttl=63 time=41.2 ms
64 bytes from 192.168.10.172: icmp_seq=12 ttl=63 time=675 ms
64 bytes from 192.168.10.172: icmp_seq=13 ttl=63 time=5.50 ms
64 bytes from 192.168.10.172: icmp_seq=14 ttl=63 time=412 ms
64 bytes from 192.168.10.172: icmp_seq=15 ttl=63 time=950 ms
64 bytes from 192.168.10.172: icmp_seq=16 ttl=63 time=7.11 ms
^C
--- 192.168.10.172 ping statistics ---
16 packets transmitted, 16 received, 0% packet loss, time 31ms
rtt min/avg/max/mdev = 3.438/186.983/950.424/262.211 ms
That's way to much for just going to the router and back.
(I'm pinging from a cabled connection on LAN to my phone on LAN2 wifi)
By allowing INPUT and FORWARD in zone lan2 DCHP works, however I get a DNS leak.
I tried setting the VPN DNS in Network > Interfaces > LAN2 > Common Configuration > Use custom DNS servers and in Network > Interfaces > LAN2 > DHCP Server > Advanced Settings > DHCP-Options but I still get the leak.
Setting manual IP and rejecting INPUT/FORWARD in zone lan2 allows ping between LANs (because of those two routes) and I don't get leaks.
I'm just not sure there will be any undesired behaviours because of the reject (besides DCHP not working).