Modify

Opened 11 years ago

Closed 6 years ago

Last modified 4 years ago

#1430 closed defect (obsolete)

compex interface config doesn't start the WAN

Reported by: chris@… Owned by: developers
Priority: high Milestone: Barrier Breaker 14.07
Component: base system Version: Trunk
Keywords: Cc:

Description

I am running pppoe on the wan (eth0.1), however my configuration is more complex as I also want the device eth0.1, to have a static IP address. I want to do this so that I can reach my ADSL modem from inside my network. This allows for snmp monitoring of the device, as well as easy reconfiguration.

To achieve this I have configured the following:

#### ADSL configuration
config interface        adsl
        option ifname   "eth0.1"
        option proto    static
        option ipaddr   10.0.0.1
        option netmask  255.255.255.0


#### WAN configuration
config interface        wan
        option ifname   "eth0.1"
        option proto    pppoe
        option username chris.martin
        option password ct1259ct1259

I find that the ADSL network is brought up OK at boot, but the WAN is not.

In order to get the WAN interface operational, I MUST issue a separate "ifup wan"

It would appear that when itteration over the config, it is assumed that there will only be one configuration set per device, when infact there can be more

Attachments (1)

01-parenting (473 bytes) - added by Roman Yepishev <roman.yepishev@…> 9 years ago.
iface hotplug script to bring up "children"

Download all attachments as: .zip

Change History (16)

comment:1 Changed 11 years ago by florian

I would use a virtual interface such as eth0.1:0 for the monitoring part, can you have a try ?

comment:2 Changed 11 years ago by chris@…

I'm using the latest snapshot r6947.
What I find is that when I ifup wan the adsl network is unreachable. and vise versa for ifup adsl

There is something in the interface config scripts that is stripping the IP config from the interface. What I do find is that if I manually config the interface

ifconfig eth0.1 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255

After the ppp0 interface is started, then ALL works well.

So there is defiantly something in the scripts causing the problem

The config that I used successfully in whiteRussian was

nvram set adsl_ifname="vlan1"
nvram set adsl_ipaddr="10.0.0.1"
nvram set adsl_netmask="255.255.255.0"
nvram set adsl_proto="static"

nvram set ppp_idletime="5"
nvram set ppp_mtu="1492"
nvram set ppp_passwd="Password"
nvram set ppp_username="Username"
nvram set pppoe_idletime="5"
nvram set pppoe_ifname="vlan1"

nvram set wan_device="vlan1"
nvram set wan_hostname="fw"
nvram set wan_ifname="ppp0"
nvram set wan_proto="pppoe"

comment:3 Changed 10 years ago by chris@…

I have just got back to looking in to this.
Using a virtual interface half works. How using 7.09 - if I configure eth0.1:0, I cannot use the interface in IP tables. I get the error:

Warning: weird character in interface `eth0.1:0' (No aliases, :, ! or *).

Also - virtual interfaces are not automatically started. when eth0 is iintilaised, the vlans are configured, but I still have to manually start the virual interface

further when starting the virtual interface with ifup adsl I get

ifconfig: SIOCSIFFLAGS: Cannot assign requested address
ifconfig: SIOCSIFFLAGS: Cannot assign requested address

my config for the virtual interface is

#### ADSL configuration
config interface        adsl
        option ifname   eth0.1:0
        option proto    static
        option ipaddr   10.0.0.1
        option netmask  255.255.255.0

comment:4 Changed 10 years ago by chris@…

I am getting closer to the cause of the problem
it appears that when pppd starts it resets the interface it in bound to. In this case eth0.1 - probably via the hotplug scripts.
The whole ifup ifdown etch is now quite complicated to trace through. does anyone have any pointers to the underlying structure to make it a bit easier

comment:5 Changed 10 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Should be fixed with [10175]

comment:6 Changed 10 years ago by chris@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

Just tested with 10850. The problem is still there

comment:7 Changed 10 years ago by anonymous

I have just had a look at the new ifup/ifdown scripts. They appear to be the problem

/etc/init.d/networks => /etc/rc.d/S40network calls "ifup" to initialise all the interfaces. They are initialised in the correct order ie:

lo loopback
eth0.0 lan
eth0.1 adsl
eth0.2 dmz
wl0 wifi
eth0.1 wan - pppoe via adsl interface 

This all good. The problem is that ifup explicitly calls ifdown. which removes the interface. If I modify if up so that it no longer calls ifdown. the interfaces start up correctly.
My revised ifup is

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

#. /sbin/ifdown "$@"
. /etc/functions.sh

include /lib/network
scan_interfaces

config_get iftype "$1" type
config_get ifname "$1" device

for dev in $ifname; do
echo "setup_device" $dev $1
        setup_interface "$dev" "$1"
done

I suspect that the correct way to resolve this would be to modify ifdown, so that if the proto was "pppoe" that it didn't reset the physical interface. I will look in to that nex

comment:8 Changed 10 years ago by chris@…

Opps sorry - just realised that the copy/past buffer comtained an old copy of my modified ifup script. it should be:

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

#. /sbin/ifdown "$@"
. /etc/functions.sh

[ $# = 0 ] && { echo "  $0 <group>"; exit; }
[ "x$1" = "x-a" ] && {
        config_cb() {
                [ interface != "$1" -o -z "$2" ] || eval "$0 $2"
       }
       config_load network
       exit
}
                                                
include /lib/network
scan_interfaces

config_get iftype "$1" type
config_get ifname "$1" device

for dev in $ifname; do
logger "setup" $dev $1
        setup_interface "$dev" "$1"
done

Just to recap.. this prevents the ifup from calling ifdown, this means that when the "wan" interface is brought up the "adsl" interface is no longer reset.
I am now working on a mod to ifdown, so that it will detect if the proto is pppoe, and not reset the physical interface.

comment:9 Changed 10 years ago by chris@…

There is a dependency problem here.
If I shutdown the adsl(static) interface (via ifdown adsl) & the wan(pppoe) is running over it, then it should also shut down the the wan(pppoe). But if I shutdown the wan(pppoe) (via ifdown wan) then the adsl interface should not be shutdown. The same should also apply to startup. ie: "ifup wan" should start both wan and adsl (assuming adsl is not already up), and "ifup adsl" should start only the adsl interface.

To achieve this I need to know what interfaces are stared, and what they are dependent on. The problem will also extent to GRE and IPSEC tunnels.

Especially when you look at running IPSEC => GRE => PPP => IP iinterface.

Does anyone know if this is being addressed anywhere. I see stuff in the scripts that would appear to indicate that there is some tracking of the interfaces state with commands like "uci_revert_state" but I don't seem to be able to find where they are defined - more later

comment:10 Changed 10 years ago by chris@…

I have been giving this a bit of thought, and I have looked through most of the network scripts. It strikes me that "ifname" and "device" are overloaded. It looks like these should be cleanly separated.

I propose that:

Leave "ifname" as the actual device/interface name

Create a new parameter "label" used as a friendly name for the interface ie: LAN, WAN, DMZ etc

modify the scripts so that they will work with either. ie: ifup WAN & ifup ppp0 do the same thing.

Create a 2nd parameter "bind" or "depends" - used in the case of ppp, pptp, gre, ipsec etc. This is used to identify the interface that these protocols depend on

This will allow the definition of dependencies and allow the development of a hotplug scrip that is run when ever an interface if brought up/down. This script would check the config and find any network definitions that where dependant on the change and would then "bring up" / "take down" those interfaces cleanly.

I am quite happy to do most of the work if this is deemed the correct approach. But will need a little help with understanding some of the nuances of the current scripts.

comment:11 Changed 9 years ago by roman.yepishev@…

I second that there should be some dependency checks on the startup/shutdown sequence.

This is applicable when ISP has a LAN and hosts some valuable resources in the intranet while requiring PPTP connection to be used to connect to the internet.

option interface wan
       option proto dhcp

option interface internet
       option proto pptp
       # over, after, init, master_is, depends etc.
       option after wan

comment:12 Changed 9 years ago by Roman Yepishev <roman.yepishev@…>

So far i introduced new configuration directive:

#### WAN configuration
config interface	wan
	option ifname	"eth0.1"
	option proto	dhcp
	
config interface		internet
	option proto	l2tp
	option username "login@internet.beeline.ua"
	option password "password"
	option server   10.0.0.9
	option ifname   "ppp0"
        
        # custom attribute
	option parent   wan

And hotplug script deals with this attribute. So far - only ifup, no ifdown or renew is supported ATM.

Changed 9 years ago by Roman Yepishev <roman.yepishev@…>

iface hotplug script to bring up "children"

comment:13 Changed 9 years ago by Roman Yepishev <roman.yepishev@…>

It's better to rename it to 15-parenting (and given some nicer name) because routes should be added first. Using this setup for a week or so and it looks like this can be really useful.

comment:14 Changed 6 years ago by nbd

  • Resolution set to obsolete
  • Status changed from reopened to closed
  • Version set to Trunk

comment:15 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.