Basic concepts when dealing with two NICs in a Replication scenerio

Posted on July 6, 2012


When you have two NIC’s in your system you can only give one default gateway and if you want to utilize another gateway you can use it but you use this gateway via static route command or you can use this gateway under an static route which means that you can redirect specific network IP’s or a single host request towards that gateway.

I have also found a link to use two gateway’s on a system but there is a different procedure to do this. See the link if you are interested but I suggest you to read the current blog first which will definitely help you to understand that link too

Dedicate one NIC’s only for replication

For replication scenario we may have two NIC’s or recommend to take two NIC’s. One NIC we use for user request or can make a public NIC or eth0 and second NIC will be dedicated for replication, this NIC(eth1) only use for the data which is to be replicated on another host/secondary host.

TIP: Layer II network is good or Layer III is good for Replication

Layer II network is good than Layer III as no router is involve in Layer II(the network has no hopes in between means both sites are ping able with no gateway).

Configuration way for both NIC’s

eth0 sets with default gateway, any user request which eth0 cannot fulfil or the request is for a different network, will be forwarded to the default gateway.

eth1 sets with a static route to communicate with its desire host in case the request is for a different network, will be forwarded by the static route, ( we configure static route on eth1 as we cannot used two gateway’s on one host )

Recommendation which NIC use gateway and which NIC use static route

My suggestion is use gateway with eth0 and static route with eth1 as eth0 is receiving the user request which can have the request for many/different networks while eth1 only has to communicate with the secondary site host.


a.) When one of your NIC already assigned a default gateway, don’t use the gw option with the static route command if you want to use same gateway for the second NIC traffic, as the second NIC can pick gateway of first NIC.

b.) In routing table (which can drive from route -n command) the routing process starts from top to down, When no route able to handle the packet eventually the packet will be handled by default gateway which you always find in the end of the routing table.

Static route should be process by specific NIC if multiple NIC’s present on single host

While running the route add command, if you want that this static route should use a particular NIC then mention the option -I ethx or dev ethx. This will process your packet with that specific NIC/Ethernet

Permanent static route

We can add the static route permanently. Just add the static route under rc.local file.

We can also add the static route permanently by using the file under /etc/sysconfig/networking-script/route-ethx.


a.) You can only add the static route when you have the IP Address configured on the NIC.

b.) Temporary route will be erased when you restart the network service or when the system will restart.

c.) No need to restart the Network service for the effect of newly added static route.

Expected Question : rc.local file/script has the commands in it to add the static route when the system boot. How we can make sure that while system boot the IP Address should already be assigned before running the rc.local script (as the rc.local file has the command which add the static route and static route cant add until the IP Address assigned on the NIC)?

Answer : rc.local file run in the end when all scripts already run means the IP Address already assigned.

Static Route: don’t get ping reply when static route only configured (in one direction) towards siteA to siteB


you have configured the static route from SiteA to SiteB but did not configured the static route from SiteB to SiteA. What will happen then ?

suppose you have configured one way static route from SiteA to SiteB but still you cannot get the reply when you ping from Site A to Site B. Why ?

the incoming ICMP packets will properly arrive on Site B , but outgoing response packets can’t go back from Site B to Site A as there is no route define from Site B to Site A or Site B dont know the path where the packets came from although the Site A knows the path as static route is configured.

Static Route from SiteA to SiteB


Static Route from SiteB to SiteA


TIP: When you mentioned the gateway = in static route command this means that you have configured the default gateway on system.

Verify connectivity between two sites

Run the traceroute command with the destination IP Address. See as an example below.

# traceroute
traceroute to (, 30 hops max, 60 byte packets
1 (  1.554 ms  1.545 ms  1.549 ms
2 (  8.641 ms  11.457 ms  26.560 ms
3 (  28.692 ms  32.843 ms  36.043 ms
4 (  34.748 ms  42.676 ms  42.945 ms
5  * * *
6  * * *
7  * * *
8  * * *
9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

As you have seen the above example that the first IP Address after running the traceroute command , this is the IP Address where your packet reached first or the first router and also see the last IP Address, This IP Address should be your Machine IP which is present at secondary Site as we have seen the example above. If in case your packet got stuck somewhere in the middle, that IP may be a router or switch(the packet may come at secondary site but some where stuck in switch in your company network) which is not able to forward your IP ahead or towards your host/system.

Posted in: Linux