I am unable to resolve host names when one(3g-cell) of my two interfaces is turned on. One interface is WAN(Ethernet), while the other is 3g-Cell.
When WAN is turned off, I tried to do manual curl request and I was able to do it using 3g-cell interface, but was unable to do that using hostname. (same happened with the ping – used terminal command
ping -I 3g-cell www.google.com
I think this is the issue with dns server or dhcp. Here, WAN seems to resolve DNS names correctly, while cell can’t.
(also I am working on OpenWRT(Linux))
I believe it has to do with some of these config files.
please let me know if you know about the issue.
Thanks.
/etc/config/dhcp:
config dnsmasq 'setup' option domainneeded '1' option boguspriv '1' option filterwin2k '0' option localise_queries '1' option rebind_protection '1' option rebind_localhost '1' option local '/lan/' option expandhosts '1' option nonegcache '0' option readethers '1' option leasefile '/tmp/dhcp.leases' option resolvfile '/tmp/resolv.conf.auto' option authoritative '0' option dhcpleasemax '40' option domain 'iobot-net' config dhcp 'lan' option interface 'lan' option leasetime '120m' option start '200' option limit '40' option dhcp_option '1,255.255.255.0 3,10.130.1.1 6,8.8.8.8,8.8.4.4' option dhcpv6 'disabled' config dhcp 'wan' option interface 'wan' option ignore '1' config odhcpd 'odhcpd' option maindhcp '0' option leasefile '/tmp/hosts/odhcpd' option leasetrigger '/usr/sbin/odhcpd-update'
/etc/resolv.conf:
nameserver 8.8.8.8 nameserver 8.8.4.4
/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 type 'bridge' option proto 'static' option dns '8.8.8.8' option ifname 'eth0' option netmask '255.255.255.0' option ipaddr '10.130.1.1' option gateway '255.255.255.255' config interface option ifname 'bat0' config interface 'mesh_0' option proto 'static' option mtu '1528' option ipaddr '10.10.1.20' option netmask '255.255.255.0' config interface 'wan' option ifname 'eth1' option proto 'dhcp' option defaultroute '1' config interface 'cell' option ifname 'ppp0' option proto '3g' option device '/dev/ttyACM0' option apn 'api.devicewise.com/api' option service 'umts' option defaultroute '0'
/etc/config/firewall
Advertisement
Answer
I found the way. The /etc/config/network file was missing the below line inside wan and cell interface.
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 type 'bridge' option proto 'static' option dns '8.8.8.8' option ifname 'eth0' option netmask '255.255.255.0' option ipaddr '10.130.1.1' option gateway '255.255.255.255' config interface option ifname 'bat0' config interface 'mesh_0' option proto 'static' option mtu '1528' option ipaddr '10.10.1.20' option netmask '255.255.255.0' config interface 'wan' option ifname 'eth1' option proto 'dhcp' option metric '40' config interface 'cell' option ifname 'ppp0' option proto '3g' option device '/dev/ttyACM0' option apn 'api.devicewise.com/api' option service 'umts' option metric '50'
you need to use different metric_number for different interface. metric_number depends on your priority. Here, I want Ethernet interface to work all the time but if it goes down then network should go on 3g-cell, that is why my metric_number for WAN is low.