Доброго времени суток!!!Маршрутизатор на CentOS'е, ядро 4.1.0. 3и сетевых интерфейса: eth2 - внутренняя сеть, eth0 и eth1 - к провайдерам. eth0 - основной канал, eth1 - резервный.
Состояние канала проверяю так: ping -c 4 -I ethX хост_в_инете .
При написании скрипта для контроля состояния каналов и их переключения столкнулся со следующим. После изменения или удаления маршрута по-умолчанию перестаёт проходить ping через eth0, а через eth1 проходит в любом случае.
Если кто знает - не сочтите за труд, подскажите в чём причина.
Пробовал на ядре 2.6.32-504.23.4.el6.i686, ситуация такая же.
Ниже приведёна информация по маршрутам и пингам. На момент её получения все каналы были доступны.
[root@host ~]# ip addr ls
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:01:02:fb:0e:09 brd ff:ff:ff:ff:ff:ff
inet 195.112.240.150/30 brd 195.112.240.151 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::201:2ff:fefb:e09/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:15:f2:50:15:e7 brd ff:ff:ff:ff:ff:ff
inet 80.67.218.114/30 brd 80.67.218.115 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::215:f2ff:fe50:15e7/64 scope link
valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:1a:92:71:66:dc brd ff:ff:ff:ff:ff:ff
inet 10.58.0.12/24 brd 10.58.0.255 scope global eth2
valid_lft forever preferred_lft forever
inet6 fe80::21a:92ff:fe71:66dc/64 scope link
valid_lft forever preferred_lft forever
Дополнительные таблицы:
[root@host ~]# cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
200 rtk
201 ntk1
[root@host ~]# ip route ls table rtk
default via 195.112.240.149 dev eth0
[root@host ~]# ip route ls table ntk1
default via 80.67.218.113 dev eth1
Основные таблицы:
[root@host ~]# ip route ls
default via 195.112.240.149 dev eth0
10.58.0.0/24 dev eth2 proto kernel scope link src 10.58.0.12
80.67.218.112/30 dev eth1 proto kernel scope link src 80.67.218.114
195.112.240.148/30 dev eth0 proto kernel scope link src 195.112.240.150
[root@host ~]# ip route ls table local
broadcast 10.58.0.0 dev eth2 proto kernel scope link src 10.58.0.12
local 10.58.0.12 dev eth2 proto kernel scope host src 10.58.0.12
broadcast 10.58.0.255 dev eth2 proto kernel scope link src 10.58.0.12
broadcast 80.67.218.112 dev eth1 proto kernel scope link src 80.67.218.114
local 80.67.218.114 dev eth1 proto kernel scope host src 80.67.218.114
broadcast 80.67.218.115 dev eth1 proto kernel scope link src 80.67.218.114
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 195.112.240.148 dev eth0 proto kernel scope link src 195.112.240.150
local 195.112.240.150 dev eth0 proto kernel scope host src 195.112.240.150
broadcast 195.112.240.151 dev eth0 proto kernel scope link src 195.112.240.150
[root@host ~]# ip route ls table default
Политики:
[root@host ~]# ip rule ls
0: from all lookup local
32764: from 10.58.0.11 lookup ntk1
32765: from all to 77.240.172.142 lookup ntk1
32766: from all lookup main
32767: from all lookup default
Проверяю доступность каналов:
[root@host ~]# ping -c 1 -I eth0 2ip.ru
PING 2ip.ru (188.40.35.183) from 195.112.240.150 eth0: 56(84) bytes of data.
64 bytes from 2ip.ru (188.40.35.183): icmp_seq=1 ttl=53 time=744 ms
--- 2ip.ru ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 745ms
rtt min/avg/max/mdev = 744.477/744.477/744.477/0.000 ms
Через eth0 доступен.
[root@host ~]# ping -c 1 -I eth1 2ip.ru
PING 2ip.ru (188.40.35.183) from 80.67.218.114 eth1: 56(84) bytes of data.
64 bytes from 2ip.ru (188.40.35.183): icmp_seq=1 ttl=52 time=603 ms
--- 2ip.ru ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 604ms
rtt min/avg/max/mdev = 603.289/603.289/603.289/0.000 ms
Через eth1 доступен.
Удаляю defrouter:
[root@host ~]# ip route del default
Проверяю отсутствие defrouter'а:
[root@host ~]# ip route ls
10.58.0.0/24 dev eth2 proto kernel scope link src 10.58.0.12
80.67.218.112/30 dev eth1 proto kernel scope link src 80.67.218.114
195.112.240.148/30 dev eth0 proto kernel scope link src 195.112.240.150
Вот оно:
[root@host ~]# ping -c 1 -I eth0 2ip.ru
PING 2ip.ru (188.40.35.183) from 195.112.240.150 eth0: 56(84) bytes of data.
--- 2ip.ru ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 10000ms
Через eth0 НЕ доступен.
А через eth1 пинги идут
[root@host ~]# ping -c 1 -I eth1 2ip.ru
PING 2ip.ru (188.40.35.183) from 80.67.218.114 eth1: 56(84) bytes of data.
64 bytes from 2ip.ru (188.40.35.183): icmp_seq=1 ttl=52 time=602 ms
--- 2ip.ru ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 603ms
rtt min/avg/max/mdev = 602.357/602.357/602.357/0.000 ms
Содержимое sysctl.conf:
[root@host ~]# cat /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456