OpenWrt is not giving me an ipv4 address nor routing information

I am running OpenWrt 21.02.0 on a TP-Link Archer C7 AC1750. I installed it a week ago and everything has been going well. Today the I stopped having access to the internet several times. In all cases I could still see the Wifi SSIDs and still connect to them but I was not given an ipv4 IP address just a bunch of ipv6 stuff I do not understand. I tried a wired connection to the TP-Link and I have the same issue.
My laptop is a Thinkpad running Ubuntu 21.04. here are the outputs of route and ifconfig

brett@hamm:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

and

brett@hamm:~$ ifconfig 
enx3ce1a12664b3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fdfd:6a08:40d::f08  prefixlen 128  scopeid 0x0<global>
        inet6 fdfd:6a08:40d:0:c497:df15:1fa1:142  prefixlen 64  scopeid 0x0<global>
        inet6 2607:f2c0:eada:30:9e3d:adbc:13af:6738  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::6cbe:fe13:e1bd:358e  prefixlen 64  scopeid 0x20<link>
        inet6 2607:f2c0:eada:30:3334:b3c3:1a25:741b  prefixlen 64  scopeid 0x0<global>
        inet6 fdfd:6a08:40d:0:816e:fd15:99ab:4955  prefixlen 64  scopeid 0x0<global>
        ether 3c:e1:a1:26:64:b3  txqueuelen 1000  (Ethernet)
        RX packets 6612  bytes 675766 (675.7 KB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 1260  bytes 227917 (227.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 96317  bytes 8917408 (8.9 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96317  bytes 8917408 (8.9 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

When I plug directly into my cable modem I get an ipv4 address and can access the rest of the internet, so I do not think its is my iSP. The only thing that makes me believe that it might have somethign to do with my ISP is that the same strange thing happened once a month ago with OpenWrt 14.07-rc2 running on a D-Link DIR-835: I got only ipv6 stuff and no ipv4 address. The same thing happening with different versions of OpenWrt and different hardware make me wonder what is in common and ISP or laptops in the house are the only things I can think of.

Please let me know other information I can provide to help diagnose this issue

when you have no internet access, does the router have internet access?

I have no way to accessing the router so I do not know if it has internet access. I cannot even ping the router when I am connected to its SSIDs or connected with an ethernet cable. Is there some other way I can tell if it sees the internet?

Is the problem intermittent or are you essentially locked out of the router at this point?

Does this happen with all of your devices, or only the Ubuntu system?

No devices in the house can access internet. We have three linux laptops, one windows laptop and several android phones. I have not checked each to see if they are getting ipv4 addresses, but they cannot access internet for sure.

I am essentially locked out the wifi router (but still connected to its SSIDs and getting the ipv6 info I pasted above)

What changes did you make when you configured the router (relative to the defaults, aside from enabling wifi)?

Have you tried setting a static IPv4 address on your linux system to see if you can access the router (obviously you need to remember what subnet you were using; the default is 192.168.1.0/24)?

I have added a bunch of static DHCP leases, I allowed ssh into it with a specific port, and I installed a couple packages: zile and dropbear. I want to transfer some of my iptables settings from the D-Link DIR-835 but I have not done that yet

You installed dropbear? I always thought that was part of the base install

1 Like

You are right, I think dropbear is already there.

I am trying a manual IP setting now and will report back

@jaromanda beat me to that -- I'm not sure why anyone would have needed to install dropbear.

@brettpim - try the static IP method first (on your linux box)... if that doesn't work, try failsafe mode to get into the router.

If you can get in, we need to know what is going on in your core files. Namely:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall

At a guess, you may have broken dnsmasq when you added the static DHCP leases (did you do it by editing the file or through luci?)

With the static IP I have access to wifi router. I am getting the output you requested

root@OpenWrt:~# cat /etc/config/network 

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

config globals 'globals'
	option ula_prefix 'fdfd:6a08:040d::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth1.1'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.0.248'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device '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'

root@OpenWrt:~# cat /etc/config/dhcp 

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	list ra_flags 'none'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config host
	option name 'erskine'
	option dns '1'
	option ip '192.168.0.247'
	option mac 'xx:xx:xx:xx:xx:xx'

config host
	option name 'max2play'
	option dns '1'
	option mac 'xx:xx:xx:xx:xx:xx'
	option ip '192.168.0.246'

config host
	option name 'squeezebox-pi'
	option dns '1'
	option mac 'xx:xx:xx:xx:xx:xx'
	option ip '192.168.0.244'

config host
	option name 'extender'
	option dns '1'
	option ip '192.168.0.249'
	option mac 'xxx'

config host
	option mac 'xxx'
	option ip '192.168.0.41'
	option name 'HPm476dw'
	option dns '1'

config host
	option mac 'xxx'
	option name 'htle'
	option dns '1'
	option ip '192.168.0.15'

config host
	option mac 'xxx'
	option name 'extender2'
	option dns '1'
	option ip '192.168.0.249'
root@OpenWrt:~# cat /etc/config/firewall 
config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option src_ip		fc00::/6
	option dest_ip		fc00::/6
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT

# allow interoperability with traceroute classic
# note that traceroute uses a fixed port range, and depends on getting
# back ICMP Unreachables.  if we're operating in DROP mode, it won't
# work so we explicitly REJECT packets on these ports.
config rule
	option name		Support-UDP-Traceroute
	option src		wan
	option dest_port	33434:33689
	option proto		udp
	option family		ipv4
	option target		REJECT
	option enabled		false

# include a file with users custom iptables rules
config include
	option path /etc/firewall.user


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option dest		wan
#	option proto	tcp
#	option target	REJECT

# block a specific mac on wan
#config rule
#	option dest		wan
#	option src_mac	00:11:22:33:44:66
#	option target	REJECT

# block incoming ICMP traffic on a zone
#config rule
#	option src		lan
#	option proto	ICMP
#	option target	DROP

# port redirect port coming in on wan to lan
#config redirect
#	option src			wan
#	option src_dport	80
#	option dest			lan
#	option dest_ip		192.168.16.235
#	option dest_port	80
#	option proto		tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#	option src		wan
#	option src_dport	22001
#	option dest		lan
#	option dest_port	22
#	option proto		tcp

### FULL CONFIG SECTIONS
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port	80
#	option dest		wan
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp
#	option target	REJECT

#config redirect
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port		1024
#	option src_dport	80
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp

I added static DHCP leases through luci

Two entries with same IP address would not work

3 Likes

I did that because my D-Link network extender keeps showing up with different MAC addresses and getting assigned an IP that is not what I have tried to assign to it. I will delete the second of those entries

also, your LAN ip is .248 ... and dhcp hands out .100 through to .249 ... not sure it would ever hand out .248 - but who knows what dnsmasq does

by the way, you could run

service dnsmasq status

to see if dnsmasq is running - with your erroneous entry - my guess is it is not

Good point about DCHP range including the router's IP. I will fix that.

I deleted the second static lease, rebooted router and tried to connect to it with DHCP and everything seems to be working. Thank you for your help.