Wednesday, January 5, 2011

How do I set custom DNS server in ChromeOS?

Unfortunately, this feature doesn't appear to be something that will necessarily be built into ChromeOS at any point soon. You'll have to be in Developer Mode to accomplish this.

First, get your MAC address using ifconfig, or via chrome://settings/internet > options > network (look for "Hardware Address").

Note that aa:bb:cc:dd:ee:ff is your Hardware (MAC) address.

Next, hit CTRL+ALT+T to drop to crosh. Then, type `shell`.

Run the following (note the MAC address):

dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" \
/device/aabbccddeeff/aabbccddeeff_0 \
org.chromium.flimflam.IPConfig.SetProperty string:"NameServers" variant:string:"8.8.8.8,8.8.4.4"

Once this is set, you can confirm the setting in chrome://settings/internet > options > network.

Keep in mind that the MAC addresses above should be entered in lowercase.

9 comments:

  1. Hrm, that didn't seem to work for me. It's telling me the object doesn't exist:

    $ dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" /device/48:5d:60:76:e3:53/48:5d:60:76:e3:53_0 org.chromium.flimflam.IPConfig.SetProperty string:"NameServers" variant:string:"8.8.8.8,8.8.4.4"
    3712: arguments to dbus_message_new_method_call() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1078.
    This is normally a bug in some application using the D-BUS library.
    3712: arguments to dbus_message_set_destination() were incorrect, assertion "message != NULL" failed in file dbus-message.c line 2551.
    This is normally a bug in some application using the D-BUS library.

    ReplyDelete
  2. Sorry, typo in the post. Try entering the MACs without colons. Thanks for catching that.

    ReplyDelete
  3. Ah, thanks for that. dbus is now finding the object, but I think I'm doing something wrong with the interface:

    $ dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" /device/485d6076e353/485d6076e353_0 org.chromium.flimflam.IPConfig.SetProperty string:"NameServers" variant:string:"8.8.8.8,8.8.4.4"
    Error org.freedesktop.DBus.Error.UnknownMethod: Method "SetProperty" with signature "sv" on interface "org.chromium.flimflam.IPConfig" doesn't exist

    Also, how would you go about finding these? Introspection on the object object doesn't seem to help:

    $ dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" /device/485d6076e353/485d6076e353_0 org.freedesktop.DBus.Introspectable.Introspect
    method return sender=:1.3 -> desk=:1.299 reply_serial=2
    string "<!DOCTYPE node PUBLIC "-//freedesktop/DTD D_BUS Object Introspection 1.0//EN"
    (http://www.freedesktop.org/standard/dbus/1.0/introspect.dtd")
    (node)
    (/node)
    "

    [Parens used instead of angle brackets -- stupid filtering!]

    ReplyDelete
  4. It's possible your device is named differently, but I'm not certain since I don't have another Cr-48 to test on.

    Look for your NICs node-name here:

    dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" /device org.freedesktop.DBus.Introspectable.Introspect

    Then,

    dbus-send --system --print-reply --type=method_call --dest="org.chromium.flimflam" /device/aabbccddeeff org.freedesktop.DBus.Introspectable.Introspect

    That should get you to the proper node/path.

    ReplyDelete
  5. Arg! Turns out I had capitalized my MAC address, and dbus-send is case-sensitive on the object names. Once I fixed that, everything worked.

    Thanks!

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Hi John,

    Great post. Any idea how I could use the "dbus-send" command to send a message to flimflam forcing the appropriate APN settings for my carrier: O2 - IRL = {"2722", "internet", NULL, NULL}. Used the modem_set_carrier "Generic UMTS" to switch on GSM. But now I can connect, plus I can't activate the Verizon data plan, because I'm in Dublin, Ireland. Anyway to bypass this activation, that you know of?

    Connection
    Service Name: Generic UMTS
    Technology: HSPA
    Activation status: Unknown
    Roaming status: Home network, not roaming
    Restricted IP: No
    Operator: O2 - IRL
    Operator code: 2722
    Error details: Connection failed

    ReplyDelete
  8. Hi, i am using CR-48
    i typied the same but it says: Failed to open connection to "session" message bus: Using X11 for dbus_deamon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS insteadd

    ReplyDelete
  9. Doesn't work on a Samsung 550C. "Method "SetProperty" with signature "sv" on interface "org.chromium.flimflam.IPConfig" doesn't exist"

    ReplyDelete