-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for BIB entries with dynamic IPv4 addresses #304
Comments
Are you aware of this? |
No I wasn't! |
It cannot be done as currently implemented, but if it's a legitimate use case I could add support for it. But how are you expecting port forwarding to work? If your IPv4 address changes constantly, how is your IPv4 client supposed to know it? |
By the way: I'm not entirely sure, but from a quick Google search it seems OpenWRT uses init.d. We already have init scripts for Jool, in case you want to reuse them: (They might need some adjustments, such as binary paths) |
For the outside connection I use a dynamic DNS, so clients never lose access.
As for the scripts you provided, they use some functions I really have no idea of what they are like for example |
Ok, but just to understand this a little better: Are these connections supposed to survive the address change? Do the clients open new connections when the address changes? Or do these clients somehow modify their socket addresses so as to avoid repeating the TCP handshake? |
OpenWRT just need to have the commands necessary to the start of the package, if it can check some stuff before starting, ok, but it's not mandatory. I'm going to be pushing it to a temporary branch in my forked packages repository, check it out if you want! 😄
You're asking hard questions, I want my server to serve a nextcloud instance to the outside, it's rarely going to be used, but I belive OpenWRT would keep the connection open even after the IP changed, so if the address changes the client would continue to communicate with the new address (?) I believe at least. |
As far as I know, a connection (whether TCP or UDP) is invariably identified by its IP addresses and ports. If you change one address, then the connection breaks and needs to be re-established from scratch. (Unless I'm missing some strange hack.) And if that's what you expect to happen, then I think it would be most elegant if the dynamic DNS informed Jool of the new address every time it's changed (by updating the BIB and perhaps pool4 as well). I mean Jool could theoretically monitor the address and respond appropriately whenever it changes, but I feel like this wouldn't be optimal or terribly reliable. What do you think? |
I see what you mean, sorry for the delay answering but shchool's been hard ahaha. So for me, there just needs to be a simple port-forwarding system that redirects connections coming form the WAN address to some specified LAN address. Also, on another note, what do you think of this? Did I do it right? |
Ok. My prediction is that this will look something like
I can't think of any problems with this idea (other than what I expect is going to be a horrifyingly messy implementation) but I'll keep thinking.
Your sample configuration files are going to create a lot of problems for careless users who trust their defaults to be reasonable. I don't think anyone should enable If you want to include every configuration option for the sake of easy modification it's fine, but you should probably use Jool's default values instead of random ones. |
That seems about right
I can just add default configuration files all commented out and let people fill it. What do you think? |
Agreed. |
Ok, I'll get to it. Where can I get the default configuration files? |
The defaults values are hardcoded:
https://github.com/NICMx/Jool/blob/master/src/common/constants.h#L66
You can also find them here: https://jool.mx/en/usr-flags-global.html
…On Sun, Dec 22, 2019 at 7:14 PM Tiago Gaspar ***@***.***> wrote:
Ok, I'll get to it. Where can I get the default configuration files?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#304?email_source=notifications&email_token=AASHNF5WKHDBDMRPV7H3Q2LQ2AGIPA5CNFSM4JJXVTD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHP6OTY#issuecomment-568321871>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASHNFZJ62YTB34YYD2GZJ3Q2AGIPANCNFSM4JJXVTDQ>
.
|
Oh god. |
Well after a bit of research, JSON doesn't support comments, so I have decided to switch the "manually-enabled" option to enabled, that way jool won't start unless this is set to disabled, right? |
You can therefore group sample fields in comment tags, and Jool should ignore them:
(Disclaimer: Untested, but you should get the general idea.) |
(Although, for the record, I still think you should include sensible default values. |
I think that if "manually-enabled" makes jool not start it is the best way to not screw things up while leaving the configuration files clean and "simple", right? If you agree with me as soon as I'm ready I'll show you the final commit |
Hmm... I think there's some sort of language barrier getting in the way of our conversation. I will try to be as clear as I can:
My opinion is that As currently implemented, Therefore, you don't need to include And if you do want to list every configuration option, my opinion is that you should not change the default values, because their current defaults make the most sense in the vast majority of production environments. Therefore, my opinion is that you should include the following global defaults for NAT64:
and the following global defaults for SIIT:
(Actually, SIIT is a bit of a lost cause, because we can't provide a pool6 that will always work—users always need to define it according to their network. But this is as complete as it can be.) Or you can just do what I do with the Debian package, which is keep the sample configuration as minimalist as possible. (Because I'm assuming that most users will not want to modify the global values.) |
I see what you mean and maybe I'm not explaining myself correctly. Let's assume that I leave the default configurations (witch I intend to) including manually-enabled as true. The alternatives we have:
See what I mean? I hope I'm explaining myself correctly.😅😅😅 |
Ah, I see.
Well, perhaps one problem with this is that OpenWRT will think the service is enabled, even though Jool is technically disabled. It's going to look confusing, I think.
What I do in Debian is not provide default configuration files, and this naturally prevents the service from starting. (This is partly because I have access to a thing called I actually do provide sample configuration files in Debian, but I do so in the dedicated example directory ( |
I see what you mean, but people usually configure stuff, not using the default value. But I can add a "verification" that checks if the flag manually-enables is off and display a info reminder in the syslog.
Well, what kind of error? does it say "file /etc/jool/jool.conf.json not found"? or just says invalid file? Also, in a recent test I ran into an issue:
Do you have any idea? |
You installed |
|
If that is the case We can do this: I'll leave a file with the default values named for example "jool_nat64.conf.json.defaults" that way when the program goes searching for the "jool_nat64.conf.json" file it won't find it, and won't run, leaving a entry in the syslog. I'll see if I can find a way for the start script to check for the file first and display a error message that I write. Do you agree?
AHA! That's why. the makefile doesn't foresee that third kernel module I believe. I'll get around to that. |
Yes, absolutely. |
Hey! I haven't forgotten about this issue, I just haven't been doing more cause I saw that @blocktronn has been working on the jool init and even uci configuration in his branch https://github.com/blocktrron/packages/tree/jool-init . |
Couldn't this be simply a hook that rebuilds the BIB on changes to the WAN interface?
|
Ok, I tested and it works perfectly fine. Here's a ready-made openwrt solution. # install jool BIB update script
cat <<'EOF' > /etc/hotplug.d/iface/99-jool-bib
test "$INTERFACE" != wan4 -o "$ACTION" != "ifup" && exit 0
service jool restart
EOF
# configure stateful NAT64
cat <<'EOF' > /etc/jool/jool-nat64.conf.json.in
{
"instance": "default",
"framework": "netfilter",
"global": { "pool6": "64:ff9b::/96" },
"bib": [
{
"comment": "Forward WAN_ADDR:80 -> 2001:db8::1:80",
"protocol": "TCP",
"ipv4 address": "WAN_ADDR#80",
"ipv6 address": "2001:db8::1#80"
},
}
EOF
# patch init.d script to compute the WAN address
grep -q BIB /etc/init.d/jool || sed -i '/config_parser()/{
i splice_config() {
i \ # get WAN IPv4 address
i \ . /lib/functions/network.sh
i \ network_get_ipaddr WAN_ADDR wan4
i
i \ # update the BIB
i \ sed "s/WAN_ADDR/$WAN_ADDR/g" "$CONFIGFILE_NAT64.in" > "$CONFIGFILE_NAT64"
i }
i
}
/start()/{
a \ splice_config
}' /etc/init.d/jool
service jool restart |
Hey Everyone!
It's just a suggestion but could we add a way to configure jool from a file, using uci or some other type of file configuration?
Thanks!
The text was updated successfully, but these errors were encountered: