# Routing 3 subnets via one gentoo box

## SoreGums

Here is a quick network map (modem H is meant to be 192.168.1.1 not 192.168.1.0)

I've setup static routes on the Modem H, I, J and I am able to ping all the interfaces on Computer G from any pc in the network.

So I can ping from 

computer A and get replies from 192.168.0.3 & 10.0.0.3

computer C and get replies from 192.168.1.3 & 10.0.0.3

What isn't working is ping from computer A to computer C.

How do I do this?

Thanks

```

Computer_G etc # ip rule ls

0:      from all lookup local

32766:  from all lookup main

32767:  from all lookup default

Computer_G etc # ip addr ls

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 100

    link/ether 00:15:17:4d:ee:d0 brd ff:ff:ff:ff:ff:ff

    inet 192.168.1.3/24 brd 192.168.1.255 scope global eth0

    inet6 fe80::215:17ff:fe4d:eed0/64 scope link

       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 100

    link/ether 00:15:17:4d:ee:d1 brd ff:ff:ff:ff:ff:ff

    inet 192.168.0.3/24 brd 192.168.0.255 scope global eth1

    inet6 fe80::215:17ff:fe4d:eed1/64 scope link

       valid_lft forever preferred_lft forever

4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 100

    link/ether 00:15:17:4d:ee:d2 brd ff:ff:ff:ff:ff:ff

    inet 10.0.0.3/8 brd 10.0.0.255 scope global eth2

    inet6 fe80::215:17ff:fe4d:eed2/64 scope link

       valid_lft forever preferred_lft forever

Computer_G etc # ip route

192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.3

192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.3

10.0.0.0/8 dev eth2  proto kernel  scope link  src 10.0.0.3

127.0.0.0/8 via 127.0.0.1 dev lo

default via 192.168.1.1 dev eth0  metric 2

```

----------

## think4urs11

normally G should have a correct routing to all networks as it is connected to all three of them.

Depending on what the default GW for the clients is able to handle you have to have the following

A/B need to have (either via their default GW or as dedicated routes)

- a route to 10.0.0.0/8 via 192.168.1.3

- a route to 192.168.0.0/24 via 192.168.1.3

C/D need to have (either via their default GW or as dedicated routes)

- a route to 10.0.0.0/8 via 192.168.0.3

- a route to 192.168.1.0/24 via 192.168.0.3

E/F need to have (either via their default GW or as dedicated routes)

- a route to 192.168.0.0/24 via 10.0.0.3

- a route to 192.168.1.0/24 via 10.0.0.3

The same need to be done for everything 'behind' 192.168.0.1 as thats the default GW for G.

----------

## SoreGums

 *Think4UrS11 wrote:*   

> normally G should have a correct routing to all networks as it is connected to all three of them.
> 
> Depending on what the default GW for the clients is able to handle you have to have the following
> 
> A/B need to have (either via their default GW or as dedicated routes)
> ...

 

I've configured the modems to have static routes. The modems in each network are the default gateways as they are the link to the internet etc..

```

MODEM H

Destination      Netmask          Gateway         Flags   Metric   Interface

127.0.0.0        255.0.0.0        127.0.0.1               1         lo0

192.168.1.0      255.255.255.0    192.168.1.1             1         LAN

100.236.30.19    255.255.255.255  100.236.30.19           1         PPPoA(0) 8/35

Default Gateway  -                100.236.30.19           5         PPPoA(0) 8/35

10.0.0.0         255.0.0.0        192.168.1.3     S       2         LAN

192.168.0.0      255.255.255.0    192.168.1.3     S       2         LAN

Flags legend: (R)ip route, (S)tatic

```

So the issue is Computer G - it isn't able to send packets from one interface to another - eth1 to eth2 - hence why I can't ping pc's outside of the pc's local network...

This is where I seek the help - thanks  :Smile: 

----------

## SeaTiger

In [G], try the following:

```
echo 1 > /proc/sys/net/ipv4/ip_forward
```

If it works, then look for the following line in /etc/sysctl.conf

```
net.ipv4.ip_forward = 0
```

Change 0 to 1.

----------

## SoreGums

 *junksiu wrote:*   

> In [G], try the following:
> 
> ```
> echo 1 > /proc/sys/net/ipv4/ip_forward
> ```
> ...

 

I've made that change all ready as well - any other ideas please?

Thanks

```

Computer_G etc # cat /proc/sys/net/ipv4/ip_forward

1

Computer_G etc #

```

----------

## SeaTiger

Is there any firewall package running in gentoo box, like iptables?

----------

## think4urs11

 *SoreGums wrote:*   

> So the issue is Computer G

 

Not neccessarily - it can be possible that the Modems are not able to work correctly with ip networks behind their LAN interface they do not belong to. I had the same issue with one particular netgear router; it could only work correctly with clients within the same network on LAN side.

What gives (from A) traceroute 10.0.0.4?

What gives (on G) a tcpdump -ni eth0/eth2 during the traceroute?

Does it work when you configure for testing the routes statically on the clients as proposed above?

----------

## SoreGums

 *Think4UrS11 wrote:*   

> Not neccessarily - it can be possible that the Modems are not able to work correctly with ip networks behind their LAN interface they do not belong to. I had the same issue with one particular netgear router; it could only work correctly with clients within the same network on LAN side.
> 
> What gives (from A) traceroute 10.0.0.4?
> 
> What gives (on G) a tcpdump -ni eth0/eth2 during the traceroute?
> ...

 

Ok so on computer F (Vista) I configured a static route

```
route add 192.168.1.0 mask 255.255.255.0 10.0.0.90
```

Computer F can ping Computer A

Well not any more. To be clear: I wasn't able to ping straight away after adding that route; after 5-10mins I was able to ping; after another 5-10mins I am not able to ping....

It seems that it is temperamental. Maybe the Intel NIC is stuffed? Or I don't have the correct driver for it? The other day after 46days of no issues, the card reported a "Hardware Error" and I had to restart the machine...

running ping -t on Computer F and then looking at the result on Computer G - tcpdump -ni eth2

```
15:52:51.674234 IP 10.0.0.5 > 192.168.1.5: ICMP echo request, id 1, seq 318, length 40
```

----------

