LinuxQuestions.org
Review your favorite Linux distribution.
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 09-11-2019, 08:41 PM   #1
djlightman
LQ Newbie
 
Registered: Jul 2003
Posts: 6

Rep: Reputation: 0
Question Policy Based Routing and Default Gateway disappearing


Hi all,

I have a problem that has me baffled.

I have several Ubuntu 18.04.02 LTS Virtual machines that all use policy based routing. The are all on the same networks same 2 internet connections etc.

The problem I have is that randomly the default gateway disappears. The PBR tables are still there but the gateway goes bye bye. So incoming traffic is ok but default outgoing traffic dies.

Here are some details

root@WWW-1:/# ip rule list
0: from all lookup local
32762: from 10.11.11.204 lookup FW1
32763: from 10.10.11.204 lookup LAN1
32764: from 10.11.10.204 lookup FW2
32765: from 10.10.10.204 lookup LAN2
32766: from all lookup main
32767: from all lookup default


root@WWW-1:/# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 ens160
10.10.11.0 0.0.0.0 255.255.255.0 U 0 0 0 ens192
10.11.10.0 0.0.0.0 255.255.255.0 U 0 0 0 ens224
10.11.11.0 0.0.0.0 255.255.255.0 U 0 0 0 ens256

Script in crontab to build PBR on bootup

@reboot root /etc/scripts/routing

Script

#!/bin/bash

ip route add 10.10.10.0/24 dev ens160 src 10.10.10.204 table LAN2
ip route add default via 10.10.10.1 table LAN2

ip route add 10.11.10.0/24 dev ens224 src 10.11.10.204 table FW2
ip route add default via 10.11.10.1 table FW2

ip route add 10.10.11.0/24 dev ens192 src 10.10.11.204 table LAN1
ip route add default via 10.10.11.3 table LAN1

ip route add 10.11.11.0/24 dev ens256 src 10.11.11.204 table FW1
ip route add default via 10.11.11.3 table FW1

ip route add 10.10.10.0/24 dev ens160 src 10.10.10.204
ip route add 10.11.10.0/24 dev ens224 src 10.11.10.204

ip route add 10.10.11.0/24 dev ens192 src 10.10.11.204
ip route add 10.11.11.0/24 dev ens256 src 10.11.11.204

ip rule add from 10.10.10.204 table LAN2
ip rule add from 10.11.10.204 table FW2

ip rule add from 10.10.11.204 table LAN1
ip rule add from 10.11.11.204 table FW1

ip route add default via 10.11.10.1


Lastly - There is no default gateway set in the netplan config.

If I reboot or if I put the gateway back in manually everything looks ok..

WWW-1:/# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.11.10.1 0.0.0.0 UG 0 0 0 ens224
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 ens160
10.10.11.0 0.0.0.0 255.255.255.0 U 0 0 0 ens192
10.11.10.0 0.0.0.0 255.255.255.0 U 0 0 0 ens224
10.11.11.0 0.0.0.0 255.255.255.0 U 0 0 0 ens256



Does anyone have any ideas why this would happen ? sometimes it's good for months sometimes not.
 
Old Yesterday, 02:19 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,716

Rep: Reputation: 143Reputation: 143
How many default gateway do you have, each table has default gateway or just one table has one gateway?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
routing protocol based on based geo -cast routing in vehicular ad hoc netwok Adaramola ojo jayeola Linux - Wireless Networking 1 06-02-2016 08:53 AM
Mutiple IPs and network cards routing (source policy routing?) shogun1234 Linux - Networking 1 01-17-2013 12:09 AM
Port-policy based routing, not a gateway murmel Linux - Networking 0 09-13-2009 09:16 PM
Samba System Policy, Default User Policy scooter549 Linux - General 2 02-24-2009 02:23 AM

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

All times are GMT -5. The time now is 12:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration