[Gelöst] Keine DNS-Auflösung mehr trotz Internetverbindung / keine Webseiten angezeigt

schrauber

New member
Themenstarter
Registriert
13 Apr. 2008
Beiträge
607
[Gelöst] Keine DNS-Auflösung mehr trotz Internetverbindung / keine Webseiten angezeigt

hallo ubuntu-freunde,

komischerweise kann ich keine webadressen mehr auflösen (weder im internen netzwerk noch im internet).
bei eingabe der direkten IP läuft jedoch alles wunderbar.
die resolv.conf wird automatisch generiert und trägt auch den richtigen DNS-server.
das eigetnlich merkwürdige ist jedoch, dass die paketverwaltung / konsole einwandfrei funktionieren (programm-installation bzw. -updates)!

welche datei / welchen dienst sollte ich nochmal überprüfen bzw. neuinstallieren?

gruß und vielen dank,
schrauber

ps: es spielt keine rolle ob ich über wwan oder wlan ins netz gehe!
 
1. Da zeigt mir meine Frau auch einen Vogel :D

2. Kommt die Tage, sobald ich am Laptop bin räume ich das Skript auf und poste es hier.

PS:
Bei mir ist es etwas anderes, wenn ich zuhause bin im Wlan habe ich immer den VPN-Tunnel. Es geht also
immer alles (Email, surfen, etc.) über VPN. Wenn ich unterwegs bin dann startet kein VPN automatisch,
dort wird dann bei Bedarf eines der konfigurierten VPNs über das Applet-UI verbunden.
 
Wie versprochen hier meine Skripte :)

Zuerst das Dispatcherskript /etc/NetworkManager/dispatcher.d/02runcmd (nicht so schön wie das
von fishmac, da besteht noch Optimierungspotenzial :D):
Code:
#! /bin/sh

IFACE=$1
STATUS=$2

case "$STATUS" in
	up)
		ESSID="`iwconfig $IFACE 2>&1 | grep ESSID | sed -e's/.*ESSID:"\(.*\)"/\1/' -e's/ //g'`"

		case "$ESSID" in
			'MyWlanSSID')
				# Start my home vpn...
				echo "Starting 'MyVPN' VPN"
				/usr/local/bin/nm-startvpn 'MyWlan' 'MyVPN'
				;;
		esac

		;;
esac

exit 0

Die Strings 'MyWlan' und 'MyVPN' entsprechen den Verbindungsnamen im Network-Manager. Der String
'MyWlanSSID' entspricht der SSID zu der gerade verbunden wurde.

Hier das tatsächliche Connect-Skript /usr/local/bin/nm-startvpn:
Code:
#!/usr/bin/python
#
# Original script was from 'Tambet Ingo' and can be found under
# [url]http://mail.gnome.org/archives/networkmanager-list/2009-February/msg00098.html[/url]
#
# Modified by dotzball to use it with various (VPN) connections, just call the
# script with connection names (as configured in NM) as argument:
#       nm-startvpn <active connection> <vpn connection>
# e.g.
#       nm-startvpn 'MyWlan' 'MyVPN'
# If the given <active connection> is connected/active, the <vpn connection> will
# be connected by this script.
# The only thing to hardcode/change in this script is the UID of the owner of the
# connection(s).

# Run this script without any arguments to list the available connection uuids.

# The uuid of the VPN connection to activate
#VPN_CONNECTION_UUID="58e0ba6b-bb82-496e-9bfa-5541ed53b01c"
VPN_CONNECTION_UUID=""

# The uuid of the connection that needs to be active to start the VPN connection
#ACTIVE_CONNECTION_UUID="00b81190-86bb-4ca6-954e-6501a94ae6c0"
ACTIVE_CONNECTION_UUID=""

# UID to use. Note that NM only allows the owner of the connection to activate it.
#UID=1000
UID=1000

import sys
import os
import dbus
from dbus.mainloop.glib import DBusGMainLoop
import gobject

DBusGMainLoop(set_as_default=True)

def get_connections():
    bus = dbus.SystemBus()
    proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', '/org/freedesktop/NetworkManagerSettings')
    iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings')
    return iface.ListConnections()


def get_connection_by_uuid(uuid):
    bus = dbus.SystemBus()
    for c in get_connections():
        proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
        iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
        settings = iface.GetSettings()
        if settings['connection']['uuid'] == uuid:
            return c

    return None


def list_uuids():
    bus = dbus.SystemBus()
    for c in get_connections():
        proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
        iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
        settings = iface.GetSettings()
        conn = settings['connection']
        print "%s - \'%s\' (%s)" % (conn['uuid'], conn['id'], conn['type'])

def set_uuids():
    global ACTIVE_CONNECTION_UUID
    global VPN_CONNECTION_UUID
    bus = dbus.SystemBus()
    for c in get_connections():
        proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', c)
        iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
        settings = iface.GetSettings()
        conn = settings['connection']
        if sys.argv[1] == conn['id']:
            ACTIVE_CONNECTION_UUID = conn['uuid']
            #print "Active Connection: " + ACTIVE_CONNECTION_UUID
        if sys.argv[2] == conn['id']:
            VPN_CONNECTION_UUID = conn['uuid']
            #print "VPN Connection   : " + VPN_CONNECTION_UUID


def get_active_connection_path(uuid):
    bus = dbus.SystemBus()
    proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
    iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
    active_connections = iface.Get('org.freedesktop.NetworkManager', 'ActiveConnections')
    all_connections = get_connections()

    for a in active_connections:
        proxy = bus.get_object('org.freedesktop.NetworkManager', a)
        iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
        path = iface.Get('org.freedesktop.NetworkManager.Connection.Active', 'Connection')

        proxy = bus.get_object('org.freedesktop.NetworkManagerUserSettings', path)
        iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
        settings = iface.GetSettings()

        if settings['connection']['uuid'] == uuid:
            return a

    return None


def activate_connection(vpn_connection, active_connection):

    def reply_handler(opath):
        sys.exit(0)

    def error_handler(*args):
        sys.exit(1)

    bus = dbus.SystemBus()
    proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
    iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager')
    iface.ActivateConnection('org.freedesktop.NetworkManagerUserSettings',
                             vpn_connection,
                             dbus.ObjectPath("/"),
                             active_connection,
                             reply_handler=reply_handler,
                             error_handler=error_handler)


# Change the UID first if required
if UID != 0:
    os.setuid(UID)

#print "test 1"

# NM dispatcer always calls us with certain arguments.
# In case no arguments are provided, simply list currently known
# connections with their uuids to help with configuration
if len(sys.argv) == 1:
    list_uuids()
    sys.exit(0)

#print "test 2"

# get settings and find uuid of given connections
if len(sys.argv) == 3:
    #print "The first  argument was:", sys.argv[1]
    #print "The second argument was:", sys.argv[2]
    set_uuids()

#print "test 3"

# Are we configured?
if len(VPN_CONNECTION_UUID) < 1 or len(ACTIVE_CONNECTION_UUID) < 1:
    sys.exit(0)

#print "test 4"

vpn_connection = get_connection_by_uuid(VPN_CONNECTION_UUID)
if not vpn_connection:
    # Configured VPN connection is not known to NM, check VPN_CONNECTION_UUID.
    sys.exit(1)

#print "test 5"

active_connection = get_connection_by_uuid(ACTIVE_CONNECTION_UUID)
if not active_connection:
    # Configured active connection is not known to NM, check ACTIVE_CONNECTION_UUID.
    sys.exit(1)

#print "test 6"

# Is it already activated?
if get_active_connection_path(VPN_CONNECTION_UUID):
    sys.exit(0)

#print "test 7"

active_connection_path = get_active_connection_path(ACTIVE_CONNECTION_UUID)
if not active_connection_path:
    # The required connection isn't active at the moment
    sys.exit(0)

#print "test 8"

activate_connection(vpn_connection, active_connection_path)

#print "test 9"

loop = gobject.MainLoop()

#print "test 10"

loop.run()
 
  • ok1.de
  • ok2.de
  • thinkstore24.de
  • Preiswerte-IT - Gebrauchte Lenovo Notebooks kaufen

Werbung

Zurück
Oben