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.

Here is my ifconfig file: http://pastebin.com/5ZUGYbnB

auto eth0
iface eth0 inet static
        address 180.xxx.xx.68
        netmask 255.255.255.248
        network 180.xxx.xx.64
        broadcast 180.xxx.xx.71
        gateway 180.xxx.xx.65
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 180.xxx.xx.65 8.8.8.8

auto eth1
iface eth1 inet static
        address 10.96.92.23
        netmask 255.255.255.0
        network 10.96.92.0
        broadcast 10.96.92.255
        gateway 10.96.92.1
        dns-nameservers 10.96.92.11
        up route add -net 10.86.82.0 netmask 255.255.255.0 gw 10.96.92.1
        down route del -net 10.86.82.0 netmask 255.255.255.0 gw 10.96.92.1

and this is my routing table http://pastebin.com/VVwCe7ZF

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
180.xxx.xx.64   0.0.0.0         255.255.255.248 U     0      0        0 eth0
10.86.82.0      10.96.92.1      255.255.255.0   UG    0      0        0 eth1
10.96.92.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         180.xxx.xx.65   0.0.0.0         UG    100    0        0 eth0
0.0.0.0         10.96.92.1      0.0.0.0         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

1 Answer 1

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 0.0.0.0 destination. 1 for LAN interface address, another was public IP(starting with 180.) address. –  KevinOelen Dec 1 '11 at 7:12

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.