Ubuntu 12.04 as router with 2 nic

Posted by Blue Gene on Server Fault See other posts from Server Fault or by Blue Gene
Published on 2012-10-15T07:37:06Z Indexed on 2012/10/15 9:39 UTC
Read the original article Hit count: 204

Filed under:
|
|
|

I have been trying this setup for weeks and still can not make this to work...

ubuntu 12.04 64 bit with 2 nic

nic1: eth0:192.168.2.33 -static ip with internet access (connected to modem)

nic2: eth1:192.168.1.2 -static ip connected to LAN.

enabled ip_forward on ubuntu box net_ip_forward = 1

on the LAN with ip address 192.168.1.5 specified gateway as 192.168.1.2 and able to ping gateway.But can not ping public address.What am i missing? on router box:

route -n

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.2.1     0.0.0.0         UG    100    0        0 eth0

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

tried

ip route add 192.168.2.0/24 via 192.168.1.2 dev eth0

route -n on LAN 192.168.1.5

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.1.2     0.0.0.0         UG    100    0        0 eth0

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

192.168.2.0     192.168.1.2     255.255.255.0   UG    0      0        0 eth0

iptables default policy is to accept all.

tracepath 8.8.8.8 from LAN

  1:  192.168.1.5                                           0.060ms pmtu 1500

  1:  192.168.1.2                                           3.367ms 

  1:  192.168.1.2                                           3.764ms 

   2:  no reply

Is there a way to make this work,other than NAT ing.

© Server Fault or respective owner

Related posts about linux

Related posts about routing