Community
cancel
Showing results for 
Search instead for 
Did you mean: 
DDape
Novice
1,500 Views

Save the file /etc/resolv.conf, ping www.google.com using 3g module

Hi all,

I am following the instructions in : https://bovs.org/post/168/Building-Yocto-linux-for-Intel-Edison-with-3G-USB-modems-support https://bovs.org/post/168/Building-Yocto-linux-for-Intel-Edison-with-3G-USB-modems-support

I am using Wifi and 3G at the same time.

I can ping 8.8.8.8 but cannot ping www.google.com

Due to the DNS problem. After I run the command:

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Now I can ping www.google.com.

However, after rebooting the Intel Edison board, the /etc/resolv.conf will lost nameserver 8.8.8.8.

Can I save nameserver 8.8.8.8 in this file?

I have already try the systemd and /ect/init.d method, it doesn't work.

Thanks.

/Dapeng

0 Kudos
8 Replies
idata
Community Manager
137 Views

Hello dapenglan,

 

 

Thank you for interest in the Intel® Edison Breakout Board.

 

 

As you can see here https://communities.intel.com/thread/56555 https://communities.intel.com/thread/56555, changing the nameserver in /etc/resolv.conf has helped a community member solve an issue similar to yours.

 

 

Regards,

 

Andres
DDape
Novice
137 Views

Hi, Andres,

Thanks you for the reply.

If you read my question carefully, I mentioned that I solved the DNS problem. However, the file I modified didn't save after rebooting.

Best,

Dapeng Lan

idata
Community Manager
137 Views

Hello dapenglan,

 

 

I understand that you solved the DNS issue.

 

 

After you write echo "nameserver 8.8.8.8" >> /etc/resolv.conf, a file named resolv.conf, with the content nameserver 8.8.8.8, will be created in directory etc. To save this file you can open it with the vi (Linux screen-oriented text editor) and then "save and exit" with the :wq command. That will keep the file even after rebooting the board.

 

 

Another option will be to create a system service to run the echo "nameserver 8.8.8.8" >> /etc/resolv.conf command, so everytime you boot your board, the resolv.conf file will be automatically created with nameserver 8.8.8.8 on it.

 

 

If you need further information on how to create a system service, check this site https://communities.intel.com/docs/DOC-111103 https://communities.intel.com/docs/DOC-111103.

 

 

Regards,

 

Andres
DDape
Novice
137 Views

HI, Andres,

Thanks for the reply.

I can only save the file if I close down the WIFI function: systemctl disable wpa_supplicant

However, if I want to use the WiFi and 3g module at the same time, the nameserver 8.8.8.8 will still disappear after I reboot. The system service didn't work. I try it before.

It seems everytime restart the WiFi function, the file /etc/resolv.conf will be rewrite.

Do you know how to save the file while keep the WiFi function? Or maybe the nameserver can be set up when configuring the 3g module.

In the file /etc/ppp/peers/tele2, I found : usepeerdns . Is this command using to set up the nameserver?

Thanks.

/Dapeng Lan

idata
Community Manager
137 Views

Hello dapenglan,

 

 

I'll be needing more time to come up with information that you may find relevant. As soon as I find something that may help solve your issue, I'll contact you through this post.

 

 

Thank you for your patience.

 

 

Regards,

 

Andres
idata
Community Manager
137 Views

Hello dapenglan,

I found information that you may find relevant, please check this link https://wiki.archlinux.org/index.php/pppd https://wiki.archlinux.org/index.php/pppd, it mentions why is your file been overwritten.

 

Under the Configuration section (create connection configuration file): "If usepeerdns option is used, pppd will create the /etc/ppp/resolv.conf file with obtained DNS addresses while establishing a connection. By default, the /etc/ppp/ip-up.d/00_dns hook script moves this file to /etc/resolv.conf, allowing the system to use these name servers. If this is undesirable (e.g. you are using a local caching DNS), edit the /etc/ppp/ip-up.d/00_dns.sh as you need".

Based on the previous information, this is why your /etc/resolv.conf file gets overwritten. So what you need is edit the /etc/ppp/ip-up.d/00_dns.sh script to fit your needs.

I hope you find the previous information useful.

Regards,

 

Andres
idata
Community Manager
137 Views

Hello dapenglan,

 

 

I was wondering if you had the chance to try the suggestion provided.

 

 

Regards,

 

Andres
DDape
Novice
137 Views

Hi, I went out for a holiday and just come back.

I try the method above and didn't. But I successfully save the file by doing this:

chattr +i resolv.conf

Thanks for the help!

/Dapeng Lan

Reply