PDA

View Full Version : Static Routing after restart missing



robert1b
22-Oct-2013, 14:28
Situation is like this. I have created bonding device with combine 4 physical interface.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 2c:76:8a:a9:96:d2 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 2c:76:8a:a9:96:d2 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 2c:76:8a:a9:96:d2 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 2c:76:8a:a9:96:d2 brd ff:ff:ff:ff:ff:ff
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 2c:76:8a:a9:96:d2 brd ff:ff:ff:ff:ff:ff
inet 172.16.24.13/24 brd 172.16.24.255 scope global bond0
inet 172.16.24.25/24 brd 172.16.24.255 scope global secondary bond0:1
inet 172.16.24.26/24 brd 172.16.24.255 scope global secondary bond0:2
inet6 fe80::2e76:8aff:fea9:96d2/64 scope link
valid_lft forever preferred_lft forever

Also I configured two aliases for bond interface and want to create routing specifical for them
I modify file /etc/sysconfig/network/routes as below
10.193.12.133 - - bond0:1
10.194.12.132 - - bond0:1
10.1.100.70 - - bond0:2
10.2.100.69 - - bond0:2
default 172.16.24.1 - -
Before restart network I create route manually to check if it work;
10.193.12.133 dev bond0 scope link src 172.16.24.25
10.1.100.70 dev bond0 scope link src 172.16.24.26
10.194.12.132 dev bond0 scope link src 172.16.24.25
10.2.100.69 dev bond0 scope link src 172.16.24.26
172.16.24.0/24 dev bond0 proto kernel scope link src 172.16.24.13
127.0.0.0/8 dev lo scope link
default via 172.16.24.1 dev bond0

Then i restart network with command
/etc/init.d/network restart

After it I check routing by command ip route list and got as follow:
172.16.24.0/24 dev bond0 proto kernel scope link src 172.16.24.13
127.0.0.0/8 dev lo scope link
default via 172.16.24.1 dev bond0

This mean that file routes was not processed and static routing from that file was not set.
In yast2 lan software we can see entered before routing, but after close Yast2 routing is also not set.

Please help me solve problem, why routing from file routes is not set ? Where is the problem ?

jmozdzen
22-Oct-2013, 15:12
Hi robert1b,

> This mean that file routes was not processed and static routing from that file was not set.

as the default route is set (which comes from file /etc/sysconfig/network/routes, too), I would say that the file was processed but your first four statements didn't make it. Have you tried turning on shell debugging for "/etc/sysconfig/network/scripts/ifup-route" to see what the script tries to do and where it fails? The forth field is the device name - may I say you have no bond0:1 and bond0:2 device files (ifcfg-bond:1/2)(SUSE style is to enter secondary addresses in the "main interface" config file with parameter suffixes), which would explain why the statements in question were not applied?

Regards,
Jens

robert1b
23-Oct-2013, 09:51
Yes, You are right. Default route is set and devices bond0:1 and 2 are not exist.
My primary interface bond have configuration like thi
inscp1:/etc/sysconfig/network # cat ifcfg-bond0
BONDING_MASTER='yes'
BONDING_MODULE_OPTS='mode=balance-rr miimon=100'
BONDING_SLAVE0='eth0'
BONDING_SLAVE1='eth1'
BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='172.16.24.13/24'
MTU=''
NAME=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
BONDING_SLAVE2='eth2'
BONDING_SLAVE3='eth3'
IPADDR_0='172.16.24.25/24'
LABEL_0='1'
IPADDR_1='172.16.24.26/24'
LABEL_1='2'

What is Your suggestion ? How can I configure route as I say before ?
Today I have limited acces to internet so my reply can be late or tomorrow.

jmozdzen
23-Oct-2013, 14:56
Hi robert1b,

What is Your suggestion ? How can I configure route as I say before ?
Today I have limited acces to internet so my reply can be late or tomorrow.

I currently see no way to persist these routes via /etc/sysconfig/network/routes (if others do, please answer here telling how :) ). I recommend adding a script /etc/sysconfig/network/if-up.d/bond0 with the statements needed to add these routes (and probably another one in if-down.d to remove the routes once the interfaces go down). If you code the script to distinguish on the script's path, you could put both the up&down code in one file and create a symlink to point to that file, instead of creating two files.

Regards,
Jens