# [Solved] Failure in /etc/init.d/net routing -Patch is posted

## derverstand

Hi,

Seems like in the last time, the quality of the gentoo updates is far away from acceptable. The routing in /etc/conf.d/net doesn't work since last update anymore!

Before it worked like this:

```

routes_eth0=( "default via defaultgateway" 

   "target_host1 gw gateway1" 

   "target_host2 gw gateway2" )

```

This one is broken now  :Sad: 

Now I have to do malware like:

```

function postup {

       route add default gw defaultgateway

       route add target_host1 gw gateway1

       route add target_host2 gw gateway2

}

```

What wrong with the release management? The should be a short description of these kind of changes before, the update is installed.

Best regards.Last edited by derverstand on Wed Aug 23, 2006 9:49 am; edited 1 time in total

----------

## drakkan

this is my unchanged configuration before and after baselayout update

```

routes_eth1=( "10.88.77.0/24 via 10.88.44.1"

              "10.88.11.0/24 via 10.88.44.1"

              "10.88.22.0/24 via 10.88.44.1"

              "10.88.33.0/24 via 10.88.44.1"

              "10.88.66.0/24 via 10.88.44.1"

              "10.88.88.0/24 via 10.88.44.1"

              "10.88.55.31/32 via 10.88.44.1"

              "192.168.0.0/24 via 10.88.44.1"

        )

```

please read /etc/conf.d/net.example   :Rolling Eyes: 

----------

## derverstand

Don't know what in your posting exactly the solution to the problem should be. It doesn't work for me with "via". And the netmask shouldn't be the reason. In fact I read the net.example carefully...

----------

## igrachev

well it seems that this might be the answer of my question

my last /etc/conf.d/net route was

route_eht0=( "default gw <gateway>" ) but now i got no connection 

as far as i understood i must edit it to

function postup {

        route add default gw <gateway>

}

Am I right ??

----------

## drakkan

 *derverstand wrote:*   

> Don't know what in your posting exactly the solution to the problem should be. It doesn't work for me with "via". And the netmask shouldn't be the reason. In fact I read the net.example carefully...

 

this is my complete config file (only public ip are stripped), note the routing parts posted also in the previous posts and the moduels=("iproute2")

```

modules=( "iproute2" )

config_eth4=( "10.3.10.253 netmask 255.255.255.0 broadcast 10.3.10.255" )

config_eth3=( "null" )

vlans_eth3="11 16"

vconfig_eth3=( "set_name_type VLAN_PLUS_VID_NO_PAD" )

config_vlan11=( "x.x.x.x netmask 255.255.255.128 broadcast x.x.x.127" )

config_vlan16=( "x.x.x.x netmask 255.255.255.128 broadcast x.x.x.127" )

config_eth1=( "10.88.44.99 netmask 255.255.255.0 broadcast 10.88.44.255" )

routes_eth1=( "10.88.77.0/24 via 10.88.44.1"

              "10.88.11.0/24 via 10.88.44.1"

              "10.88.22.0/24 via 10.88.44.1"

              "10.88.33.0/24 via 10.88.44.1"

              "10.88.66.0/24 via 10.88.44.1"

              "10.88.88.0/24 via 10.88.44.1"

              "10.88.55.31/32 via 10.88.44.1"

              "192.168.0.0/24 via 10.88.44.1"

        )

config_eth2=( "10.10.10.1 netmask 255.255.255.0 broadcast 10.10.10.255" )

config_eth0=( "null" )

vlans_eth0="12 14 15"

vconfig_eth0=( "set_name_type VLAN_PLUS_VID_NO_PAD" )

config_vlan12=( "10.0.1.253 netmask 255.255.255.0 broadcast 10.0.1.255" )

config_vlan14=( "10.88.99.254 netmask 255.255.255.0 broadcast 10.88.99.255" )

config_vlan15=( "10.111.59.254 netmask 255.255.255.0 broadcast 10.111.59.255" )

```

and this is the relevant part in /etc/conf.d/net.example:

```

# Here's how todo routing if you need it

#routes_eth0=(

#       "default via 192.168.0.1"               # IPv4 default route

#       "10.0.0.0/8 via 192.168.0.1"            # IPv4 subnet route

#       "::/0"                                  # IPv6 unicast

#)

```

----------

## derverstand

Hi,

I know the net.example. The problem is: Since I updated yesterday, my configuration isn't working anymore. Even if I substitute (gw,via) and insert the netmask as bitfield.

Best regards.

----------

## drakkan

 *derverstand wrote:*   

> Hi,
> 
> I know the net.example. The problem is: Since I updated yesterday, my configuration isn't working anymore. Even if I substitute (gw,via) and insert the netmask as bitfield.
> 
> Best regards.

 

iproute2 is installed? do you run etc-update? The config file I posted works also with the old baselayout so simply make the changes I suggested,

bye

----------

## UberLord

 *derverstand wrote:*   

> What wrong with the release management?

 

The software has been in ~ARCH for over a year so maybe it's lack of testers. Maybe you can help next time?

 *Quote:*   

> The should be a short description of these kind of changes before, the update is installed.

 

Well the routing example you gave works if you have a config_eth0 line. If you have an iface_eth0= line then it will not work.

----------

## derverstand

Okay, seems like its not clear enough. Here my full config:

```

modules=( "iwconfig" )

###

# TG3

######

mac_eth0="00:50:7F:0B:45:0E"

config_eth0=( "131.246.236.153 netmask 255.255.254.0" )

routes_eth0=( "default via 131.246.237.254" )

#       "131.246.236.81 gw 131.246.236.123" 

#       "131.246.236.44 gw 131.246.236.123" )

dns_servers=( "131.246.9.116" )

dhcp_eth0="nodns nontp nonis"

function postup {

        route add default gw 131.246.237.254

        route add 131.246.236.81 gw 131.246.236.123

        route add 131.246.236.244 gw 131.246.236.123

}

```

BEFORE: Everything ok with routes_eth0

AFTER: only with postup possible to set routes!

----------

## UberLord

OK, I see the error now

Try dropping this into /lib/rcscripts/net

http://dev.gentoo.org/~uberlord/baselayout/ifconfig.sh

Should fix it. Post back with results please  :Smile: 

----------

## derverstand

Works again  :Smile: 

The conf.d/net works like before.

Here the diff (old /lib/rcscripts/net/ifconfig.sh; your /lib/rcscripts/net/ifconfig.sh):

```

332c332

<       local iface="$1" ifvar=$(bash_variable "$1") x= y= metric= mtu=

---

>       local iface="$1" ifvar=$(bash_variable "$1") x= metric= mtu= cidr=

360,368c360,361

<               # Work out if we're a host or a net if not told

<               if [[ " ${x} " != *" -net "* && " ${x} " != *" -host "* ]] ; then

<                       y="${x%% *}"

<                       if [[ ${y} == *.*.*.* && ${y} != *.*.*.0 && ${y} != *.*.*.0/* ]] ; then

<                               x="-host ${x}"

<                       else

<                               x="-net ${x}"

<                       fi

<               fi

---

>               # Assume we're a net device unless told otherwise

>               [[ " ${x} " != *" -net "* && " ${x} " != *" -host "* ]] && x="-net ${x}"

```

Best regards!

----------

## UberLord

Hmmm, that diff is the wrong way around  :Wink: 

But glad it works - will be in baselayout-1.12.5

----------

