Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am novice in networking trying to figure how multiple network interfaces work. My doubt is when there are two or more NIC's on a machine, what is the meaning of default gateway present in the /etc/sysconfig/network file. Is the kernel supposed to load balance between different interfaces which have gateways defined in their respective /etc/sysconfig/network-scripts/ifcfg-eth* file?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

The default gateway is where packets are sent when there is no more specific route - actually the default gateway has a route matching all packets - a /0 netmask route.

Try "netstat -rn" to see the routes on your system.

The default gateway is not an interface on your system - it is usually your local router. It may be reachable via more than one interface, though typically there is only one active interface.

I'm not sure about load-balancing, but it seems reasonable that if the default gateway is reachable from more than one interface that packets could be sent from all interfaces to it.

A simple example of setting up your networking from scratch:

ifconfig eth0 netmask
route add default gateway eth0

The first command sets up your interface and adds a route to the local network (192.168.0/24). The second command adds a default route via which is now reachable thanks to the first route.

If you have a second interface, you can set it up too:

ifconfig eth1 netmask

Now either interface can reach the default gateway. You can check if load balancing is happening by using "ifconfig" and looking at the RX/TX packets. If the counters increment it indicates that interface is being used.


For two interfaces on different networks, you can add more than one default gateway. I don't know if that situation is supported by etc/sysconfig. If not, you can add a "route add default gateway" statement to your startup script.

Some trivia on the subject: it used to be possible to send a packet through a gateway with a source IP from the other interface (asymetric routing). In this way, you could send all your packets from one gateway and receive them through the other. This is useful in the case where you have connections with asymetric up/down bandwidth or latancy (think satalite downlink and cellular uplink).

I say "used to" because most ISPs now filter out packets with a source IP that isn't assigned downstream.

More random dual-nic fun:

I have two nics on my laptop: wired and wireless. I assign them both the same IP in my DHCP server config based on their ethernet address. When the wired one is connected, I get high speed. But when I unplug it, everything keeps working. I don't even lose connections to remote hosts. The kernel doesn't care which interface a packet comes from as long as it's bound for the right IP address.

share|improve this answer
Thanks for the detailed response. What about the case where each interface(eth0 or eth1) are present in two different subnets( may be connected to different routers) –  Sirish Kumar Apr 10 '13 at 6:34
See updated answer –  Julian Apr 10 '13 at 15:51
Good, detailed answer, Julian. A little note about using route add default gateway for multiple adapters; this command (and the work it does) is very much tied to the adapter used when issuing the command. I tend to use this for forcing all of my private VPN traffic through my otherwise unused wifi interface; but this is just one of many good use-cases. –  Jerry W Jackson Apr 10 '13 at 17:09

The default gateway should be reachable by only a single of your network interfaces. Having more than one NIC on the same subnet, and thus a potentially non deterministic output path might leads to unexpected and disappointing behavior.

See for example http://serverfault.com/questions/415304/multiple-physical-interfaces-with-ips-on-the-same-subnet

Should you really want to implement that, a reliable way would be to configure some form of network aggregation, which translates to bonding/teaming as far as Linux is concerned.

share|improve this answer
One can have many-to-one NICs to gateways configured without violating any networking standard. I currently have my Ethernet and my Wifi on the same network, with the same gateway. On OSX, and other operating systems, one route will be preferred over the other automatically, either by explicit ordering of interface priority, or by arbitrary means such as logical interface numbering. If a fixed source IP address is configured, so that regardless of which interface is sending traffic, the source IP is the same and reachable by the gateway, then each interface can take turns sending,no prob. –  Nevin Williams Jan 24 at 16:22
@NevinWilliams Granted the standard allows such configurations and defines a couple of models to describe the expected behavior regarding incoming packets directed to the "wrong" physical interface. Answer updated to remove the standard violation point. –  jlliagre Jan 24 at 21:16
Were you to specify 'active default gateway', I'd have no issue at all... but after the good chuckle I had after checking out the referred link, we're good! –  Nevin Williams Jan 25 at 5:26

With two routes of equal metrics, a round-robin load-balancing scheme is used. This may be on a per-network basis, or it may be on a per-packet basis. Cisco (not linksys) routers can be configured to do either, but per-packet gives a better distribution equivalent links. Host-wise, I believe unless you're running a routing daemon, like routed or gated, the system kernel will select one interface as its preferred route, and only switch to the other interface if the first one goes down, or the gateway becomes unreachable over that interface.

share|improve this answer

Your Answer


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.