Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my ifconfig file:

auto eth0
iface eth0 inet static
        # dns-* options are implemented by the resolvconf package, if installed

auto eth1
iface eth1 inet static
        up route add -net netmask gw
        down route del -net netmask gw

and this is my routing table

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface U     0      0        0 eth0   UG    0      0        0 eth1   U     0      0        0 eth1         UG    100    0        0 eth0         UG    100    0        0 eth1

but it doesn't forward any packet to another network. Is there any wrong with my routing table?

share|improve this question
How did you establish it's not forwarding packets? Do you have ip_forward set to 1? Is it supposed to be doing NAT? (If so, did you configure NAT?) – David Schwartz Dec 1 '11 at 5:34
up vote 4 down vote accepted

Well for starters, you've got two default routes. It's possible to have this in certain cases, but it's unlikely to be what you want.

Generally one default route will be used, and for you I'd guess that you want to use the default gateway on that 180.x network.

Remove the gateway line from the eth1 definition.

The other thing to check is that /proc/sys/net/ipv4/ip_forward is enabled:

'cat /proc/sys/net/ipv4/ip_forward' and check that you get 1, not 0.

If you don't, you need to enable it, and the best way is to edit /etc/sysctl.conf and set net.ipv4.ip_forward=1

That will get forwarding working, but if it's still not working at this point (it's hard to say what your requirements are without a better description of what you're trying to achieve), you may need to look into netfilter SNAT or MASQ using iptables.

share|improve this answer
Sorry for asked pretty simple question. Routing problem solved! My mistake was : I wrote 2 destination. 1 for LAN interface address, another was public IP(starting with 180.) address. – KevinOelen Dec 1 '11 at 7:12

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.