LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-13-2024, 06:31 AM   #1
Saule2006
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Rep: Reputation: 0
Server with 2 WAN interfaces


Hi
I have ubuntu server with 2 WAN interfaces - 2 ISP. If request comes to ISP1 the answer is delivered through WAN1. Same with ISP2 - incoming requests to WAN2 are routed back through WAN2. So WAN1 is for ISP1, and WAN2 is for ISP2. Everything works well until one condition. If the request comes to WAN1 from the IP which belongs to ISP2 subnet, the answer do not come from WAN1, but from WAN2 (ISP2). Same happens if the request comes to WAN2 (ISP2), but the client IP belongs to ISP1 subnet, the server tries to deliver the answer through WAN1, not WAN2 as it should be. How I can change this?
 
Old 02-13-2024, 07:04 AM   #2
C4H7Cl2O4P
LQ Newbie
 
Registered: Feb 2024
Posts: 5

Rep: Reputation: 0
Quote:
Originally Posted by Saule2006 View Post
If the request comes to WAN1 from the IP which belongs to ISP2 subnet, the answer do not come from WAN1, but from WAN2 (ISP2). Same happens if the request comes to WAN2 (ISP2), but the client IP belongs to ISP1 subnet, the server tries to deliver the answer through WAN1, not WAN2 as it should be. How I can change this?
How do you know that ? Could you provide some more detailed information - commands, replies ?
 
Old 02-13-2024, 08:11 AM   #3
Saule2006
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by C4H7Cl2O4P View Post
How do you know that ? Could you provide some more detailed information - commands, replies ?
I know, because it is happening like I described. The ISP1 do not answer to IP that is from ISP2 subnet and ISP2 do not answer to IP that is from ISP1 subnet.
 
Old 02-13-2024, 08:35 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Saule2006 View Post
Hi
I have ubuntu server with 2 WAN interfaces - 2 ISP. If request comes to ISP1 the answer is delivered through WAN1. Same with ISP2 - incoming requests to WAN2 are routed back through WAN2. So WAN1 is for ISP1, and WAN2 is for ISP2. Everything works well until one condition. If the request comes to WAN1 from the IP which belongs to ISP2 subnet, the answer do not come from WAN1, but from WAN2 (ISP2). Same happens if the request comes to WAN2 (ISP2), but the client IP belongs to ISP1 subnet, the server tries to deliver the answer through WAN1, not WAN2 as it should be. How I can change this?
Without knowing more, the short answer is this is a routing issue. So, add/change your routes. You've only told us "ubuntu server", and nothing else.
 
Old 02-13-2024, 09:50 AM   #5
Saule2006
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Original Poster
Rep: Reputation: 0
root@server:/# ip route
65.65.128.0/18 dev em4 proto kernel scope link src 65.65.141.40
65.65.191.254 dev em4 scope link src 65.65.141.40
85.85.188.0/22 dev em1 proto kernel scope link src 85.85.191.157
85.85.191.254 dev em1 scope link src 85.85.191.157
192.168.1.0/24 dev em2 proto kernel scope link src 192.168.1.55

root@server:/# ip rule
0: from all lookup local
999: from all lookup main
10000: from all fwmark 0x65/0xff lookup ISP1
10002: from all fwmark 0x67/0xff lookup ISP2
20000: from 85.85.191.157 lookup ISP1
20000: from 65.65.141.40 lookup ISP2
32765: from all lookup balance
32767: from all lookup default

root@server:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
65.65.128.0 0.0.0.0 255.255.192.0 U 0 0 0 em4
65.65.191.254 0.0.0.0 255.255.255.255 UH 0 0 0 em4
85.85.188.0 0.0.0.0 255.255.252.0 U 0 0 0 em1
85.85.191.254 0.0.0.0 255.255.255.255 UH 0 0 0 em1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 em2


File: /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
250 balance
0 unspec
#
# local
#
1 ISP1
3 ISP2

Last edited by Saule2006; 02-13-2024 at 09:54 AM.
 
Old 02-13-2024, 09:56 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Saule2006 View Post
root@server:/# ip route
65.65.128.0/18 dev em4 proto kernel scope link src 65.65.141.40
65.65.191.254 dev em4 scope link src 65.65.141.40
85.85.188.0/22 dev em1 proto kernel scope link src 85.85.191.157
85.85.191.254 dev em1 scope link src 85.85.191.157
192.168.1.0/24 dev em2 proto kernel scope link src 192.168.1.55

root@server:/# ip rule
0: from all lookup local
999: from all lookup main
10000: from all fwmark 0x65/0xff lookup ISP1
10002: from all fwmark 0x67/0xff lookup ISP2
20000: from 85.85.191.157 lookup ISP1
20000: from 65.65.141.40 lookup ISP2
32765: from all lookup balance
32767: from all lookup default

root@server:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
65.65.128.0 0.0.0.0 255.255.192.0 U 0 0 0 em4
65.65.191.254 0.0.0.0 255.255.255.255 UH 0 0 0 em4
85.85.188.0 0.0.0.0 255.255.252.0 U 0 0 0 em1
85.85.191.254 0.0.0.0 255.255.255.255 UH 0 0 0 em1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 em2


File: /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
250 balance
0 unspec
#
# local
#
1 ISP1
3 ISP2
Ok, again...need actual information. You posted these things with (again) no context, told us anything past "ubuntu server" (how about the version??) What program(s)/application(s) are handling these requests, what the requests actually ARE, etc. We have zero idea past very broad strokes on what to tell you since there is no information to work with.
 
Old 02-13-2024, 10:12 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,861

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
If the request comes to WAN1 from the IP which belongs to ISP2 subnet, the answer do not come from WAN1, but from WAN2 (ISP2).
Would be nice to explain it. Give us more details. Or an example.
It was the very first question: how do you know that?
 
Old 02-13-2024, 01:49 PM   #8
C4H7Cl2O4P
LQ Newbie
 
Registered: Feb 2024
Posts: 5

Rep: Reputation: 0
Quote:
Originally Posted by Saule2006 View Post
I know, because it is happening like I described. The ISP1 do not answer to IP that is from ISP2 subnet and ISP2 do not answer to IP that is from ISP1 subnet.
Could you provide us traceroute reply how "...the answer do not come from WAN1, but from WAN2 (ISP2)" and "...the server tries to deliver the answer through WAN1, not WAN2 as it should be" ?
 
Old 02-15-2024, 07:58 AM   #9
Saule2006
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Original Poster
Rep: Reputation: 0
It is not easy to show it. Simply believe me how it works. The request from ISP2 subnet comes to WAN1(ISP1), the server routes the answer not bock to the WAN1, but to the WAN2(ISP2), because there is no answer to client. I suppose the server thinks that this request came from WAN2(ISP2) or default routing tables are working. If the request to the WAN1(ISP1) comes not from ISP2 subnet, everything works fine - iproutes2 tables routes the answer back to the WAN1.
Another example. The default (with max weight) gateway is WAN1. All "ip route get <IP>" goes through WAN1(ISP1) gateway. But if I try to get the route to the IP which belongs to the ISP2 subnet, the server offers WAN2(ISP2) gateway. So I think the server routes all the incoming requests via WAN ports in same way.
 
Old 02-15-2024, 10:25 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Saule2006 View Post
It is not easy to show it. Simply believe me how it works. The request from ISP2 subnet comes to WAN1(ISP1), the server routes the answer not bock to the WAN1, but to the WAN2(ISP2), because there is no answer to client. I suppose the server thinks that this request came from WAN2(ISP2) or default routing tables are working. If the request to the WAN1(ISP1) comes not from ISP2 subnet, everything works fine - iproutes2 tables routes the answer back to the WAN1.
Another example. The default (with max weight) gateway is WAN1. All "ip route get <IP>" goes through WAN1(ISP1) gateway. But if I try to get the route to the IP which belongs to the ISP2 subnet, the server offers WAN2(ISP2) gateway. So I think the server routes all the incoming requests via WAN ports in same way.
And you *STILL* don't answer any of the questions asked. Restating it doesn't offer more information.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Dual wan ip tables. One wan is abysmally slow. jmgibson1981 Linux - Networking 14 05-22-2021 05:03 PM
[SOLVED] OPNSense. Multi WAN, force one local ip to specific wan. jmgibson1981 Linux - Networking 1 02-14-2021 06:12 PM
Multiple WAN interfaces (FreeBSD Firewall) mxk *BSD 4 03-17-2005 11:21 AM
FreeS/Wan Vs. OpenS/Wan Vs. StrongS/Wan bkankur Linux - Security 1 03-01-2005 09:27 AM
WAN : unable to ping to WAN ckl Linux - Networking 0 11-18-2004 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration