LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   IP forwarding won't work (https://www.linuxquestions.org/questions/linux-newbie-8/ip-forwarding-wont-work-909528/)

Annielover 10-22-2011 08:50 AM

IP forwarding won't work
 
Hello,

I want my Linux Ubuntu Server act as an internal router, so routing between two local subnets, no NAT.

This is what I have:
/etc/network/interfaces
Code:

auto eth0
iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

auto eth1
iface eth1 inet static
        address 172.16.0.1
        netmask 255.255.0.0
        network 172.16.0.0
        broadcast 172.16.0.255

route
Code:

Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.0    *              255.255.255.0  U    0      0        0 eth0
172.16.0.0      *              255.255.0.0    U    0      0        0 eth1
default        192.168.1.1    0.0.0.0        UG    100    0        0 eth0

I have no IPTABLES configured:
Code:

Chain INPUT (policy ACCEPT 39642 packets, 1707K bytes)
 pkts bytes target    prot opt in    out    source              destination

Chain FORWARD (policy ACCEPT 6 packets, 288 bytes)
 pkts bytes target    prot opt in    out    source              destination

Chain OUTPUT (policy ACCEPT 39796 packets, 19M bytes)
 pkts bytes target    prot opt in    out    source              destination


Output of the sudo cat /proc/sys/net/ipv4/ip_forward

1

I also configured the dhcp server to only listen on interface eth1.
When I connect my laptop to the server, I recieve following IP address:
address: 172.16.0.2
mask: 255.255.0.0
gateway: 172.16.0.1
DNS: 172.16.0.1

I can ping the eth1 interface:
ping 172.16.0.1 => success!

I ALSO can ping the eth0 interface: (still from the same laptop)
ping 192.168.1.2 => success!

But when I attached another laptop using static IP at eth0, I'm UNABLE to connect...
ping 192.168.1.5 => fail!

So apperantly, it does not forward the packets...
What am I doing wrong?

Here's a scheme:
Internet -> NAT router -> network 1 -> eth0 LINUX ROUTER eth1 -> network 2

Thanks!

colucix 10-22-2011 09:22 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate. Please, continue here: http://www.linuxquestions.org/questi...arding-909519/


All times are GMT -5. The time now is 08:26 AM.