Problem network out 2 links

Issues related to configuring your network
Post Reply
kidboy
Posts: 12
Joined: 2013/01/28 21:41:01

Problem network out 2 links

Post by kidboy » 2015/02/23 14:10:43

I have 2 internet links, where do a test to assess the connection applying a ping on each output interface and getting the result, so that in version 7 CentOS i use ping -I IP of second interface and not works, its was using the default route not the gateway 2. It worked perfectly on CentOS 6, now at 7 its not working?

My configuration is here:

/etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="static"
IPV4_FAILURE_FATAL="no"
#IPV6INIT="yes"
#IPV6_AUTOCONF="yes"
#IPV6_DEFROUTE="yes"
#IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="68ec71ab-62f4-41fc-9ad8-085bb3b78eae"
ONBOOT="yes"
HWADDR="10:FE:ED:07:B3:38"
IPADDR="192.168.25.2"
GATEWAY="192.168.25.1"
PREFIX="24"
#IPV6_PEERDNS="yes"
#IPV6_PEERROUTES="yes"
NM_CONTROLLED="no"

/etc/sysconfig/network-scripts/ifcfg-eth1
TYPE="Ethernet"
BOOTPROTO="static"
IPV4_FAILURE_FATAL="no"
#IPV6INIT="yes"
#IPV6_AUTOCONF="yes"
#IPV6_DEFROUTE="yes"
#IPV6_FAILURE_FATAL="no"
NAME="eth1"
UUID="6ddee48f-3296-4158-86e6-d4104593d942"
ONBOOT="yes"
HWADDR="50:E5:49:FB:AF:0D"
IPADDR="192.168.26.2"
GATEWAY="192.168.26.1"
PREFIX="24"
#IPV6_PEERDNS="yes"
#IPV6_PEERROUTES="yes"
NM_CONTROLLED="no"

# /etc/rc.d/rc.local ( Permission is 755 in file )
# Iniciando controle de saida pelo link GVT 25MB
ip route add 192.168.25.0 dev eth0 src 192.168.25.2 table 1
ip route add default via 192.168.25.1 table 1

# Rules for out ADSL1
ip route add 192.168.26.0 dev eth1 src 192.168.26.2 table 2
ip route add default via 192.168.26.1 table 2
# Rules for out ADSL2
ip route add 192.168.25.0 dev eth0 src 192.168.25.2
ip route add 192.168.26.0 dev eth1 src 192.168.26.2
# Rule for tables
ip rule add from 192.168.25.0 table 1
ip rule add from 192.168.26.0 table 2
ip rule add fwmark 1 lookup 1
ip rule add fwmark 2 lookup 2
ip route flush cached

# Script for test links

# Teste LINK1
if [ "`ping -c3 8.8.8.8 -I192.168.25.2 | grep "received" | awk '{print $4}'`" == "0" ]; then
LINK1="OFF";
fi

# Teste LINK2
if [ "`ping -c3 8.8.8.8 -I192.168.26.2 | grep "received" | awk '{print $4}'`" == "0" ]; then
LINK2="OFF";
fi

In my tests, the default route is for 192.168.25.1, but when i run script for test ADSL2 ( ping -c3 8.8.8.8 -I192.168.26.2 ) its use the default route not the 192.168.26.1. In CentOS 6 the same script and configuration works fine, only in CentOS 7 its not working. I saw the kernel version maybe is the problem, kernel of 2.6 works fine, but in 3.X not. Someone know something about ? Inote in CentOS 7 when i ping the interface eth1 dont recive any package, in CentOS6 its arrive fine.

Post Reply