Setting DNS with static IP config
- 
					
					
					
					
 Hi, I'm trying to use static IP for the Omega2, last firmware 0.2.0 (b194). 
 All works fine, except DNS setting.This is my /etc/config/networkfile config:config interface 'wwan' option ifname 'apcli0' option proto 'static' option hostname 'Omega' option ipaddr '192.168.1.95' option netmask '255.255.255.0' option gateway '192.168.1.1' option dns '8.8.8.8'After network config restart with command /etc/init.d/network restart, I try to ping to google with:root@Omega # ping google.com ping: bad address 'google.com'It can't resolve hostnames with static IP configuration. If I use DHCP config, no problem. My ifconfigoutput:apcli0 Link encap:Ethernet HWaddr 40:A3:6B:C1:44:0E inet addr:192.168.1.95 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::42a3:6bff:fec1:440e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)Anybody use static IP? Can share configuration files?. Thanks in advance! 
 
- 
					
					
					
					
 Hi i work in DHCP but with a static lease with the MAC Address of apcli0 (xxxxx0E for you but not the MAC Address of the Omega Label ) my router is a Mikrotik and this system work for all IOT (ESP 8266 / ESP 32 / 4Duino ...) Bye 
 
- 
					
					
					
					
 @Jean-Eudes-Quidet-0 said in Setting DNS with static IP config: Hi i work in DHCP but with a static lease with the MAC Address of apcli0 (xxxxx0E for you but not the MAC Address of the Omega Label ) my router is a Mikrotik and this system work for all IOT (ESP 8266 / ESP 32 / 4Duino ...) Bye Hi, It's no apply in this case, because I'm finding a solution without modify router setup. 
 
- 
					
					
					
					
 Maybe the dnsmasqprogram interferes? What does/etc/resolv.confsay?
 
- 
					
					
					
					
 @Maximilian-Gerhardt said in Setting DNS with static IP config: Maybe the dnsmasqprogram interferes? What does/etc/resolv.confsay?Maybe... I try all configurations in /etc/config/networkand/etc/config/dhcp, but it doesn't work.File /etc/resolv.confis modified bydnsmasqafter boot.
 
- 
					
					
					
					
 Well, I think is a problem of routing tables: Output of route -ncommand with DHCP (default device config):Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 apcli0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 apcli0 192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 apcli0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 br-wlanWith STATIC IP config: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 apcli0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 br-wlanSo, I route manually with command: 
 # route add default gw 192.168.1.1And voila, ping google.comworks...
 Complete config for static IPDevice IP address 192.168.1.95 and router/gateway in 192.168.1.1. Modify interface 'wwan' in file /etc/config/networkas follow:config interface 'wwan' option ifname 'apcli0' option proto 'static' option hostname 'Omega-XXXX' option ipaddr '192.168.1.95' option netmask '255.255.255.0' option gateway '192.168.1.1' option dns '8.8.8.8'If you use the Access Point (example a phone connected to Omega as Wi-Fi client) add DNS servers to /etc/dnsmasq.conffile:# Use public DNS servers for Access Point when # static IP is used for 'wwan' interface. server=8.8.8.8 server=8.8.4.4Add these commands to /etc/rc.localto update config on next boot:# ---------------------------------------------------------- # COMMANDS FOR STATIC IP CONFIG # ---------------------------------------------------------- # Add routing table (need it for STATIC IP config) route add default gw 192.168.1.1 # Restart Dnsmasq for update DNS servers (only Access Point) /etc/init.d/dnsmasq restartNext, rebootOmega.Check if the route -nhas a similar output:Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 apcli0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 apcli0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 br-wlanAnd ofcourse, try ping google.comcommand.ConclusionIn my humilde opinion there are a config bug for static IP, maybe Onion would fix it. References: [https://wiki.openwrt.org/doc/howto/dhcp.dnsmasq](link url) [https://wiki.openwrt.org/doc/uci/routing_in_ipv4](link url) [https://wiki.openwrt.org/doc/uci/network](link url) 
 
- 
					
					
					
					
 @Oximoron said in Setting DNS with static IP config: route add default gw 192.168.1.1 I tried that solution but I noticed that the Gateway configuration dissapears when the wifi disconnects from an AP. Has anyone found a better solution? 
 
- 
					
					
					
					
 Move route add default gw 192.168.1.1 to end of rc.common file work for me.