OpenWrt Forum Archive

Topic: Have to manually ifup wan and restart firewall to get internet

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I have strange problem.
I am building my own images for x86.
For some reasons, every time the PC is restart I have to manually access the router and restart the firewall.
I have no idea why this is happening.
Any ideas on this?

If you do /etc/init.d/<scripts> enable, it will create at least a start file under /etc/rc.d/Sxx<scripts> (perhaps, also /etc/rc.d/Kxx<scripts>) that will be loaded at boot time. The xx value is determined from the START variable found in the /etc/init.d/<scripts> file.

Hi,

okay, so i should do a
/etc/init.d/firewall enable
to create a S45firewall in /etc/rc.d/ ?
There is already a S45firewall in rc.d but it does not set up routing or forwarding as far as I can see (after ifup wan I can ping from the router but still have no inet from my pcs)

[EDIT]
Okay, the /etc/init.d/firewall enable seems to have fixed the routing and forwarding issue but I still have ifup wan manually. Have seen some tickets regarding this issue.

(Last edited by p90 on 9 Nov 2010, 23:15)

What's in the /etc/config/network?

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'netmask' '255.255.255.0'
        option 'dns' '192.168.0.1'
        option 'gateway' '192.168.0.1'
        option 'ipaddr' '192.168.0.1'

config 'interface' 'wan'
        option 'auto'   '1' -> doesn't matter if this is here or not
        option 'ifname' 'eth0'
        option 'proto' 'pppoe'
        option 'username' 'myusername'
        option 'password' 'mypassword'
        option 'keepalive' '10'

(Last edited by p90 on 10 Nov 2010, 14:23)

Please edit your post and use BBs code tags...

Startup scripts like "ifup eth0 &" can be added to /etc/rc.local.

Isn't "ifup -a" in /etc/init.d/network enough to bring up all interfaces including the wan interface?

/etc/init.d/network

start() {
        ifup -a
        /sbin/wifi up
        ifconfig eth0 up
}

BTW, br-lan and wan in a network configuration, which one comes up first?
For virtual wireless interfaces sta and ap in a repeater configuration, which one comes up first?
How to alter the boot up orders of these interfaces?

Okay, I now have found out that its a problem with dnsmasq apparently.
I get internet but no dns resolvs. really strange.

[EDIT] Okay, some part of my problem was that for some reasons dnsmasq did not find my own resolv.conf and sometimes used resolv.conf.auto
This is now fixed but even with the ifup wan at boot I have no internet without a manual ifup wan.

(Last edited by p90 on 19 Nov 2010, 01:54)

I found a cool working hack:

# Place me in /etc/hotplug.d/iface/99-keepwanalive

if [ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ]; then

  COUNTER=0
  PASS=0
  
  while [ $PASS -eq 0 ]
  do
    grep "up" /sys/class/net/eth0/operstate > /dev/null
  
    if [ $? != "up" ]; then
  
      let COUNTER++
      logger -t DEBUG "Attempt #${COUNTER} to reconnect wan"
  
      ifup wan
      sleep 15 #sec
      
    else
      PASS=1
    fi
  done

fi

It works very well.

The discussion might have continued from here.