#1005862 apt: Feature request - apt-get Source IP

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Joe Botha
Date:
2025-05-04 10:30:01 UTC
Severity:
wishlist
Tags:
#1005862#5
Date:
2022-02-16 08:42:57 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

I use Debian on a server with multiple upstream internet links. Some of these links have peering point IPs.

It happens fairly often that apt-get traffic uses the source IP in a peering point range and then downloads fail.

Please consider adding a feature so I can configure apt-get to specify a source IP or interface on the server.

For example: traceroute has a -s option: "Chooses  an alternative source address."

#1005862#10
Date:
2022-02-16 09:11:03 UTC
From:
To:
I was about to say that specifying ip addresses for sources needs to be
solved at an RFC level (need to standardize URLs like http://foo[ip]/),
but um now I understand that you don't want to configure the IP of the
source, but the interface we send packets from.

Probably should be retitled with a less ambiguous title :D

Anyway, no idea how complex that feature is, I guess proof of
concept patches welcome.

#1005862#15
Date:
2022-02-16 09:24:01 UTC
From:
To:
Hi

Yes, sorry, should maybe have had title with Source _IP_address_

I think you should be able to specify a source IP when opening the tcp socket.

Would probably need to add some code for IPv4 and IPv6 cases.

#1005862#20
Date:
2022-02-16 09:59:32 UTC
From:
To:
It's basically a new configuration option for apt.conf and an additional
parameter in the connect() call. See https://github.com/ThomasNoll/oas
(that's a LD_PRELOAD wrapper adding this functionality to arbitrary
software, see connect.c)

Greetings
Marc

#1005862#25
Date:
2022-02-16 15:37:18 UTC
From:
To:
Hi

I figured out a temporary workaround using ‘ip netns exec’

It works, but things like apticron will still fail.

#1005862#30
Date:
2025-05-04 10:21:10 UTC
From:
To:
Hi!

This ticket probably should be merged with
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548590, but I'm not
100% sure.

Kamil