LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   NetworkManager & gprs/ppp DNS: after using wlan/eth0, DNS for ppp doesn't work (https://www.linuxquestions.org/questions/linux-networking-3/networkmanager-and-gprs-ppp-dns-after-using-wlan-eth0-dns-for-ppp-doesnt-work-627279/)

mtess 03-11-2008 12:22 PM

NetworkManager & gprs/ppp DNS: after using wlan/eth0, DNS for ppp doesn't work
 
Hi there,

I am currently using a laptop (running fedora 8), with ethernet/wireless at work, and NetworkManager does a great job for switching from one to another. At home however, I use a gprs phone for my internet connection, and to connect I use pppd, the script works fine. But konqueror (or any other app) doesn't get the proper DNS addresses. I have to manually enter the DNS numbers given by the connect script into the Network settings, and restart my network using service network restart (which I suppose is *not* the right way since network settings seems to deal with ethernet connections only - however it works).

So my obvious question is: what can I do? I already have a shortcut for "pppd call provider", I guess I could add the information to change the DNS info before calling pppd, but I don't really understand how (since in ifconfig ppp and eth0 are quite separate entities). Where *is* the place in fedora where you set the "master" or "current" DNS address (to which konqueror etc refer)?

I looked around to see if ppp can be added to networkmanager, but although I found discussion about it, I didn't find any info about how to do that.
Again I'm glad to have a command line (as I'll just add it to the connect script) to set the DNS (which by the way is static) at each connection...but as I said earlier, I really don't understand where the DNS is set.

Any help (or hint) is greatly appreciated.

Thanks,
mtess

Brian1 03-11-2008 03:56 PM

You could add to the script the ability to change the /etc/resolv.conf file. this is where DNS is saved. I personally do not use NetworkManager but I have several places I connect. I simply bring networking down, replace the needed config files with the files with the correct contents and bring networking backup.

Brian

mtess 03-12-2008 05:09 AM

Thanks Brian for the info about /etc/resolv.conf - this is one mystery about networking on fedora that is solved :)

I created a resolv.conf file in my home dir containting the right dns info, and whenever I connect using my phone, this file gets copied into /etc/ and network is restarted, prior to calling pppd.

I still am puzzled about the need to restart the network (and that thing checking for eth0 (taking time)) just for updating dns info.
I wish there was a way of adding ppp connections to networkmanager, would make the whole thing easier!

By the way, when using service network restart, does it execute a couple of ifconfig eth0 up (etc) kind of commands? If yes, service network restart could be bypassed, and only the right command for updating dns info could be used...?
If anyone has some info about this, please let me know!

Thanks again,

mtess

Brian1 03-12-2008 03:31 PM

When I bring networking backup I have all files like /etc/sysconfig/network-scripts/ifcfg-eth0, ifcfg-ath0, ifup-wireless, /etc/wpa_supplicant/wpa_supplicant.conf, and /etc/resolv.conf edit to the stat they need to be for that connection. Seems overkill maybe but I know exactly what each file is at the point of restarting the network service. Here is an example of one of my scripts.
Code:

#!/bin/bash
sudo /sbin/service network stop
sudo cp -f /etc/wpa_supplicant/lenard.wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
sudo cp -f /etc/sysconfig/network-scripts/ifup-wireless-nowpa /etc/sysconfig/network-scripts/ifup-wireless
sudo cp -f /etc/sysconfig/network-scripts/dhcp-ifcfg-ath0 /etc/sysconfig/network-scripts/ifcfg-ath0
ping -c2 127.0.0.1 > /dev/null
sudo /sbin/service network start
ping -c2 127.0.0.1 > /dev/null
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf > /etc/sysconfig/network-scripts/scripts/output/netinfo1
/sbin/ifconfig ath0 > /etc/sysconfig/network-scripts/scripts/output/netinfo2
/sbin/iwconfig ath0 > /etc/sysconfig/network-scripts/scripts/output/netinfo3
ping -c2 www.google.com > /etc/sysconfig/network-scripts/scripts/output/netinfo4
cat /etc/sysconfig/network-scripts/scripts/output/netinfo* > /etc/sysconfig/network-scripts/scripts/output/Netinfo
ping -c2 127.0.0.1 > /dev/null
xmessage -center -file /etc/sysconfig/network-scripts/scripts/output/Netinfo

Note I added a line in /etc/init.d/network script to kill wpa_supplicant on stopping the service. Also once everything is setup, copied, and started I run a ping and post to the screen info related to certain files. Just helps to make sure I selected the correct script.

Brian


All times are GMT -5. The time now is 06:47 PM.