-
Notifications
You must be signed in to change notification settings - Fork 261
Support different ipv6 network device in network-tunnel-manager.sh #6255
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
base: feat/operators/ntm-upgrades
Are you sure you want to change the base?
Conversation
|
@heri16 is attempting to deploy a commit to the nyx-network Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for making this first PR |
|
Hey, it looks good. Thank you for your PR. Please redirect it from This var is used here: If you want you can toggle that too, otherwise I will fix that one |
|
For the record: nonroot@localhost:~$ ip -6 -o route show default
default dev eth1.1 proto static metric 1024 pref medium |
Should we have:
Also, I've found another issue with the |
…dge_deployment.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review latest changes to this PR.
|
I would prefer this one as the program should ask minimum from the operator
If that issue on QUIC connects to this interface, feel free to add it to this PR. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Done. Please review and merge. @serinko @mfahampshire |
| local dev | ||
|
|
||
| dev="$(eval "$cmd" 2>/dev/null | awk '{print $5}' | head -n1 || true)" | ||
| ip="$(getent ahosts${1//-/v} "$host" 2>/dev/null | awk '$2=="STREAM" {print $1}' | head -n1 || true)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work?
Imo it returns: getent ahostsv4 "$host" I would expect you want some of this syntax to be returned:
getent ahosts -4 "$host"
# or
getent ahosts -6 "$host"
Hence smth like:
detect_uplink_interface() {
local aflag="$1" # -4 or -6
local host="$2"
local ip dev
# Resolve host to IP for the requested address family
ip="$(getent ahosts "$host" "$aflag" 2>/dev/null | awk '$2=="STREAM" {print $1}' | head -n1 || true)"
if [[ -z "$ip" ]]; then
return 1
fi
# Find which interface would be used to reach that IP
dev="$(ip "$aflag" -o route get "$ip" 2>/dev/null | awk '{print $5}' | head -n1 || true)"
if [[ -n "$dev" && "$dev" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "$dev"
return 0
fi
return 1
}
and later on
# uplink device detection, can be overridden
IPV4_UPLINK_DEV="${IPV4_UPLINK_DEV:-}"
if [[ -z "$IPV4_UPLINK_DEV" ]]; then
IPV4_UPLINK_DEV="$(detect_uplink_interface -4 "ifconfig.co" || true)"
fi
if [[ -z "$IPV4_UPLINK_DEV" ]]; then
error "cannot determine ipv4 uplink interface. set IPV4_UPLINK_DEV"
exit 1
fi
IPV6_UPLINK_DEV="${IPV6_UPLINK_DEV:-}"
if [[ -z "$IPV6_UPLINK_DEV" ]]; then
IPV6_UPLINK_DEV="$(detect_uplink_interface -6 "ifconfig.co" || true)"
fi
if [[ -z "$IPV6_UPLINK_DEV" ]]; then
error "cannot determine ipv6 uplink interface. set IPV6_UPLINK_DEV"
exit 1
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's tested to be working.
It's either getent ahostsv4 or getent ahostsv6.
See:
nonroot@nymExitNode:~$ getent ahosts -4 "proof.ovh.net"
getent: invalid option -- '4'
Try `getent --help' or `getent --usage' for more information.
nonroot@nymExitNode:~$ getent ahostsv4 "proof.ovh.net"
141.95.207.211 STREAM proof.ovh.net
141.95.207.211 DGRAM
141.95.207.211 RAW| } | ||
|
|
||
| fetch_and_display_ipv6() { | ||
| local ipv6_address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you have time to test this if in case of ip4 and ipv6 devices == it prints the correct stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've tested it. fetch_and_display_ipv6 only prints ipv6 address as it should.
See:
nonroot@nymExitNode:~$ sudo ./network-tunnel-manager.sh fetch_and_display_ipv6
----- 2025-12-11 01:27:00 START network-tunnel-manager -----
Logs are being saved locally to: /var/log/nym/network_tunnel_manager.log
These logs never leave your machine.
[2025-12-11 01:27:00] COMMAND: fetch_and_display_ipv6 ARGS: fetch_and_display_ipv6
[OK] ipv6 address on eth0.2: 2a07:b944::2:2/128
Logs saved locally at: /var/log/nym/network_tunnel_manager.log
[OK] operation fetch_and_display_ipv6 completed|
I looked at it and it looks good, though there are two comments. Then I need to test it, which I will only get to after Ansible playbooks out and implementation of NIP-4,5&6. I would expect it in production after new year. |
|
Updated code applying feedback from comments. Ready for review. @serinko @mfahampshire |
On many VPS providers, the IPv4 uplink network interface is eth0, while the IPv6 uplink may be on a different interface (e.g., eth1 or another device).
This PR:
NETWORK_DEVICEtoIPV4_UPLINK_DEVandIPV6_UPLINK_DEV--uplink-dev-v6This change is