Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having an issue with a CentOS 6.3 box. We have two NICs (eth0 and eth1) in the server which each have an ip from a different subnet assigned, let's say eth0:192.168.1.2/24 (gateway 192.168.1.1) and eth1:192.168.2.2/24 (gateway 192.168.2.1). The real ips are world routable though.

Each NIC is connected to a different switch but ends up on one router in the end. On the router these two subnets are in different VLANs, the ports to the NICs are untagged so no vlan id is passed onto the server.

Now on FreeBSD I just assign the ips to each NIC and it just works, both IPs are reachable. On CentOS I can only reach the IP of which the gateway is active as the default route. I can ping the IP anything within the same VLAN/subnet but outside that it is unreachable.

When I do a traceroute to each of the gateways i see they go over the appropriate NIC, makes sense as the gatewaty is inside the scope. However outside the subnet I can only ping 192.168.1.2 currently.

IPtables is not active at the moment either.

What would be the required action to get this to work?

I googled around for hours, tried different approaches but it won't work. I have the feeling I am missing something important, hopefully an easy fix :-)

Any help is appreciated Thanks ! Scott

ROUTING

# route -n  
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

IP INFO

# ip addr list
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 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:16:70:c7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::baac:6fff:fe16:70c7/64 scope link 
       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:16:70:c9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.2/24 brd 192.168.2.255 scope global eth1
    inet6 fe80::baac:6fff:fe16:70c9/64 scope link 
       valid_lft forever preferred_lft forever
share|improve this question
    
Good first question! –  slm Dec 23 '12 at 4:28

1 Answer 1

up vote 6 down vote accepted

You need to create a multipath route or active a dynamic routing protocol (ospf, isis).

Mulitpath example:

ip route del default via 192.168.1.1 dev eth0
ip route add default scope global nexthop via 192.168.1.1 dev eth0 weight 1 \
        nexthop via 192.168.2.1 dev eth1 weight 1
share|improve this answer
    
Wow kudos to you, that works Thanks a lot rhasti! –  Scott Dec 23 '12 at 5:08
    
If someone ends up here googling; adding it to /etc/rc.d/rc.local makes it permanent –  Scott Dec 23 '12 at 5:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.