OpenWrt Forum Archive

Topic: DHCP Client on WAN Port?

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

heya,

I have a Routerstation Pro with a DNMA92 wifi card.

I have installed OpenWRT on the router, and I'm able to boot it up, and SSH in.

My next step is to setup wireless, and install Luci, if possible. E.g:

http://www.ubnt.com/forum/showthread.php?t=13609

However, to do that I need to give the router internet access (i.e. to run opkg).

I have a Billion 5200S ADSL2+ modem, that is able to connect to the inernet via PPPoE. I've set this up to do the authentication/connection in the modem itself. The modem has an in-built DHCP server, and an Ethernet port - if you plug a device into this port, it will obtain an address, and have internet access.

I've plugged the modem into the WAN port on the Routerstation, and it doesn't automatically pickup an address.

Is there something I need to do to get the router to act as a DHCP client on the WAN port? (I'm assuming I can't do PPPoE on the router until I install the packages, and to do that, I need to get internet access first).

Cheers,
Victor

PPPoE is usually there by default and DHCP client on WAN is the default setting.
Try this:

uci set network.wan.proto=pppoe
uci set network.wan.username=...
uci set network.wan.password=...
uci commit network
ifup wan

To revert to DHCP:

uci set network.wan.proto=dhcp
uci commit network
ifup wan

Type "logread" to debug.

heya,

I tried the the connection using DHCP on the WAN port:

root@OpenWrt:~# ifup wan
root@OpenWrt:~# udhcpc (v1.18.4) started
Sending discover...
Sending select for 192.168.1.100...
Lease of 192.168.1.100 obtained, lease time 86400
udhcpc: ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast +
udhcpc: setting default routers: 192.168.1.254
udhcpc: setting dns servers: 192.168.1.254

At this point, it seemed to stall at that command, however, if I press enter, it gives me back a command prompt.

I try to ping Google, no luck:

root@OpenWrt:~# ping google.com
^C

Likewise with running an opkg update:

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
wget: bad address 'downloads.openwrt.org'
Collected errors:
 * opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz, wget returned 1.

I checked logread:

Jan  1 00:03:10 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPRELEASE(lo) 192.168.1.139 00:15:6d:c7:95:f5 unknown lease
Jan  1 00:03:11 OpenWrt user.info firewall: removing wan (eth0) from zone wan
Jan  1 00:03:12 OpenWrt kern.info kernel: eth0: link down
Jan  1 00:06:14 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPREQUEST(br-lan) 192.168.1.146 00:23:54:97:31:03 
Jan  1 00:06:14 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPACK(br-lan) 192.168.1.146 00:23:54:97:31:03 myhost
Jan  1 00:06:19 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPDISCOVER(br-lan) 00:23:54:97:31:03 
Jan  1 00:06:19 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPOFFER(br-lan) 192.168.1.146 00:23:54:97:31:03 
Jan  1 00:06:19 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPREQUEST(br-lan) 192.168.1.146 00:23:54:97:31:03 
Jan  1 00:06:19 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPACK(br-lan) 192.168.1.146 00:23:54:97:31:03 myhost
Jan  1 00:06:41 OpenWrt authpriv.info dropbear[2040]: Child connection from 192.168.1.146:37196
Jan  1 00:06:46 OpenWrt authpriv.notice dropbear[2040]: Password auth succeeded for 'root' from 192.168.1.146:37196
Jan  1 00:06:52 OpenWrt authpriv.info dropbear[1240]: Exit (root): Disconnect received
Jan  1 00:06:57 OpenWrt kern.debug kernel: ar71xx: pll_reg 0xb8050010: 0x1099
Jan  1 00:06:57 OpenWrt kern.info kernel: eth0: link up (100Mbps/Full duplex)
Jan  1 00:06:57 OpenWrt user.notice ifup: Allowing Router Advertisements on wan (eth0)
Jan  1 00:06:58 OpenWrt user.notice rdate: Failed to sync with time-a.nist.gov
Jan  1 00:06:58 OpenWrt user.info firewall: adding wan (eth0) to zone wan
Jan  1 00:06:58 OpenWrt user.notice rdate: Failed to sync with ntp.xs4all.nl
Jan  1 00:06:58 OpenWrt user.notice rdate: Failed to sync with ptbtime1.ptb.de
Jan  1 00:06:58 OpenWrt user.notice rdate: Failed to sync with ptbtime2.ptb.de
Jan  1 00:06:58 OpenWrt user.notice rdate: Failed to sync with time-b.nist.gov
Jan  1 00:06:58 OpenWrt user.notice rdate: No usable time server for wan found
Jan  1 00:06:59 OpenWrt daemon.info dnsmasq[1227]: reading /tmp/resolv.conf.auto
Jan  1 00:06:59 OpenWrt daemon.info dnsmasq[1227]: using nameserver 192.168.1.254#53
Jan  1 00:06:59 OpenWrt daemon.info dnsmasq[1227]: using local addresses only for domain lan
Jan  1 00:12:33 OpenWrt kern.info kernel: eth0: link down
Jan  1 00:12:38 OpenWrt kern.debug kernel: ar71xx: pll_reg 0xb8050010: 0x1099
Jan  1 00:12:38 OpenWrt kern.info kernel: eth0: link up (100Mbps/Full duplex)
Jan  1 00:12:54 OpenWrt kern.info kernel: eth0: link down
Jan  1 00:12:56 OpenWrt kern.debug kernel: ar71xx: pll_reg 0xb8050010: 0x1099
Jan  1 00:12:56 OpenWrt kern.info kernel: eth0: link up (100Mbps/Full duplex)
Jan  1 06:06:23 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPREQUEST(br-lan) 192.168.1.146 00:23:54:97:31:03 
Jan  1 06:06:23 OpenWrt daemon.info dnsmasq-dhcp[1227]: DHCPACK(br-lan) 192.168.1.146 00:23:54:97:31:03 myhost
Jan  1 08:04:31 OpenWrt daemon.warn dnsmasq[1227]: no servers found in /tmp/resolv.conf.auto, will retry
Jan  1 08:04:32 OpenWrt user.info firewall: removing wan (eth0) from zone wan
Jan  1 08:04:33 OpenWrt kern.info kernel: eth0: link down
Jan  1 08:05:09 OpenWrt kern.debug kernel: ar71xx: pll_reg 0xb8050010: 0x1099
Jan  1 08:05:09 OpenWrt kern.info kernel: eth0: link up (100Mbps/Full duplex)
Jan  1 08:05:15 OpenWrt user.notice ifup: Allowing Router Advertisements on wan (eth0)
Jan  1 08:05:16 OpenWrt user.notice rdate: Failed to sync with ptbtime1.ptb.de
Jan  1 08:05:16 OpenWrt user.info firewall: adding wan (eth0) to zone wan
Jan  1 08:05:16 OpenWrt user.notice rdate: Failed to sync with time-a.nist.gov
Jan  1 08:05:16 OpenWrt user.notice rdate: Failed to sync with ntp.xs4all.nl
Jan  1 08:05:16 OpenWrt user.notice rdate: Failed to sync with ptbtime2.ptb.de
Jan  1 08:05:16 OpenWrt user.notice rdate: Failed to sync with time-b.nist.gov
Jan  1 08:05:16 OpenWrt user.notice rdate: No usable time server for wan found
Jan  1 08:05:44 OpenWrt daemon.info dnsmasq[1227]: reading /tmp/resolv.conf.auto
Jan  1 08:05:44 OpenWrt daemon.info dnsmasq[1227]: using nameserver 192.168.1.254#53
Jan  1 08:05:44 OpenWrt daemon.info dnsmasq[1227]: using local addresses only for domain lan
Jan  1 08:08:00 OpenWrt authpriv.info dropbear[2752]: Child connection from 192.168.1.146:54524
Jan  1 08:08:25 OpenWrt authpriv.warn dropbear[2752]: Bad password attempt for 'root' from 192.168.1.146:54524
Jan  1 08:08:28 OpenWrt authpriv.warn dropbear[2752]: Bad password attempt for 'root' from 192.168.1.146:54524
Jan  1 08:08:33 OpenWrt authpriv.warn dropbear[2752]: Bad password attempt for 'root' from 192.168.1.146:54524
Jan  1 08:08:34 OpenWrt authpriv.info dropbear[2752]: Exit before auth (user 'root', 3 fails): Exited normally
Jan  1 08:08:43 OpenWrt authpriv.info dropbear[2753]: Child connection from 192.168.1.146:54535
Jan  1 08:08:50 OpenWrt authpriv.notice dropbear[2753]: Password auth succeeded for 'root' from 192.168.1.146:54535

Is there anything else I need to get internet access on this unit? Or anything obvious I've missed?

Cheers,
Victor

victorhooi wrote:

Is there anything else I need to get internet access on this unit? Or anything obvious I've missed?

Yes, you missed the obvious fact that the WAN ip you got is in the same subnet as the LAN ip of the router.
Change the OpenWrt LAN ip to another subnet, e.g. 192.168.2.1 and everything should work as expected.

uci set network.lan.ipaddr=192.168.2.1
uci commit network
reboot

(Last edited by written_direcon on 29 Jun 2011, 23:19)

heya,

Aha, that worked smile. Thanks to both jow and written_direcon.

I set the LAN ip to 192.168.2.1, and it's now able to pickup an IP address via DHCP on the WAN port, and use it.

I've managed to run "opkg update", and install Luci.

I've also managed to enable wireless, after installing ath9k.

And then I managed to get PPPoE configured via Luci (ppp-mod-pppoe was already installed by default) - had to reset the DHCP lease on my laptop, but it worked after that.

The only thing now is figuring out how to enable dual-band with this wifi card (DNMA92) - it's on 802.11n, which is good, but it's on 2.4 Ghz. I can select a 5 Ghz band in Luci, but I think that will block out 2.4 Ghz - not sure how to enable both, or even to enable MIMO. Still, I guess that's a question for another post smile.

Cheers,
Victor

in my case, my LAN client got IP from WAN interface how can I stop that and let them get from Lan interface?

The discussion might have continued from here.