Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1815 - Udhcpc on boot don't add default gateway and dns server #8506

Closed
openwrt-bot opened this issue Aug 25, 2018 · 6 comments
Closed

FS#1815 - Udhcpc on boot don't add default gateway and dns server #8506

openwrt-bot opened this issue Aug 25, 2018 · 6 comments
Labels

Comments

@openwrt-bot
Copy link

lupin-de-mid:

  • TP-Link Archer C7 v2
  • OpenWrt 18.06.1 r7258-5eb055306f / LuCI openwrt-18.06 branch (git-18.228.31946-f64b152)

  • I update my router from 15 with erasing of config.
  • setup WAN
config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' option macaddr '00:0F:EA:60:3D:30'
  • Dhcp work as expected returned ip and simple route
# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.40.62.0 10.40.62.5 255.255.255.0 UG 0 0 0 eth0.2 192.168.2.0 * 255.255.255.0 U 0 0 0 br-lan But no default gw added
  • After reboot i found in log
    Sat Aug 25 11:44:54 2018 daemon.notice netifd: wan (1297): udhcpc: started, v1.28.3
    Sat Aug 25 11:44:54 2018 daemon.err odhcp6c[1296]: Failed to send RS (Address not available)
    Sat Aug 25 11:44:54 2018 daemon.notice netifd: wan (1297): udhcpc: sending discover
    Sat Aug 25 11:44:54 2018 daemon.notice netifd: wan (1297): udhcpc: sending select for 10.40.62.76
    Sat Aug 25 11:44:54 2018 daemon.notice netifd: wan (1297): udhcpc: lease of 10.40.62.76 obtained, lease time 43200
- But if I run udhcpc by hand

~# udhcpc -i eth0.2
udhcpc: started, v1.28.3
udhcpc: sending discover
udhcpc: sending select for 10.40.62.76
udhcpc: lease of 10.40.62.76 obtained, lease time 43200
udhcpc: ifconfig eth0.2 10.40.62.76 netmask 255.255.255.0 broadcast 10.40.62.255
udhcpc: setting default routers: 10.40.62.5

And routing is like

~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.40.62.5 0.0.0.0 UG 0 0 0 eth0.2
10.40.62.0 * 255.255.255.0 U 0 0 0 eth0.2
192.168.2.0 * 255.255.255.0 U 0 0 0 br-lan

Workaround

  • Added to scheduled task
    */1 * * * * udhcpc -i eth0.2
@openwrt-bot
Copy link
Author

jow-:

Please provide your complete /etc/config/network and the complete output of "logread", "dmesg" and "ifstatus wan" after boot.

@openwrt-bot
Copy link
Author

lupin-de-mid:

~# cat /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 globals 'globals'
option ula_prefix 'fdff:bef3:6bb1::/48'

config interface 'lan'
option type 'bridge'
option ifname 'eth1.1'
option proto 'static'
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'
option macaddr '00:0F:EA:60:3D:30'

config interface 'wan6'
option ifname 'eth0.2'
option proto 'dhcpv6'

config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'

config switch_vlan
option device 'switch0'
option vlan '1'
option ports '2 3 4 5 0t'

config switch_vlan
option device 'switch0'
option vlan '2'
option ports '1 6t'

@openwrt-bot
Copy link
Author

lupin-de-mid:

Add log files

@openwrt-bot
Copy link
Author

be3m:

Got same error on TL -1043ND V1, constantly I get error, that default gateway not found on my windows machine!

@openwrt-bot
Copy link
Author

lvsv:

I found the reason.
After this commit 012d20e in
package/network/config/netifd/files/lib/netifd/dhcp.script i can't get correct routing.

The problem in this string
[ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"

ip_net and gw_net has the same value for me
ip_net=0.0.0.0
gw_net=0.0.0.0

My correct routing is
default via 53.111.32.1 dev eth0.2 src AA.20.100.BB
AA.20.100.0/24 dev eth0.2 scope link src AA.20.100.BB
53.111.32.1 dev eth0.2 scope link src AA.20.100.BB

To fix the problem, i removed check and left only
proto_add_ipv4_route "$i" 32 "" "$ip"

@openwrt-bot
Copy link
Author

dedeckeh:

What values do $ip and $mask have in your case as $ip_net is derived from $ip and $mask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant