Test users wanted to test upgraded and reworked WireGuard

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Goto page Previous  1, 2
Author Message
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Thu Dec 17, 2020 18:23    Post subject: Reply with quote
egc wrote:
tatsuya46 wrote:
whats the difference between the dns server setting on wireguard page vs using forced dns redirection for wireguard interface on the networking page im currently using?


That is a very good question.

The Optional DNS target uses iptables rules to redirect queries on port 53.
I assumed that it would not work as the interface is not unbridged.

Your question led me to actually try it :)

I set an optional DNS target to 11.0.0.0 (non existent so it should stop DNS) and nothing happened and the rules are not hit either:
Code:
root@R7800-2:~# iptables -vnL PREROUTING -t nat
Chain PREROUTING (policy ACCEPT 1927 packets, 184K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DNAT       udp  --  oet2   *       0.0.0.0/0            0.0.0.0/0            udp dpt:53 to:11.0.0.0
    0     0 DNAT       tcp  --  oet2   *       0.0.0.0/0            0.0.0.0/0            tcp dpt:53 to:11.0.0.0
  140  7280 DNAT       tcp  --  *      *       0.0.0.0/0            192.168.0.5          tcp dpt:8080 to:192.168.5.1:80
    1    52 DNAT       tcp  --  *      *       0.0.0.0/0            192.168.0.5          tcp dpt:22 to:192.168.5.1:22
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            192.168.0.5          tcp dpt:23 to:192.168.5.1:23
    0     0 DNAT       icmp --  *      *       0.0.0.0/0            192.168.0.5          to:192.168.5.1
    2   104 TRIGGER    all  --  *      *       0.0.0.0/0            192.168.0.5         TRIGGER type:dnat match:0 relate:0


So in my hands it does not seem to work

When the DNS server (or servers you can set more than one) are set in the WG GUI those are placed in resolv.dnsmasq to use by DNSMasq but only after the connection is made and the route is setup so that when a DNS server is not publicly available you will not get in a dead lock situation where DNSMasq tries to resolve the time server and endpoint URL but cannot.
Furthermore a static route is made so that the DNS server is always routed via the tunnel.


I loaded egc's test build 44980 on a spare r7800 and testing the new DNS severs via tunnel. As a test I used Quad9 servers 9.9.9.9, 149.112.112.9 and looked for changes. If you telnet/ssh and use command "ip route" (without quotes) you will see these new lines added....

9.9.9.9 dev oet1 scope link
149.112.112.9 dev oet1 scope link

In the telnet/ssh session I ran "traceroute 9.9.9.9" and it's was going through the VPN Provider.

EDIT UPDATE the spare r7800 is using the default DHCP also needed to update the Policy Based Routing with 192.168.1.128/25 so all DHCP clients go through the VPN tunnel.

Now if you use your write up on IPSET Route-Up Script the DNS will more likely go through your ISP.

In this example I used 9.9.9.9,149.112.112.9 in the DNS servers via tunnel and added these firewall commands ( I used mark 64 because of your IPSET Route-up write up)...
iptables -t mangle POSTROUTING -d 9.9.9.9 -j MARK --set-mark 64
iptables -t mangle POSTROUTING -d 149.112.112.9 -j MARK --set-mark 64

Test with command "traceroute 9.9.9.9". In my test the DNS servers went to the VPN tunnel. Try it out.

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2


Last edited by mac913 on Thu Dec 17, 2020 20:24; edited 1 time in total
Sponsor
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Thu Dec 17, 2020 20:03    Post subject: Reply with quote
Alozaros wrote:
Hi egc,
I would like to try WG, but im unaware, how its going to work with DoT...im using...last time i tried WG i messed up with PIA settings and was not working.
Ill give it a go again...

Any tips...?? Will it work with stubb resolver...??? or any resolver that works on loopback interface...
I guess, it must not be an issue...???

So, far the advantage of Open VPN prior WG is only in terms of options and configuration, but speed could be a major 'plus' for WG, that outcomes the cons of it...


My 2x r7800s at home are still on build 44483 only because I have over 75days uptime. By experimenting with a spare r7800 and egc's test build 44980 I was able to get Quad9 DNSCrypt v2 to use the VPN Tunnel. Looking at the DNSCrypt Server List online the Quad9 Filtered DNSCrypt & DoH both use ip addresses 9.9.9.9 & 149.112.112.9 and I used these addresses to run through the tunnel. Trace routing the addresses will show you the path it's taking ISP or VPN, in my case it's the VPN path.

In your case you will have to find what ip addresses does your stubb resolver use.

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Sat Dec 19, 2020 0:08    Post subject: Reply with quote
egc wrote:
Per Yngve Berg wrote:
I'm running a Site-Site WG between a R7800 and a RT-AC66U. Couldn't find the file for the latter.

I have made IPv6 work through manual configuration.

1) The oet interface does not have a Link Local Address (FE80::). Probably because it does not have a MAC either.

2) DHCP6C does not assign a PD when one interface that is given a SLA ID is not up when run.


Per Yngve, thanks for testing, BS decided to go forward and have the build publicly available already (a bit to soon for my liking as I wanted more time to test)

I do not have IPv6 (and only have basic knowledge about it) so could not test/try anything.

Can you give some instruction how to setup IPv6 for other users?

Perhaps you can use the route-up script to setup IPv6 routes ?
The route-up script kicks in after the connection is made.


<See my updated post below about HE IPv6 with PBR.>

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2


Last edited by mac913 on Thu Dec 24, 2020 4:29; edited 3 times in total
buffalo0207
DD-WRT User


Joined: 30 Apr 2014
Posts: 147
Location: UK

PostPosted: Sat Dec 19, 2020 3:54    Post subject: Reply with quote
@mac913

I followed your directions to get IPv6 to work through the WG tunnel, but my IPv6 breaks when I put the 3 HE addresses into the "Allowed Ips" tab. Once I remove them, IPv6 works again.

I updated the MTU in my HE Account to be -20 of my WG MTU, and I changed the MTU value also in the Setup>Ipv6.

Am I missing something?
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Sat Dec 19, 2020 6:04    Post subject: Reply with quote
<Deleted Post>
_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2


Last edited by mac913 on Tue Dec 22, 2020 20:45; edited 1 time in total
buffalo0207
DD-WRT User


Joined: 30 Apr 2014
Posts: 147
Location: UK

PostPosted: Mon Dec 21, 2020 0:07    Post subject: Reply with quote
@mac913

I tried your suggestion in SSH, but after getting my HE URL Update from my HE account, I get no return address change - nothing happens...
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Mon Dec 21, 2020 1:57    Post subject: Reply with quote
<Deleled Post>
_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2


Last edited by mac913 on Tue Dec 22, 2020 20:44; edited 1 time in total
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Dec 22, 2020 5:12    Post subject: Reply with quote
I have condensed my posts on HE IPv6 & DNS tunnelling through WireGuard using PBR.

This is based on egc's build 44980 on my spare r7800. My write-up is generic and will work with DD-WRT v4.x kernels with different SoC's. Didn't test DD-WRT with 3.x kernels but it should work.

I looked into my WireGuard Provider and they currently do NOT support IPv6. I was able to tunnel both HE IPv6 and DNSMasq DNS Servers through the WireGuard tunnel.

Here a link to setting up HE IPv6...
https://wiki.dd-wrt.com/wiki/index.php/IPv6,_6in4_tunnel_-_GUI_only

Make sure your HE IPv6 is working with your WAN before continuing.

Update your HE IPv6 MTU to be 20 less than the oet1 tunnel MTU. Also make the MTU changes on your HE account under Advanced. Example if WireGuard MTU=1460 subtract 20 for HE IPv6 MTU=1440 in the IPv6 GUI.

With this setup in the Tunnel oet1 GUI
- Set DNS servers via tunnel to 9.9.9.9,149.112.112.9 (or whatever you like, this case QUAD9)
- Allowed IPs is disabled when PBR is in use
- Advanced settings Enabled -> Policy Based Routing 192.168.1.128/26


Policy Based Routing with 192.168.1.128/26 for an IP Range 192.168.1.128 to 191. On the Basic Setup I have DHCP Start IP as 192.168.1.128 with Max DHCP to 64. You can use any range you like it's an example I used. Client addresses outside the Policy Based Routing Range will have IPv4 going through the WAN but HE IPv6 service IPs in the Firewall and DNS Servers in the Tunnel oet1 GUI will still be going through WireGuard.

This firewall is setup route and HE IPv6 to WireGuard with PBR.

UPDATED Firewall to automatically add your your HE IPv4 Server used in your IPv6 GUI's "Tunnel Endpoint IPv4 Address" and egc reworked the Firewall Inbound the addition isn't needed...

# Firewall to Route HE 6in4 IPv6 to WireGuard (WG) oet1 tunnel while using PBR
# Routing DNS to WireGuard by editing WireGuard's "DNS servers via tunnel" GUI
# Tested on egc's build 44980
#
# WAN table route is main, (WG) oet1 table route is 21 when PBR is used
HE_Ping="66.220.2.74"
HE_UpdateURL="64.62.200.2"
HE_IPv4Server="$(nvram get ipv6_tun_end_ipv4)"
# Update Route Tables
# Route HE IPv6 to WireGuard
ip route add $HE_UpdateURL dev oet1
ip route add $HE_Ping dev oet1
ip route add $HE_IPv4Server dev oet1
ip route add $HE_UpdateURL dev oet1 table 21
ip route add $HE_Ping dev oet1 table 21
ip route add $HE_IPv4Server dev oet1 table 21
# Respond to HE Ping Requests
iptables -I INPUT 2 -p icmp -s $HE_Ping -j ACCEPT
# Put back on TOP is required (test if newer builds require it)
iptables -D INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Force HE IPv6 (Ping,Upadte,Server) to (WG) oet1 table route 21
iptables -t mangle -D POSTROUTING -d $HE_IPv4Server -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_IPv4Server -j MARK --set-mark 21
iptables -t mangle -D POSTROUTING -d $HE_Ping -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_Ping -j MARK --set-mark 21
iptables -t mangle -D POSTROUTING -d $HE_UpdateURL -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_UpdateURL -j MARK --set-mark 21

You may ask how I found oet1 to be using route table 21 by telnet/ssh to router...
- run without quotes "ip route show table all" you will see in the list "table 21"
- now run without quotes "ip route show table 21" and you will see the default route at the top is oet1
- the main or default route table be seen without quotes "ip route" or "ip route show table main"

Once you finished setting up, reboot and your clients more likely will not have IPv6 access but your Client IPv6 looks correct more likely means you will have to Update your new Pubic Address from you WireGuard connection. To update your HE account with your new Public Address; in the router telnet/ssh session update your HE Account with your WireGuard's Public IP address using your HE Update URL under Advanced...
curl -s -k https://xxxxxxxxxx.tunnelbroker.net/nic/update?hostname=000000
The update is not instant you have to wait for some kind of reply. Your HE Client IPv4 Address in your HE account will reflect the change (different from your router's WAN IPv4 address).


If you have HE IPv6 working with Radvd you can ignore below.

You can use DNSMasq to handle IPv6 to your clients, you will need to go to the IPv6 GUI to disable Radvd and Apply to save. Client DNS IPv4/v6 are from QUAD9. I prefer to have NTP to used a DNS (in this case OpenDNS) that goes through the WAN to get the clock updated quickly and correctly for other services to start...

no-resolv
domain-needed
server=/ntp.org/208.67.222.222
server=9.9.9.9
server=149.112.112.9
dhcp-option=br0,6,192.168.1.1
dhcp-range=::,constructor:br0,slaac,60m
dhcp-option=br0,option6:dns-server,[2620:fe::9]
ra-param=*,60,1800
enable-ra
quiet-ra
quiet-dhcp
quiet-dhcp6

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2


Last edited by mac913 on Mon Dec 28, 2020 21:03; edited 18 times in total
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Tue Dec 22, 2020 16:18    Post subject: Reply with quote
Nice work!

If you do not use PBR and a route is established before the the tunnel is up that might stop the NTP server to get the correct time and thus the tunnel will not start at all.

So without PBR you have to place all your routing rules in a script and call that from the route-up box.

Instead of using allowed IP of 0.0.0.0/0 use:
0.0.0.0/1,128.0.0.0/1

In this case it does not matter as the default routes (like 0.0.0.0/0 but also 0.0.0.0/1,128.0.0.0/1) are removed when PBR is activated.

Thanks for testing Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Dec 22, 2020 23:38    Post subject: Reply with quote
egc wrote:
Nice work!

If you do not use PBR and a route is established before the the tunnel is up that might stop the NTP server to get the correct time and thus the tunnel will not start at all.

So without PBR you have to place all your routing rules in a script and call that from the route-up box.

Instead of using allowed IP of 0.0.0.0/0 use:
0.0.0.0/1,128.0.0.0/1

In this case it does not matter as the default routes (like 0.0.0.0/0 but also 0.0.0.0/1,128.0.0.0/1) are removed when PBR is activated.

Thanks for testing :)


Okay, I understand now. I thank you for adding/supporting WireGuard to DD-WRT!

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14207
Location: Texas, USA

PostPosted: Mon Dec 28, 2020 4:42    Post subject: Reply with quote
Since someone can't seem to post in the forum, but open a ticket instead:

https://svn.dd-wrt.com/ticket/7302

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Jan 19, 2021 2:04    Post subject: Reply with quote
mac913 wrote:
I have condensed my posts on HE IPv6 & DNS tunnelling through WireGuard using PBR.

This is based on egc's build 44980 on my spare r7800. My write-up is generic and will work with DD-WRT v4.x kernels with different SoC's. Didn't test DD-WRT with 3.x kernels but it should work.

I looked into my WireGuard Provider and they currently do NOT support IPv6. I was able to tunnel both HE IPv6 and DNSMasq DNS Servers through the WireGuard tunnel.

Here a link to setting up HE IPv6...
https://wiki.dd-wrt.com/wiki/index.php/IPv6,_6in4_tunnel_-_GUI_only

Make sure your HE IPv6 is working with your WAN before continuing.

Update your HE IPv6 MTU to be 20 less than the oet1 tunnel MTU. Also make the MTU changes on your HE account under Advanced. Example if WireGuard MTU=1460 subtract 20 for HE IPv6 MTU=1440 in the IPv6 GUI.

With this setup in the Tunnel oet1 GUI
- Set DNS servers via tunnel to 9.9.9.9,149.112.112.9 (or whatever you like, this case QUAD9)
- Allowed IPs is disabled when PBR is in use
- Advanced settings Enabled -> Policy Based Routing 192.168.1.128/26


Policy Based Routing with 192.168.1.128/26 for an IP Range 192.168.1.128 to 191. On the Basic Setup I have DHCP Start IP as 192.168.1.128 with Max DHCP to 64. You can use any range you like it's an example I used. Client addresses outside the Policy Based Routing Range will have IPv4 going through the WAN but HE IPv6 service IPs in the Firewall and DNS Servers in the Tunnel oet1 GUI will still be going through WireGuard.

This firewall is setup route and HE IPv6 to WireGuard with PBR.

UPDATED Firewall to automatically add your your HE IPv4 Server used in your IPv6 GUI's "Tunnel Endpoint IPv4 Address" and egc reworked the Firewall Inbound the addition isn't needed...

# Firewall to Route HE 6in4 IPv6 to WireGuard (WG) oet1 tunnel while using PBR
# Routing DNS to WireGuard by editing WireGuard's "DNS servers via tunnel" GUI
# Tested on egc's build 44980
#
# WAN table route is main, (WG) oet1 table route is 21 when PBR is used
HE_Ping="66.220.2.74"
HE_UpdateURL="64.62.200.2"
HE_IPv4Server="$(nvram get ipv6_tun_end_ipv4)"
# Update Route Tables
# Route HE IPv6 to WireGuard
ip route add $HE_UpdateURL dev oet1
ip route add $HE_Ping dev oet1
ip route add $HE_IPv4Server dev oet1
ip route add $HE_UpdateURL dev oet1 table 21
ip route add $HE_Ping dev oet1 table 21
ip route add $HE_IPv4Server dev oet1 table 21
# Respond to HE Ping Requests
iptables -I INPUT 2 -p icmp -s $HE_Ping -j ACCEPT
# Put back on TOP is required (test if newer builds require it)
iptables -D INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Force HE IPv6 (Ping,Upadte,Server) to (WG) oet1 table route 21
iptables -t mangle -D POSTROUTING -d $HE_IPv4Server -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_IPv4Server -j MARK --set-mark 21
iptables -t mangle -D POSTROUTING -d $HE_Ping -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_Ping -j MARK --set-mark 21
iptables -t mangle -D POSTROUTING -d $HE_UpdateURL -j MARK --set-mark 21 > /dev/null 2>&1
iptables -t mangle -A POSTROUTING -d $HE_UpdateURL -j MARK --set-mark 21

You may ask how I found oet1 to be using route table 21 by telnet/ssh to router...
- run without quotes "ip route show table all" you will see in the list "table 21"
- now run without quotes "ip route show table 21" and you will see the default route at the top is oet1
- the main or default route table be seen without quotes "ip route" or "ip route show table main"

Once you finished setting up, reboot and your clients more likely will not have IPv6 access but your Client IPv6 looks correct more likely means you will have to Update your new Pubic Address from you WireGuard connection. To update your HE account with your new Public Address; in the router telnet/ssh session update your HE Account with your WireGuard's Public IP address using your HE Update URL under Advanced...
curl -s -k https://xxxxxxxxxx.tunnelbroker.net/nic/update?hostname=000000
The update is not instant you have to wait for some kind of reply. Your HE Client IPv4 Address in your HE account will reflect the change (different from your router's WAN IPv4 address).


If you have HE IPv6 working with Radvd you can ignore below.

You can use DNSMasq to handle IPv6 to your clients, you will need to go to the IPv6 GUI to disable Radvd and Apply to save. Client DNS IPv4/v6 are from QUAD9. I prefer to have NTP to used a DNS (in this case OpenDNS) that goes through the WAN to get the clock updated quickly and correctly for other services to start...

no-resolv
domain-needed
server=/ntp.org/208.67.222.222
server=9.9.9.9
server=149.112.112.9
dhcp-option=br0,6,192.168.1.1
dhcp-range=::,constructor:br0,slaac,60m
dhcp-option=br0,option6:dns-server,[2620:fe::9]
ra-param=*,60,1800
enable-ra
quiet-ra
quiet-dhcp
quiet-dhcp6


Testing r45454 I was able to reduce the use of "iptables" in the firewall by using "ip route" with updated startup & firewall. Have it running on my spare R7800 tunneling HE_IPv6 and DNS to WireGuard oet1 i/f.

Code:

# Startup - Route HE 6in4 IPv6 to WireGuard (WG) oet1 tunnel while using PBR
# Routing DNS to WireGuard by editing WireGuard's "DNS servers via tunnel" GUI
# WAN table route is "main" & WireGuard oet1 table route is "21" when PBR is used
# Maximize the use of "ip route" commands
# Minimize the use of "iptables" commands
# Tested on r45454
#
# HE Ping Reply from arc.he.net (last used 66.220.2.74)
HE_Ping="66.220.2.74"
# HE Update URL from tunnelbroker.net (last used 64.62.200.2)
HE_UpdateURL="64.62.200.2"
# Tunnel Endpoint IPv4 Address from IPv6 GUI
HE_IPv4Server="$(nvram get ipv6_tun_end_ipv4)"
#
# Update IP Route Tables
# Route HE IPv6 to WireGuard
ip route add $HE_UpdateURL dev oet1
ip route add $HE_Ping dev oet1
ip route add $HE_IPv4Server dev oet1
#
# Clear Cache
ip route flush cache


Code:

# Firewall - Route HE 6in4 IPv6 to WireGuard (WG) oet1 tunnel while using PBR
# Routing DNS to WireGuard by editing WireGuard's "DNS servers via tunnel" GUI
# WAN table route is "main" & WireGuard oet1 table route is "21" when PBR is used
# Maximize the use of "ip route" commands
# Minimize the use of "iptables" commands
# Tested on r45454
#
# HE Ping Reply from arc.he.net (last used 66.220.2.74)
HE_Ping="66.220.2.74"
#
# NOW very few iptables commands required
# Respond to HE Ping Requests
iptables -I INPUT 2 -p icmp -s $HE_Ping -j ACCEPT
# Put back on TOP is required (still required on r45454)
iptables -D INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Wed Jan 20, 2021 6:13    Post subject: Reply with quote
I loaded r45493 on my spare R7800 and made some changes to my working WireGuard tunnel that tunnels PBR, DNS and HE-IPv6. The updated Startup creates a oet1_routeup.sh script file in the /tmp directory, therefore add /tmp/oet1_routeup.sh to the WireGuard Route up script in the GUI.

Code:

# Startup - Tested on r45493
# WireGuard, PBR and routed DNS along with HE 6in4 IPv6
#
# --- Create file /tmp/oet1_routeup.sh ---
#
# NOTE: any script with any 3 of these $ \ ` requires \ in front of it
#       to create the script correctly with cat command
#
cat - > /tmp/oet1_routeup.sh << EOF
#!/bin/sh
# HE Ping Reply from arc.he.net (last used 66.220.2.74)
HE_Ping="66.220.2.74"
# HE Update URL from tunnelbroker.net (last used 64.62.200.2)
HE_UpdateURL="64.62.200.2"
# Tunnel Endpoint IPv4 Address from IPv6 GUI
HE_IPv4Server="\$(nvram get ipv6_tun_end_ipv4)"
#
# Route HE IPv6 to WireGuard by updating table main
ip route add \$HE_UpdateURL dev oet1
ip route add \$HE_Ping dev oet1
ip route add \$HE_IPv4Server dev oet1
#
# Clear Cache
ip route flush cache
EOF
#
# ^^^ Create file /tmp/oet1_routeup.sh ^^^
#
chmod +x /tmp/oet1_routeup.sh

Code:

# Firewall - Tested on r45493
# WireGuard, PBR and routed DNS along with HE 6in4 IPv6
#
# Respond to HE Ping Requests
iptables -I INPUT 2 -p icmp -s 66.220.2.74 -j ACCEPT
# Put back on TOP is required (test if newer builds require it)
iptables -D INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Wed Jun 02, 2021 17:06    Post subject: Reply with quote
I've been loading newer builds and have run into issues where 6in4 IPv6 doesn't work through a WireGuard tunnel. After doing some digging and testing on Build 46836 on a R7800 I found a solution with my current configuration. Run command...

ip tunnel show

You will see a tunnel like this one without real ip addresses...

ip6tun: ipv6/ip remote xxx.xxx.xxx.xxx local yyy.yyy.yyy.yyy ttl 64

xxx.xxx.xxx.xxx is your 6in4 Server IPv4 Address which is nvram value ipv6_tun_end_ipv4
yyy.yyy.yyy.yyy is currently setup to use your WAN IPv4 Address by default

I created a start script to be added to your Startup GUI that basically changes the the default WAN IP to the WireGuard oet1 IP Address...


Code:
#
# Change IPv6 6in4 to go through WireGuard oet1
ip_oet1addr=$(nvram get oet1_ipaddr)
ip_heserver=$(nvram get ipv6_tun_end_ipv4)
(ip tunnel change ip6tun mode sit remote $ip_heserver local $ip_oet1addr ttl 64)
#


Other changes I made are the MTUs values I now use -40 (minus 40) from each other, for example:

WAN MTU=1500
WG MTU=1460
IPv6 MTU=1420

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
tatsuya46
DD-WRT Guru


Joined: 03 Jan 2010
Posts: 7568
Location: YWG, Canada

PostPosted: Wed Jun 02, 2021 18:57    Post subject: Reply with quote
mac913 wrote:
I've been loading newer builds and have run into issues where 6in4 IPv6 doesn't work through a WireGuard tunnel. After doing some digging and testing on Build 46836 on a R7800 I found a solution with my current configuration. Run command...

ip tunnel show

You will see a tunnel like this one without real ip addresses...

ip6tun: ipv6/ip remote xxx.xxx.xxx.xxx local yyy.yyy.yyy.yyy ttl 64

xxx.xxx.xxx.xxx is your 6in4 Server IPv4 Address which is nvram value ipv6_tun_end_ipv4
yyy.yyy.yyy.yyy is currently setup to use your WAN IPv4 Address by default

I created a start script to be added to your Startup GUI that basically changes the the default WAN IP to the WireGuard oet1 IP Address...


Code:
#
# Change IPv6 6in4 to go through WireGuard oet1
ip_oet1addr=$(nvram get oet1_ipaddr)
ip_heserver=$(nvram get ipv6_tun_end_ipv4)
(ip tunnel change ip6tun mode sit remote $ip_heserver local $ip_oet1addr ttl 64)
#


Other changes I made are the MTUs values I now use -40 (minus 40) from each other, for example:

WAN MTU=1500
WG MTU=1460
IPv6 MTU=1420


WG mtu supposedly needs 1440 for ipv4 & 1420 for ipv6 (according to WG pages)

_________________
LATEST FIRMWARE(S)

BrainSlayer wrote:
we just do it since we do not like any restrictions enforced by stupid cocaine snorting managers

[x86_64] Haswell i3-4150/QCA9984/QCA9882 ------> r55797 std
[QUALCOMM] DIR-862L --------------------------------> r55797 std
▲ ACTIVE / INACTIVE ▼
[QUALCOMM] WNDR4300 v1 --------------------------> r50485 std
[BROADCOM] DIR-860L A1 ----------------------------> r50485 std


Sigh.. why do i exist anyway.. | I love you Anthony.. never forget that.. my other 99% that ill never see again..

Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum