Page 1 of 1

route only works when service network restart

Posted: 2017/10/18 17:06:13
by eriled
Hello

I have a m with 2 nic
CentOS Linux release 7.4.1708 (Core) (Minimal install)

I create static route and rule by create 2 filles in /etc/sysconfig/network-scripts/route-nicName...
Works only when I do service network restart

So when I reboot I need do it again to make the route works

eno16780032: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 11.95.16.26 netmask 255.255.240.0 broadcast 11.95.31.255
inet6 fe80::6c42:4469:d622:f110 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:47:f2:96 txqueuelen 1000 (Ethernet)
RX packets 26326 bytes 2138728 (2.0 MiB)
RX errors 0 dropped 6124 overruns 0 frame 0
TX packets 1091 bytes 171634 (167.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens224: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::4c0c:2fe:5a97:42c9 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:47:f2:a0 txqueuelen 1000 (Ethernet)
RX packets 1814 bytes 2265606 (2.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1181 bytes 631337 (616.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 38 bytes 3052 (2.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38 bytes 3052 (2.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

network-scripts]# ls -laZ
drwxr-xr-x. root root system_u:object_r:net_conf_t:s0 .
drwxr-xr-x. root root system_u:object_r:etc_t:s0 ..
-rw-r--r--. root root system_u:object_r:net_conf_t:s0 ifcfg-eno16780032
-rw-r--r--. root root system_u:object_r:net_conf_t:s0 ifcfg-lo
-rw-r--r-- root root ? ifcfg-Wired_connection_1
lrwxrwxrwx. root root system_u:object_r:bin_t:s0 ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-bnep
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-eth
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-ippp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-ipv6
lrwxrwxrwx. root root system_u:object_r:bin_t:s0 ifdown-isdn -> ifdown-ippp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-post
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-ppp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-routes
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-sit
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifdown-tunnel
lrwxrwxrwx. root root system_u:object_r:bin_t:s0 ifup -> ../../../usr/sbin/ifup
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-aliases
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-bnep
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-eth
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-ippp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-ipv6
lrwxrwxrwx. root root system_u:object_r:bin_t:s0 ifup-isdn -> ifup-ippp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-plip
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-plusb
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-post
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-ppp
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-routes
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-sit
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-tunnel
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 ifup-wireless
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 init.ipv6-global
-rw-r--r--. root root system_u:object_r:bin_t:s0 network-functions
-rw-r--r--. root root system_u:object_r:bin_t:s0 network-functions-ipv6
-rwxr-xr-x root root ? route-eno16780032
-rwxr-xr-x root root ? route-Wired_connection_1
-rwxr-xr-x root root ? rule-eno16780032
-rwxr-xr-x root root ? rule-Wired_connection_1


cat rule-*
from 11.95.16.26/32 tab 1 priority 100
from 10.0.0.10/32 tab 2 priority 200


cat route-*
11.95.16.0/20 dev eno16780032 tab 1
default via 11.95.16.51 dev eno16780032 tab 1
10.0.0.0/24 dev ens224 tab 2
default via 10.0.0.1 dev ens224 tab 2

# cat ifcfg*


TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth01
UUID=6053bc2a-fa2a-46ef-b500-4a15d8383f1b
DEVICE=eno16780032
ONBOOT=yes
IPADDR=11.95.16.26
PREFIX=20
GATEWAY=11.95.16.51
DNS1=11.95.16.1
PROXY_METHOD=none
BROWSER_ONLY=no
IPV6_ADDR_GEN_MODE=stable-privacy
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
HWADDR=00:0C:29:47:F2:A0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
NAME="Wired connection 1"
UUID=11d4e3f9-a456-361b-ad77-5c2b45d73501
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPADDR=10.0.0.10
PREFIX=24
GATEWAY=10.0.0.1
DNS1=8.8.4.4


For getenforce
I disabled it for the debuging period...

Re: route only works when service network restart

Posted: 2017/10/18 17:08:23
by TrevorH
Post the files and the related ifcfg files along with the output from ls -laZ on all of them.

Re: route only works when service network restart

Posted: 2017/10/18 17:26:51
by eriled
I add the info in the post

Re: route only works when service network restart

Posted: 2017/10/18 17:58:01
by TrevorH
Need to see the ifcfg files too.

Also, what is the output from getenforce ?

Re: route only works when service network restart

Posted: 2017/10/18 23:35:35
by eriled
I add the info in the post it self

Thanks

Re: route only works when service network restart

Posted: 2017/10/19 02:52:13
by eriled
last update I create the initial network setup via nmtui

Re: route only works when service network restart

Posted: 2017/10/20 14:08:45
by eriled
I find my solution : here:
http://devemmeff.blogspot.fi/2016/02/ho ... using.html

Thanks again jlehtone


So recapt of my config for others that have same issue...:
all file is in /etc/sysconfig/network-scripts/
cat ifcfg-ens224
HWADDR=00:0C:29:47:F2:A0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
NAME=eth02
UUID=11d4e3f9-a456-361b-ad77-5c2b45d73501
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPADDR=10.0.0.10
PREFIX=24
GATEWAY=10.0.0.1
DNS1=8.8.4.4


cat ifcfg-eno16780032
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth01
UUID=6053bc2a-fa2a-46ef-b500-4a15d8383f1b
DEVICE=eno16780032
ONBOOT=yes
IPADDR=11.95.16.26
PREFIX=20
GATEWAY=11.95.16.51
DNS1=11.95.16.1
PROXY_METHOD=none
BROWSER_ONLY=no
IPV6_ADDR_GEN_MODE=stable-privacy

cat route-ens224
10.0.0.0/24 dev ens224 table 2
default via 10.0.0.1 dev ens224 table 2

cat rule-ens224
iif ens224 table 2
from 10.0.0.10 table 2