persistent static route with mtu lock

Issues related to configuring your network
Post Reply
hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

persistent static route with mtu lock

Post by hunter86_bg » 2018/11/23 19:24:11

Hi Community,

I'm trying to persist the following route:

Code: Select all

#ip route add 192.168.1.0/24 dev ens192 via 10.1.2.1 mtu lock 1438
#ip route
192.168.1.0/24 via 10.1.2.1 dev ens192 mtu lock 1438
The reason is that everything in 192.168.1.0/24 is behind an IPSEC tunnel and I want to avoid pre-fragmentation on this side of the tunnel.
According to documentation I have set a configuration file like this , but it doesn't work:

Code: Select all

#cat /etc/sysconfig/network-scripts/route-ens192 
ADDRESS0=192.168.1.0
NETMASK0=255.255.255.0
GATEWAY0=10.1.2.1
OPTIONS0="mtu 1438"
Anyone having an idea?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: persistent static route with mtu lock

Post by TrevorH » 2018/11/23 20:28:26

Make your route-$interface file read

Code: Select all

192.168.1.0/24 via 10.1.2.1 mtu lock 1438
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: persistent static route with mtu lock

Post by hunter86_bg » 2018/11/23 20:54:59

TrevorH wrote:
2018/11/23 20:28:26
Make your route-$interface file read

Code: Select all

192.168.1.0/24 via 10.1.2.1 mtu lock 1438
Doesn't work for me - no route entry at all.
The only working solution so far is to create the following:

Code: Select all

[root@host network-scripts]# ll /etc/NetworkManager/dispatcher.d/99-static_with_mtu 
-rwxr-xr-x. 1 root root 162 23 ное 22,55 /etc/NetworkManager/dispatcher.d/99-static_with_mtu
[root@host network-scripts]# cat /etc/NetworkManager/dispatcher.d/99-static_with_mtu 
#!/bin/bash
if [ ${CONNECTION_UUID}==1024ed04-dd45-45bf-99a9-bad8f04421ae ] 
then 
/usr/sbin/ip route add 192.168.1.0/24 via 10.1.2.1 dev ens192 mtu lock 1438
fi
Sadly, I'm not very convinced that after an update it won't be wiped.
Any ideas ?

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: persistent static route with mtu lock

Post by hunter86_bg » 2018/11/25 16:06:37

It seems that this one works OK:

Code: Select all

# nmcli connection modify ens192 +ipv4.routes "192.168.1.0/24  10.1.2.1 lock-mtu=true mtu=1438"

#ip route
...
192.168.1.0/24 via 10.1.2.1 dev ens192 proto static metric 100 mtu lock 1438
...

Post Reply