public internet <router> LAN <CentOS8 VM with local IP and routed public IP>
Router is OPNsense in HA with CARP IP: 172.16.128.1/22 (.2 for master .3 for slave).
CentOS8 VM LAN IP 172.16.128.10.
On router I added route 172.31.4.101/32 -> 172.16.128.10 and on CentOS 8 VM I added "ip route add default via 172.16.128.1 dev ens18 src 172.31.4.101"
I was able to SSH to 172.31.4.101 and also if I ping from CentOS 8, on router I see that packets are going from correct IP (172.31.4.101)
I am testing with my computer on WAN side of this router and verifying with packet capture on router WAN interface.
To here everything is exactly as I want to be, but I am unable to configure it to work after reboot.
More than I read more confused I am.
I tried to add one test route with nmtui and it makes file /etc/sysconfig/network-scripts/route-ens18 with following content:
Code: Select all
ADDRESS0=1.1.1.1
NETMASK0=255.255.255.255
GATEWAY0=172.16.128.1
It is also ok if I delete all and insert
Code: Select all
1.1.1.1/32 via 172.16.128.1
Code: Select all
default via 172.16.128.1
0.0.0.0/0 via 172.16.128.1
default via 172.17.128.1 src 172.31.4.101
Code: Select all
0.0.0.0/1 via 172.16.128.1 src 172.31.4.101
128.0.0.0/1 via 172.16.128.1 src 172.31.4.101
Please let me know what I am doing wrong that "default via 172.16.128.1 src 172.31.4.101" is not working.
And also config file of interface:
Code: Select all
[root@CentOS8-DMZ-test01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens18
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens18
UUID=6a549f1b-26dd-46d0-9c12-2c3a7902404e
IPADDR=172.16.128.10
PREFIX=22
#GATEWAY="172.16.128.1"
DNS1=172.16.128.2
DNS2=172.16.128.3
IPADDR1=172.31.4.101
PREFIX1=32
DEVICE=ens18
ONBOOT=yes