How to change the default source IP address to be something other than the address facing the default route?
3
votes
2
answers
7274
views
**Background Information**
* I'm using a Linux system to route traffic for a small block of public IPv4 addresses (by enabling IP forwarding in
sysctrl.conf
).
* The router is connecting to the ISP over eth1
using PPPoE.
* The local peer address used for ppp is a manually-configured IP address that was specified by the ISP. The local peer address is 10.0.0.10
.
* The remote peer address used for ppp is also a manually-configured IP address that was specified by the ISP. The remote peer address is 10.0.0.9
.
* The router's default route is 10.0.0.9
via 10.0.0.10
.
* The router is connected to an Ethernet switch via eth0
. eth0
is configured to use one of the public addresses.
* The switch connects all other public hosts. Each connected host uses a public IP address.
10.0.0.9
ISP ----------+
| 10.0.0.10 X.X.X.X
+------------- (eth1) ROUTER (eth0) --------------- SWTICH
|
+-- X.X.X.Y
+-- X.X.X.Z
...
**My Problem**
Everything works as expected except for programs running on the router. Any application that I run on the router uses 10.0.0.10
as the source IP address when initiating connections to the internet. This is understandable since eth1
is where the internet is available. However, because the address is not publicly routable, apt
, ping
, and other programs don't work. If I explicitly set the source address on applications that support it (i.e. ping
), applications do work.
**My Question**
How can I configure the router to route unknown packets via eth1
/10.0.0.9
while also using the public IP address on eth0
as the default source when initiating new connections?
Asked by Tenders McChiken
(1319 rep)
Mar 9, 2020, 12:17 PM
Last activity: Mar 27, 2024, 09:07 PM
Last activity: Mar 27, 2024, 09:07 PM