ipset the easy way for Netgear R7000

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
James2k
DD-WRT Guru


Joined: 23 Oct 2011
Posts: 549

PostPosted: Sat Jul 15, 2017 9:00    Post subject: ipset the easy way for Netgear R7000 Reply with quote
For VPN users out there its becoming a more commonly asked question "how can I bypass specific websites going through a VPN tunnel?". The best way to achieve this is in my opinion is the dnsmasq+ipset combo, but with DD-WRT not including ipset and the dnsmasq binary built into the firmware not being compiled with ipset support, its a little challenging for some.

I've created a small Github repo that essentially provides all you need for ipset support on DD-WRT along with documentation and requirements, supporting both kernel 3.10 and 4.4 builds.

https://github.com/jamesmacwhite/ipset-netgear-r7000-dd-wrt

It requires you have opkg setup in some form so you can install additional .ipk packages to /opt, but you can also copy the contents of the /opt folder to get the binaries, but its not the recommended method or very maintainable.

It is tailored to the Netgear R7000 as that's my main router I use so I can 100% ensure compatibility with the packages and modules, it may also work for others that are also ARMv7 Broadcom based, but the main difference is likely to be the toolchain or kernel source used.

In addition there is wiki on how to compile the xt_set.ko module yourself if you do indeed need to use a specific toolchain and different kernel version compared to the Netgear R7000.

Hopefully in the future DD-WRT will have this built into firmware builds without having to use this route, for now though, I hope it helps people that want ipset support on their routers, in addition helps anyone who wishes to compile modules and such themselves with guidance.

_________________
James

Main router:

Netgear R7000 overclocked to 1.2GHz - DD-WRT v3.0-r35965M kongac

IPv6 6in4 (HE.net), OpenVPN (with PBR and split tunnelling), Entware, dnsmasq with ipset

Easy ipset support for the R7000

VPN speed: Download: 77.96 Mbps Upload: 5.00 Mbps (AES-128-CBC HMAC-SHA1)

Yes you can get 50 Mbps+ with OpenVPN on a R7000 if you configure it properly!

Previous routers:

ASUS RT-N66U - The Dark Knight
WNR2000v3 - Bought on the cheap for someone else, neutered crap
WNR3500Lv1 - First venture into the DD-WRT world
Sponsor
allen2000
DD-WRT Novice


Joined: 14 Feb 2017
Posts: 3

PostPosted: Sat Jul 29, 2017 8:02    Post subject: Reply with quote
Hi James,
Thanks for your effort! With your wiki, I success to compile the xt_set.ko module but stucked on compiling ipset.

Following the wiki at https://github.com/Entware-ng/Entware-ng/wiki/How-to-add-a-new-package everything seems fine until the step "make package/ipset/compile".
There is no error, but I cannot find the ipset ipk file under bin/targets/armv7soft/generic-glibc/packages.

Would you show me more details as stated "ipset itself is compiled using the build system in Entware-ng (which uses the OpenWRT buildroot) but with DD-WRT kernel sources to be compatible."?

Thanks a lot!

Allen
James2k
DD-WRT Guru


Joined: 23 Oct 2011
Posts: 549

PostPosted: Sat Jul 29, 2017 8:42    Post subject: Reply with quote
Hi,

Ah, I think I remember I had to edit the .config and change the following line to y as its not set by default:

Quote:
CONFIG_PACKAGE_ipset=y


Then compile as normal and an .ipk is generated to install via opkg.

Alternatively, you can download the source of ipset and cross-compile it with the appropriate DD-WRT toolchain for your router, but as I already have Entware setup, I just borrow the source from there instead as its already setup for cross-compiling.

Here's a basic guide of the above:

https://github.com/jamesmacwhite/ipset-netgear-r7000-dd-wrt/wiki/Compiling-ipset-via-Entware

_________________
James

Main router:

Netgear R7000 overclocked to 1.2GHz - DD-WRT v3.0-r35965M kongac

IPv6 6in4 (HE.net), OpenVPN (with PBR and split tunnelling), Entware, dnsmasq with ipset

Easy ipset support for the R7000

VPN speed: Download: 77.96 Mbps Upload: 5.00 Mbps (AES-128-CBC HMAC-SHA1)

Yes you can get 50 Mbps+ with OpenVPN on a R7000 if you configure it properly!

Previous routers:

ASUS RT-N66U - The Dark Knight
WNR2000v3 - Bought on the cheap for someone else, neutered crap
WNR3500Lv1 - First venture into the DD-WRT world


Last edited by James2k on Sun Jul 30, 2017 8:55; edited 1 time in total
allen2000
DD-WRT Novice


Joined: 14 Feb 2017
Posts: 3

PostPosted: Sun Jul 30, 2017 1:51    Post subject: Reply with quote
Hi James,
Thanks for your quick reply.

One more question, should I need to change the Makefile of ipset "--with-kbuild=/path_to_dd-wrt_kernel" before compiling ipset? As you said "compile ipset with DD-WRT kernel sources to be compatible"?

Allen
James2k
DD-WRT Guru


Joined: 23 Oct 2011
Posts: 549

PostPosted: Sun Jul 30, 2017 8:28    Post subject: Reply with quote
Yes, to ensure compatibility, I point it to the kernel source dir of DD-WRT i.e. src/linux/universal/linux-4.4 or whatever kernel target you need.

Here's a quick script that will replace it for you.

My paths are /root/ because I actually compile on Windows Linux Subsystem, so the setup is a bit different.

Code:

#!/bin/bash
ENTWARE_NG_SOURCE_DIR="/root/Entware-ng" # Change to your local path
ENTWARE_NG_IPSET_MAKEFILE="${ENTWARE_NG_SOURCE_DIR}/package/network/utils/ipset/Makefile"
DD_WRT_SOURCE_DIR="/root/dd-wrt" # Change to the root of where the DD-WRT source tree is
DD_WRT_KERNEL_TARGET="linux-4.4" # Change if you need to use kernel 3.10
DD_WRT_KERNEL_SOURCE_DIR="${DD_WRT_SOURCE_DIR}/src/linux/universal/${DD_WRT_KERNEL_TARGET}"

echo "Replacing Entware-ng kernel source dir with DD-WRT kernel source dir"
sed -i "s@\$(LINUX_DIR)@${DD_WRT_KERNEL_SOURCE_DIR}@" "${ENTWARE_NG_IPSET_MAKEFILE}"


Change paths accordingly.

_________________
James

Main router:

Netgear R7000 overclocked to 1.2GHz - DD-WRT v3.0-r35965M kongac

IPv6 6in4 (HE.net), OpenVPN (with PBR and split tunnelling), Entware, dnsmasq with ipset

Easy ipset support for the R7000

VPN speed: Download: 77.96 Mbps Upload: 5.00 Mbps (AES-128-CBC HMAC-SHA1)

Yes you can get 50 Mbps+ with OpenVPN on a R7000 if you configure it properly!

Previous routers:

ASUS RT-N66U - The Dark Knight
WNR2000v3 - Bought on the cheap for someone else, neutered crap
WNR3500Lv1 - First venture into the DD-WRT world
allen2000
DD-WRT Novice


Joined: 14 Feb 2017
Posts: 3

PostPosted: Sun Jul 30, 2017 11:26    Post subject: Reply with quote
Hi James,

It's clear now. Thanks a lot!

Allen
No_Body
DD-WRT Novice


Joined: 01 Mar 2019
Posts: 8

PostPosted: Fri Mar 01, 2019 7:40    Post subject: Reply with quote
Is there any way to make this run on a Netgear wndr3800 with the linux-3.10 kernel?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Fri Mar 01, 2019 11:35    Post subject: Reply with quote
What is it exactly that you want?
If you want simple Policy based routing it is possible wihtout ipset and if you want/have to use ipset there are other solutions available too

_________________
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
No_Body
DD-WRT Novice


Joined: 01 Mar 2019
Posts: 8

PostPosted: Sat Mar 02, 2019 23:48    Post subject: Reply with quote
egc wrote:
What is it exactly that you want?
If you want simple Policy based routing it is possible wihtout ipset and if you want/have to use ipset there are other solutions available too



Right now I would just like to have ipset working properly.

ipset v6.34: Kernel error received: Invalid argument
Maverick98087
DD-WRT Novice


Joined: 23 Dec 2018
Posts: 9

PostPosted: Sun Jul 14, 2019 18:24    Post subject: Reply with quote
Very nice!

I'm going to try to load this for my R8500.

Thank you for this, now I can blacklist large blocks of outbound traffic IPs and overcome IPTables limitations.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC 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 can attach files in this forum
You can download files in this forum