-
-
Notifications
You must be signed in to change notification settings - Fork 106
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 IPv6 Virtual DNS #462
base: main
Are you sure you want to change the base?
Changes from all commits
cb2858c
0aaad6a
d659bfb
c44f02c
da6ab9b
719b393
517fb4b
41a13ce
3f2f25c
7a1ed15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,7 +25,9 @@ configure_network () { | |||||
local gateway6="$8" | ||||||
local primary_dns="$9" | ||||||
local secondary_dns="${10}" | ||||||
local custom="${11}" | ||||||
local primary_dns6="${11}" | ||||||
local secondary_dns6="${12}" | ||||||
local custom="${13}" | ||||||
|
||||||
/sbin/ip -- address replace "$ip/$netmask" dev "$INTERFACE" | ||||||
if [[ "$custom" = false ]]; then | ||||||
|
@@ -64,16 +66,21 @@ configure_network () { | |||||
if [ -h /etc/resolv.conf ]; then | ||||||
rm -f /etc/resolv.conf | ||||||
fi | ||||||
echo > /etc/resolv.conf | ||||||
echo -n > /etc/resolv.conf | ||||||
if ! qsvc disable-dns-server ; then | ||||||
echo "nameserver $primary_dns" > /etc/resolv.conf | ||||||
if [ -n "$primary_dns6" ]; then | ||||||
echo "nameserver $primary_dns6" >> /etc/resolv.conf | ||||||
echo "nameserver $secondary_dns6" >> /etc/resolv.conf | ||||||
fi | ||||||
echo "nameserver $primary_dns" >> /etc/resolv.conf | ||||||
echo "nameserver $secondary_dns" >> /etc/resolv.conf | ||||||
fi | ||||||
fi | ||||||
if [ -x /usr/bin/resolvectl ] && \ | ||||||
systemctl is-enabled -q systemd-resolved.service && \ | ||||||
! qsvc disable-dns-server ; then | ||||||
resolvectl dns "$INTERFACE" "$primary_dns" "$secondary_dns" | ||||||
resolvectl dns "$INTERFACE" "$primary_dns6" "$secondary_dns6" \ | ||||||
"$primary_dns" "$secondary_dns" | ||||||
fi | ||||||
} | ||||||
|
||||||
|
@@ -88,7 +95,9 @@ configure_network_nm () { | |||||
local gateway6="$8" | ||||||
local primary_dns="$9" | ||||||
local secondary_dns="${10}" | ||||||
local custom="${11}" | ||||||
local primary_dns6="${11}" | ||||||
local secondary_dns6="${12}" | ||||||
local custom="${13}" | ||||||
|
||||||
local prefix | ||||||
local prefix6 | ||||||
|
@@ -119,6 +128,10 @@ __EOF__ | |||||
if ! qsvc disable-dns-server ; then | ||||||
ip4_nm_config="${ip4_nm_config} | ||||||
dns=${primary_dns};${secondary_dns}" | ||||||
if [ -n "$primary_dns6" ]; then | ||||||
ip6_nm_config="${ip6_nm_config} | ||||||
dns=${primary_dns6};${secondary_dns6}" | ||||||
fi | ||||||
fi | ||||||
if ! qsvc disable-default-route ; then | ||||||
ip4_nm_config="${ip4_nm_config} | ||||||
|
@@ -183,8 +196,21 @@ configure_qubes_ns() { | |||||
#netmask=$(qubesdb-read /qubes-netvm-netmask) | ||||||
primary_dns=$(qubesdb-read /qubes-netvm-primary-dns 2>/dev/null || echo "$gateway") | ||||||
secondary_dns=$(qubesdb-read /qubes-netvm-secondary-dns) | ||||||
echo "NS1=$primary_dns" > /var/run/qubes/qubes-ns | ||||||
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes-ns | ||||||
primary_dns6=$(qubesdb-read /qubes-netvm-primary-dns6 ||:) | ||||||
secondary_dns6=$(qubesdb-read /qubes-netvm-secondary-dns6 ||:) | ||||||
if [ -n "$primary_dns6" ]; then | ||||||
cat > /var/run/qubes/qubes-ns<< EOF | ||||||
NS1=$primary_dns6 | ||||||
NS1=$secondary_dns6 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
NS3=$primary_dns | ||||||
NS4=$secondary_dns | ||||||
EOF | ||||||
else | ||||||
cat > /var/run/qubes/qubes-ns<< EOF | ||||||
NS1=$primary_dns | ||||||
NS1=$secondary_dns | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
EOF | ||||||
fi | ||||||
/usr/lib/qubes/qubes-setup-dnat-to-ns | ||||||
} | ||||||
|
||||||
|
@@ -244,6 +270,8 @@ if [ "$ACTION" == "add" ]; then | |||||
|
||||||
primary_dns=$(/usr/bin/qubesdb-read /qubes-primary-dns 2>/dev/null) || primary_dns= | ||||||
secondary_dns=$(/usr/bin/qubesdb-read /qubes-secondary-dns 2>/dev/null) || secondary_dns= | ||||||
primary_dns6=$(/usr/bin/qubesdb-read /qubes-primary-dns6 2>/dev/null ||:) || primary_dns6= | ||||||
secondary_dns6=$(/usr/bin/qubesdb-read /qubes-secondary-dns6 2>/dev/null ||:) || secondary_dns6= | ||||||
/usr/lib/systemd/systemd-sysctl \ | ||||||
"--prefix=/net/ipv4/conf/all" \ | ||||||
"--prefix=/net/ipv4/neigh/all" \ | ||||||
|
@@ -257,9 +285,9 @@ if [ "$ACTION" == "add" ]; then | |||||
if [ -n "$ip4" ]; then | ||||||
# If NetworkManager is enabled, let it configure the network | ||||||
if qsvc network-manager && [ -e /usr/bin/nmcli ]; then | ||||||
configure_network_nm "$MAC" "$INTERFACE" "$ip4" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" "$custom" | ||||||
configure_network_nm "$MAC" "$INTERFACE" "$ip4" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" "$primary_dns6" "$secondary_dns6" "$custom" | ||||||
else | ||||||
configure_network "$MAC" "$INTERFACE" "$ip4" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" "$custom" | ||||||
configure_network "$MAC" "$INTERFACE" "$ip4" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" "$primary_dns6" "$secondary_dns6" "$custom" | ||||||
fi | ||||||
|
||||||
network=$(qubesdb-read /qubes-netvm-network 2>/dev/null) || network= | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,9 +19,22 @@ if [ "x$network" != "x" ]; then | |||||
#netmask=$(qubesdb-read /qubes-netvm-netmask) | ||||||
primary_dns=$(qubesdb-read /qubes-netvm-primary-dns 2>/dev/null || echo "$gateway") | ||||||
secondary_dns=$(qubesdb-read /qubes-netvm-secondary-dns) | ||||||
primary_dns6=$(qubesdb-read /qubes-netvm-primary-dns6 ||:) | ||||||
secondary_dns6=$(qubesdb-read /qubes-netvm-secondary-dns6 ||:) | ||||||
modprobe netbk 2> /dev/null || modprobe xen-netback || "${modprobe_fail_cmd}" | ||||||
echo "NS1=$primary_dns" > /var/run/qubes/qubes-ns | ||||||
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes-ns | ||||||
if [ -n "$primary_dns6" ]; then | ||||||
cat > /var/run/qubes/qubes-ns<< EOF | ||||||
NS1=$primary_dns6 | ||||||
NS1=$secondary_dns6 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
NS3=$primary_dns | ||||||
NS4=$secondary_dns | ||||||
EOF | ||||||
else | ||||||
cat > /var/run/qubes/qubes-ns<< EOF | ||||||
NS1=$primary_dns | ||||||
NS1=$secondary_dns | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
EOF | ||||||
fi | ||||||
/usr/lib/qubes/qubes-setup-dnat-to-ns | ||||||
echo "1" > /proc/sys/net/ipv4/ip_forward | ||||||
# enable also IPv6 forwarding, if IPv6 is enabled | ||||||
|
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.
for consistency?