Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I setup CentOS with Dual WAN. eth0 = line1 eth1 = line2 If I setup both WAN, the default connection and gateway will pass thru eth1 (line2), If I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2011
    Posts
    44

    CentOS Dual WAN - Issue


    Hi,

    I setup CentOS with Dual WAN.

    eth0 = line1
    eth1 = line2

    If I setup both WAN, the default connection and gateway will pass thru eth1 (line2),

    If I issue command ifdown eth1, the internet will be gone though eth0 is also WAN, even I route add default gateway using the gateway of eth0, i cannot access the internet even ping 8.8.8.8

    The only way to use the eth0 is to remove the cable and configuration of eth1.

    I want to be able to use both WAN interface for fail-over.

    If I issue ifdown eth1 , eth0 will take over, vice-versa.

    hope you can help.

    Sincerely,
    WizzKid

  2. #2
    Just Joined!
    Join Date
    Jun 2012
    Posts
    3
    Are you trying to configure NIC failover? Or, are you configuring each interface with a different IP address?

    Which version of CentOS?

    Is the box behind a firewall? Or, is it connected to something like a cable router?

    Can you provide dummy IP address(es) that illustrate(s) your configuration? What about your ifcfg-ethX files (please dummy-up the IP addresses).

    If you are trying to use a single IP address on the network, but assign it to two NICs at the same time for fault tolerance, you want to configure NIC bonding. And, there are changes in how to go about it depending on the version of CentOS you are using.

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    9
    try ISPunity

    rubygems.org/gems/ispunity
    spunity.com/

  4. #4
    Just Joined!
    Join Date
    Jan 2011
    Posts
    44
    Thanks Guys,

    This is fixed. just a routing issue.

  5. #5
    Just Joined!
    Join Date
    Jan 2011
    Posts
    44
    Hi Everyone,

    Got an issue with fail-over

    My reference ( - FaTaL SiTe - )

    Interfaces
    eth0 = LAN
    eth1 = WAN1 - 58.71.xx.xx - IGATE
    eth2 = WAN2 - 202.78.xx.xx - BTEL

    Working with Load Balacing.
    Code:
    [root@ ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    58.71.xx.xx     0.0.0.0         255.255.255.240 U     0      0        0 eth1
    202.78.xx.xx   0.0.0.0         255.255.255.240 U     0      0        0 eth2
    10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
    169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth2
    0.0.0.0         58.71.xx.xx     0.0.0.0         UG    0      0        0 eth1
    
    [root@ ~]# ip route
    58.71.xx.xx/28 dev eth1  proto kernel  scope link  src 58.71.xx.xx
    202.78.xx.xx/28 dev eth2  proto kernel  scope link  src 202.78.xx.xx
    10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.1
    169.254.0.0/16 dev eth2  scope link
    default
            nexthop via 58.71.xx.gw  dev eth1 weight 1
            nexthop via 202.78.xx.gw  dev eth2 weight 1
    When I issue command " ifdown eth1 " it will automatically switch to eth2 (BTEL)

    Here's my routing table when one link is down thru ifdown command.
    Code:
    [root@GFWPROX ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    202.78.xx.xx   0.0.0.0         255.255.255.240 U     0      0        0 eth2
    10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
    0.0.0.0         202.78.123.97   0.0.0.0         UG    0      0        0 eth2
    
    [root@GFWPROX ~]# ip route
    202.78.xx.xx/28 dev eth2  proto kernel  scope link  src 202.78.xx.xx
    10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.1
    default via 202.78.xx.gw dev eth2
    The problem is that, When the ISP is really down, it doesnt switch automatically. the routing table is like as if you're still in load balacing mode. I even tried to switch off the ISP's model of eth1 , eth2 doesnt take over, and the internet is gone. I have to issue the command ifdown ethx.

    I followed the above link as my reference including the gwping file.


    Here's my iptables for your reference.
    Code:
    iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A INPUT -i eth2 -m state --state ESTABLISHED,RELATED -j ACCEPT
    
    # set this system as a router for Rest of LAN
    iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
    iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE
    iptables --append FORWARD --in-interface eth0 -j ACCEPT

    Hope you can help.

  6. #6
    Just Joined!
    Join Date
    Jan 2011
    Posts
    44
    I saw the issue, it is in fact the routing table doesnt get save.

    Based on the site I provided earlier, here's the routing table (I adjusted based on my ip assignment)

    ip route add 172.16.0.0/24 dev eth0 src 172.16.0.100 table ROL
    ip route add default via 172.16.0.1 table ROL
    ip route add 10.1.0.0/24 dev eth1 src 10.1.0.100 table DHIRAAGU
    ip route add default via 10.1.0.1 table DHIRAAGU
    ip rule add from 172.16.0.100 table ROL
    ip rule add from 10.1.0.100 table DHIRAAGU

    However, when I issue command service network restart, the above will not get save to the routing table.

    Is there a way to save them ?

  7. #7
    Just Joined!
    Join Date
    Jun 2012
    Posts
    3
    Use rule-ethX and route-ethX files in /etc/sysconfig/network-scripts/

    blog.mc-thias.org/?title=routing-with-linux-when-using&more=1&c=1&tb=1&pb=1

  8. #8
    Just Joined!
    Join Date
    Jan 2011
    Posts
    44
    Thanks, gstewart, and sorry for posting the same issue on another thread. I got this working already.

    Now, I have another question, since I got dual wan / load balancing work, How can I forward a specific traffic to a certain interface?

    eg.

    IP block 202.123.123.0/24 will be forwarded to eth1 (both incoming and out going traffic)?


    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •