Networking problems: 2 interfaces with 2 gateways, seperated routing tables not working as expected

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















I have a server, running Ubuntu 16.04.5 LTS with 2 IP addresses on 2 nics:



eth0: 192.168.1.5/24, gw 192.168.1.1 
eth1: 192.168.2.5/24, gw 192.168.2.1


As I searched here and on Google, in order to make this work I created a second routing table for eth1, which I added the following:



/etc/iproute2/rt_tables:



1 rt2


/etc/network/interfaces:



post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.2.5 table rt2 
post-up ip route add default via 192.168.2.1 dev eth1 table rt2
post-up ip rule add from 192.168.2.5/32 table rt2
post-up ip rule add to 192.168.2.5/32 table rt2


I have a pc, which is also connected to 192.168.2.0/24, it has the IP 192.168.2.7.
The problem now is, I cannot reach the server with 192.168.1.5 from my pc.
I ran tcpdump on the server and I know the packet is coming in, but nothing is sent back and no packet is dropped.



I need that 192.168.1.5 is also reachable from my pc.



Update 1:



I made a mistake in posting the config here, I updated the last 2 post-up definitions, it should be rule instead of route.(Thx, A.B.)
Secondly, I changed the last sentence, as it was a bit misunderstanding.










share|improve this question
























  • 1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

    – A.B
    Feb 6 at 18:26











  • No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

    – ash
    Feb 7 at 9:53















0















I have a server, running Ubuntu 16.04.5 LTS with 2 IP addresses on 2 nics:



eth0: 192.168.1.5/24, gw 192.168.1.1 
eth1: 192.168.2.5/24, gw 192.168.2.1


As I searched here and on Google, in order to make this work I created a second routing table for eth1, which I added the following:



/etc/iproute2/rt_tables:



1 rt2


/etc/network/interfaces:



post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.2.5 table rt2 
post-up ip route add default via 192.168.2.1 dev eth1 table rt2
post-up ip rule add from 192.168.2.5/32 table rt2
post-up ip rule add to 192.168.2.5/32 table rt2


I have a pc, which is also connected to 192.168.2.0/24, it has the IP 192.168.2.7.
The problem now is, I cannot reach the server with 192.168.1.5 from my pc.
I ran tcpdump on the server and I know the packet is coming in, but nothing is sent back and no packet is dropped.



I need that 192.168.1.5 is also reachable from my pc.



Update 1:



I made a mistake in posting the config here, I updated the last 2 post-up definitions, it should be rule instead of route.(Thx, A.B.)
Secondly, I changed the last sentence, as it was a bit misunderstanding.










share|improve this question
























  • 1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

    – A.B
    Feb 6 at 18:26











  • No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

    – ash
    Feb 7 at 9:53













0












0








0








I have a server, running Ubuntu 16.04.5 LTS with 2 IP addresses on 2 nics:



eth0: 192.168.1.5/24, gw 192.168.1.1 
eth1: 192.168.2.5/24, gw 192.168.2.1


As I searched here and on Google, in order to make this work I created a second routing table for eth1, which I added the following:



/etc/iproute2/rt_tables:



1 rt2


/etc/network/interfaces:



post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.2.5 table rt2 
post-up ip route add default via 192.168.2.1 dev eth1 table rt2
post-up ip rule add from 192.168.2.5/32 table rt2
post-up ip rule add to 192.168.2.5/32 table rt2


I have a pc, which is also connected to 192.168.2.0/24, it has the IP 192.168.2.7.
The problem now is, I cannot reach the server with 192.168.1.5 from my pc.
I ran tcpdump on the server and I know the packet is coming in, but nothing is sent back and no packet is dropped.



I need that 192.168.1.5 is also reachable from my pc.



Update 1:



I made a mistake in posting the config here, I updated the last 2 post-up definitions, it should be rule instead of route.(Thx, A.B.)
Secondly, I changed the last sentence, as it was a bit misunderstanding.










share|improve this question
















I have a server, running Ubuntu 16.04.5 LTS with 2 IP addresses on 2 nics:



eth0: 192.168.1.5/24, gw 192.168.1.1 
eth1: 192.168.2.5/24, gw 192.168.2.1


As I searched here and on Google, in order to make this work I created a second routing table for eth1, which I added the following:



/etc/iproute2/rt_tables:



1 rt2


/etc/network/interfaces:



post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.2.5 table rt2 
post-up ip route add default via 192.168.2.1 dev eth1 table rt2
post-up ip rule add from 192.168.2.5/32 table rt2
post-up ip rule add to 192.168.2.5/32 table rt2


I have a pc, which is also connected to 192.168.2.0/24, it has the IP 192.168.2.7.
The problem now is, I cannot reach the server with 192.168.1.5 from my pc.
I ran tcpdump on the server and I know the packet is coming in, but nothing is sent back and no packet is dropped.



I need that 192.168.1.5 is also reachable from my pc.



Update 1:



I made a mistake in posting the config here, I updated the last 2 post-up definitions, it should be rule instead of route.(Thx, A.B.)
Secondly, I changed the last sentence, as it was a bit misunderstanding.







linux ubuntu networking routing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 7 at 10:11







ash

















asked Feb 6 at 10:23









ashash

11




11












  • 1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

    – A.B
    Feb 6 at 18:26











  • No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

    – ash
    Feb 7 at 9:53

















  • 1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

    – A.B
    Feb 6 at 18:26











  • No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

    – ash
    Feb 7 at 9:53
















1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

– A.B
Feb 6 at 18:26





1st clarification: "via my pc": is the intention that your pc is a gateway (ie a router) between those two networks for other systems on 192.168.2.0/24 ? 2nd clarification: adding a routing table has no effect without adding a rule telling to use this routing table. I see no ip rule anywhere

– A.B
Feb 6 at 18:26













No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

– ash
Feb 7 at 9:53





No my pc shouldn't be a gateway, the pc has 192.168.2.7, the gateway is 192.168.2.1.

– ash
Feb 7 at 9:53










0






active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499012%2fnetworking-problems-2-interfaces-with-2-gateways-seperated-routing-tables-not%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499012%2fnetworking-problems-2-interfaces-with-2-gateways-seperated-routing-tables-not%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?