# Network issue

## Kurogane

Hi folks.

I'm having problem to setup my network

Here's the scenario: 

/etc/conf.d/net 

```
config_eth0="172.16.77.42/24"

```

route -n 

```
 # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

172.16.77.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

```

```
ping -c5 172.16.0.254

PING 172.16.0.254 (172.16.0.254) 56(84) bytes of data.

64 bytes from 172.16.0.254: icmp_req=1 ttl=64 time=0.363 ms

64 bytes from 172.16.0.254: icmp_req=2 ttl=64 time=0.215 ms

64 bytes from 172.16.0.254: icmp_req=3 ttl=64 time=0.201 ms

64 bytes from 172.16.0.254: icmp_req=4 ttl=64 time=0.243 ms

64 bytes from 172.16.0.254: icmp_req=5 ttl=64 time=0.260 ms

--- 172.16.0.254 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss, time 3999ms

rtt min/avg/max/mdev = 0.201/0.256/0.363/0.058 ms

```

If i have this configure i can ping my network, but i dont have internet because i can't add gateway with this configuration becuase /24, if i try to add manually my gw give me this error

```
 # ip route add 172.16.0.0/16 via 172.16.0.254 dev eth0

RTNETLINK answers: No such process
```

If i add this config

/etc/conf.d/net 

```
config_eth0="172.16.77.42/16"

```

```
# ip route add 172.16.0.0/16 via 172.16.0.254 dev eth0 
```

route -n 

```
 # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

172.16.0.0      172.16.0.254    255.255.255.0   UG    0      0        0 eth1

172.16.0.0      0.0.0.0         255.255.0.0   U     0      0        0 eth0

```

```
 # ping -c5 172.16.0.254

PING 172.16.0.254 (172.16.0.254) 56(84) bytes of data.

From 172.16.77.42: icmp_seq=1 Destination Host Unreachable

From 172.16.77.42: icmp_seq=2 Destination Host Unreachable

From 172.16.77.42: icmp_seq=3 Destination Host Unreachable

From 172.16.77.42: icmp_seq=4 Destination Host Unreachable

From 172.16.77.42: icmp_seq=5 Destination Host Unreachable

--- 172.16.0.254 ping statistics ---

5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4002ms

pipe 4

```

I can add gw but i can't ping my network so i don't know what i do wrong?

----------

## DONAHUE

oops

----------

## wcg

I have this in /etc/conf.d/net:

```

routes_eth0="default via [inside ip address of router on my lan]"

```

At boot, the system enables a default route through that ip address.

Do you not have this in your /etc/conf.d/net file?

----------

## Mad Merlin

 *Kurogane wrote:*   

> Hi folks.
> 
> I'm having problem to setup my network
> 
> Here's the scenario: 
> ...

 

Your ping here shouldn't work, you don't have a default route and you don't have any routes to reach 172.16.0.254 with. Additionally, I would expect the route add to fail, again, because you don't have a route to the suggested gateway.

When you do this:

```

config_eth0="172.16.77.42/16"

```

172.16.0.254 becomes directly routable and you can ping it without adding additional routes. If you are in fact on a /16 subnet, then this is what you should do, no additional routing necessary.

----------

