Adblocking with /etc/hosts and connman

I'm using the hostsblock package to create a custom hosts file.
Everything works fine with netctl+dnsmasq, but it doesn't with connman.
It seems connman redirects all traffic to itself by writing "nameserver 127.0.0.1" in /etc/resolv.conf
I can't ping anything. Even with a vanilla hosts file. Adding some other nameserver like "8.8.8.8" fixes the name resolving, but doesn't block ads. Dnsmasq is not working at the same time as connman.
Connman has a builtin dns caching server, but I can't find any documentation on how it works/how can it be configured.
Ideas?
Configuring my service profile with both nameservers fixed it. Isn't there a way to set a global nameserver?
Last edited by el mariachi (2014-01-19 13:55:58)

The best documentation I've found is the Connman API documentation.   You might find the API document at this link interesting: http://git.kernel.org/cgit/network/conn … xt?id=HEAD.  Particulaly the section in properties called Nameservers and Nameservers.Configuration.  It definitely answers your question about global nameservers.  This is the API documentation, but I've found it very helpful in explaining what I might need to do using connmanctl.
I'm not sure if any of the GUI programs would implement the feature you need, but I just took a look at connmanctl and this looked like it may have worked:
$ connmanctl
connmanctl> config wifi_00183991268a_426962624e65742d576972656c657373_managed_psk --nameservers 127.255.255.255
connmanctl> exit
Of course you will need to replace the service with name with the one that you are using on your system.  I also picked a nameserver I knew was wrong so I could see if the command actually "took".  The nameserver changed did seem to take.

Similar Messages

  • Help with the HOST and START, forms 6i

    Hi i like open to image with de Host and Start in Forms 6i.
    For example Host('start '||:path||'', NO_SCREEN ); -> is correct if the path is c:\ ... but if the path is more longer with space in white for example C:\Documents and settings ... i put the quotes "C:\Documents and settings ..." but Doesn't open the image, another window (MSDOS) open... :S

    Hello,
    Try this:
    Host('cmd /c START "" "' || :path || '" ');Francois

  • /etc/hosts and /etc/inet/hosts

    we're running Sol10x86 11-06 and notice that there's no link between /etc/hosts and /etc/inet/hosts as there has been on some previous versions. /etc/hosts is the only file that contains all of the info for our IPMP configuration, and that seems to be enough during reboot.
    what looks at /etc/inet/hosts? any danger in making /etc/inet/hosts a link to /etc/hosts?

    I don't have a copy of 11/06, but I've never seen a default installation of Solaris without that link.
    It's certainly there in 08/07. Is there any chance that whatever process is populating /etc/hosts on your machines is breaking that link?
    Darren

  • I'm having lots of trouble finding semi-decent equipment at an affordable price. I would like to start a podcast with two hosts and I have a macbook pro that i purchased in april 2011. any suggestions?

    I'm having lots of trouble finding semi-decent equipment at an affordable price. I would like to start a podcast with two hosts and I have a macbook pro that i purchased in april 2011. any suggestions?

    I should keep it simple - if you start getting involved with mixers and multiple microphones you will find the cost escalating  alarmingly. If you can get yourself a decent microphone and spend some time doing tests to find the best way of balancing the voices you should be able to get acceptable results. You can't plug an ordinary microphone directly into a Mac - you would need a mixer or a preamplifier - so it's probably worth looking at USB mics. I don't know what cost range is available, and you would have to check that they would work with your Mac. Otherwise you will need an ordinary moving-coil mic and probably a USB audio converter which can accept a microphone - look at the Roland site.

  • Lil' script to update adblockfilter, adblocking via /etc/hosts file

    hi, i've recently changed to adblocking via the hosts file (which works great btw), but i was missing  filtersetupdating like in firefox, so i've created with my limited scripting skills this one...
    # lil' script to update /etc/hosts adblock-filter
    #hosts adblock filter taken from this site...
    wget --directory-prefix=/tmp http://www.mvps.org/winhelp2002/hosts.txt
    #Backup /etc/hosts to /tmp
    cp /etc/hosts /tmp
    #standard static hosts file
    echo '# /etc/hosts: static lookup table for host names' > /etc/hosts
    echo '#' >> /etc/hosts
    echo '#<ip-address> <hostname.domain.org> <hostname>' >> /etc/hosts
    echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
    #add custom statc host configuration here
    echo ' ' >> /etc/hosts
    echo '###Ad-Blocking###' >> /etc/hosts
    cat /tmp/hosts.txt >> /etc/hosts
    echo '# End of file' >> /etc/hosts
    rm /tmp/hosts.txt
    enjoy!

    hosts_udate
    #!/bin/bash
    # 2012 Ontobelli for this script
    # make hosts temporal directory
    HOSTSDIR=~/.hostsupdate
    mkdir -p "${HOSTSDIR}"
    # make temporary directory
    TMPDIR=/tmp/hostsupdate
    mkdir -p "${TMPDIR}"
    # set output file
    OUTPUTFILE="${TMPDIR}/hosts"
    # set temporal file
    TMPFILE="${TMPDIR}/tmpfile"
    if [ ! -f "${HOSTSDIR}/hosts.local" ]; then
    echo "You need to create "${HOSTSDIR}"/hosts.local containing the hosts you wish to keep!"
    exit 0
    fi
    # download the mvps.org hosts file.
    wget -c -O "${HOSTSDIR}/hosts.mvps" "http://winhelp2002.mvps.org/hosts.txt"
    # download hpHOSTS
    wget -c -O "${HOSTSDIR}/hosts.hphosts" "http://support.it-mate.co.uk/downloads/HOSTS.txt"
    # download hpHOSTS Partial
    wget -c -O "${HOSTSDIR}/hosts.partial" "http://hosts-file.net/hphosts-partial.asp"
    # download hpHOSTS ad/tracking servers
    wget -c -O "${HOSTSDIR}/hosts.adservers" "http://hosts-file.net/ad_servers.asp"
    # download the pgl.yoyo.org hosts Peter Lowe - AdServers
    wget -c -O "${HOSTSDIR}/hosts.yoyo" "http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext"
    # download SysCtl Cameleon hosts
    wget -c -O "${HOSTSDIR}/hosts.sysctl" "http://sysctl.org/cameleon/hosts"
    # cat entries in a single file
    cat "${HOSTSDIR}/hosts.mvps" > "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.hphosts" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.partial" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.adservers" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.yoyo" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.sysctl" >> "${TMPFILE}0"
    # tabs to space
    sed -e 's/ / /g' "${TMPFILE}0" > "${TMPFILE}1"
    # find relevant lines without comments
    grep ^127.0.0.1 "${TMPFILE}1" > "${TMPFILE}2"
    # remove duplicate spaces
    cat "${TMPFILE}2" | tr -s [:space:] > "${TMPFILE}3"
    # remove carriage returns
    cat "${TMPFILE}3" | tr -d "\r" > "${TMPFILE}4"
    # 0.0.0.0 is nicer than constantly knocking on localhosts' door.
    sed -e 's/127.0.0.1 /0.0.0.0 /g' "${TMPFILE}4" > "${TMPFILE}5"
    # remove inline comments
    cut -d ' ' -f -2 "${TMPFILE}5" > "${TMPFILE}6"
    # sort blocklist entries and remove duplicates
    sort "${TMPFILE}6" | uniq > "${TMPFILE}7"
    # remove unneeded blocked sites
    grep -Ev ' dl.dropbox.com| host_you_want_to_whitelist' "${TMPFILE}7" > "${TMPFILE}9"
    # write the user's hosts.local to head, then the blacklists
    cat "${HOSTSDIR}"/hosts.local > "${OUTPUTFILE}"
    cat "${TMPFILE}9" >> "${OUTPUTFILE}"
    echo -e "# end of file" >> "${OUTPUTFILE}"
    # move to /etc/hosts
    mv "${OUTPUTFILE}" /etc/hosts
    # delete temporary directory
    rm -r -f "${TMPDIR}"
    hosts.local
    # /etc/hosts: static lookup table for host names
    #<ip> <hostname.domain.org> <hostname>
    127.0.0.1 localhost.localdomain localhost YOURHOSTSNAMEHERE
    ::1 localhost.localdomain localhost YOURHOSTSNAMEHERE
    # YOUR PERSONAL list
    # blocked list
    Create an alias in your ~/.bashrc
    alias hu='sudo /root/.hostsupdate/hosts_update'
    Run
    # hu <enter>
    Script and cache must be located in /root/.hostsupdate or modify scrip accordingly
    Cheers.
    Last edited by ontobelli (2012-02-15 09:15:17)

  • Socket functions and /etc/hosts and /etc/servi​ces

    I have verified that I con open a socket with either the host name or the IP address.
    But can I use either the port number or the service name (from /etc/services)?
    It allows me to use a string constant instead of a numeric, but it doesn't seem to work.

    The string form for the port number is specifically meant to use the NI Service Locator service and nothing else. It does not link into /etc/services or anything like that at all but is a proprietary service locator solution from NI. There exist LabVIEW VIs that one can use to both query this service as well as register new services. It can be found at vi.lib/Utility/ServLocInterface.llb. The actual service used to be programmed in LabVIEW around LabVIEW 7.0 but quickly was moved to a real system service at least on Windows. Not sure if other platforms still use the VI based service implementation or have a native service deamon too, for this.
    Theoretically it would be possible to create some translation program in LabVIEW that reads /etc/services and then registers them through the service locator API but I'm not sure I see a real benefit in this.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to restart an entire J2EE Cluster - With multiple hosts and instances

    I am looking for a definitive answer on the right way of Restarting an SAP Enterprise Portal CLUSTER without an ABAP stack.
    Currently the process is to use ssh into each box and either jcmon pf=<profile> then restart instance, or ssh into each host and run startsap/stopsap on each.
    Is there a better way?
    -Tim

    Hi,
    Please find the below SAP notes to understand the startup sequences.
    897933  Start and stop sequence for SAP systems
    936273  sapstartsrv for all platforms
    I would recommend you to check the below SAP link for more information.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e24f7b-1ba1-2b10-c0a0-e514b855624b?quicklink=index&overridelayout=true
    Regards,
    Naveen.

  • I'm struggling with /etc/hosts

    i know it's supposed to be something like
    127.0.0.1      banana.domain.org   localhost.localdomain      localhost    banana
    is that the number to use for everyone, or do i have a number i don't know anything about?
    i assume banana is to be replaced by the name of my computer, "fuscianator" and not my username, "fuscia", is that correct?
    what's this domain.org stuff? do i really just literally put down "domain.org"?
    do i really only have to replace "banana" with "fuscianator" and leave everything else the same?
    update: i went ahead and did the last thing, anyway. so far, nothing's blown up, though, nothing's all that different.
    Last edited by fuscia (2008-06-30 07:58:19)

    muunleit wrote:
    I think you have read this => Beginners Guide - hosts, did you?
    "banana" has to be replaced with your computers name.
    If you use dhcp, this should be all you need to change in hosts.
    i do use dhcp, so i don't need that 'domain.org' thing. thanks.

  • Zen Vision M:60 with USB host and Panasonic Camcorder SDR-

    I own a Panasonic Camcorder SDR-S0 which stores its data on a SD card. I'm thinking about buying the Zen Vision M:60 to use it as a sort of "imagetank" for importing the videos when on vacation. Normally the data on the SD card are transferred by connecting the camera to the PC & transferring them with the Panasonic software MotionSD studio .2E. Another possibility is using Pictbridge. The resulting format of the recorded data is mpeg2.When on vacation I don't have my PC with me & I would like to transfer the data on the Vision M:60. I read that for importing photos this should not give any problems, but no trace of user experience of importing video, without passing thru a PC. I did following test to check which sort of data are on the SD card before transmission to the PC, by reading the SD card with a USB cardreader?: it contained data with .MODextenstion (which is apparently a MPEG-2 codec), .MOI?extension files (which I think is not?needed) & a .PGI file?(which I think is needed?for?graphics printers ?). I copied one?MOV00B.MOD file to my PC and tried to play it. I succeeded without any problem to play it on Windows Media Player. My question : does anyone has any experience with the transfer of this sort of data to the Zen Vision M:60 using the USB host connected either to the digital camcorder or to a cardreader and then importing the .MOD files. If so, could the data be played back on the Vision M:60 ?Thanks for your help ?[color="#ff0000"]As I want to buy the Zen Vision M:60 (bargain price :smileytongue I hope someone with experience on this matter will respond urgently as I leave on holiday next week !!! [color="#ff0000"]Please help !!Message Edited by DEEJEE on 08-03-200705:28 AM

    According to the list of tested products here:?http://www.creative.com/products/pro...24&product=433?it's been tested on both Nikon Coolpix P3?and Nikon D200. So?I'd make the assumption that it probably does. It works with my Fuji S5600, and the list above shows they?only tested ?E900 and A600.

  • Problem with local host and server...

    Hi,
    I am facing a problem, I want to update tables that is in my local host server which is now I m using Access , and i want to update my values in server database which is MySQL, is dere any option to do dat...please help me out of dis problem...thanks

    Hope this works...
    Connection conn = java.sql.DriverManager.getConnection(url, username, password);
    Statement stat = conn.createStatement();
    int numberOfAffectedRows = stat.executeUpdate("UPDATE table_name
      + " SET column_name = new_value"
      + " WHERE column_name = some_value");

  • Running function with "Write-Host" and redirect output to file does nothing.

    Hello,
    I created this function:
    function TicketSolutionInformation {
    Write-Host "User has been created." -ForegroundColor Green
    TicketSolutionInformation | Out-File -filepath ("123" + ".txt") -append
    but the file 123.txt is always empty. Why ?

    Write-Host will write text to console, not pipepeline so you'll always get nothing.
    Consider changing function to this:
    function TicketSolutionInformation {
    Param(
    [switch]$Passthru
    Write-Host "User has been created." -ForegroundColor Green
    if($Passthru){
    "User has been created."
    }TicketSolutionInformation -Passthru | Out-File -filepath ("123" + ".txt") -append

  • Network-profiles (1) and /etc/hosts

    Hi everyone,
    i've got a few network-profiles, especially in one network I have to use a static ip to connect to the internet. The only entry in the /etc/hosts which works correctly - without any error messages - for me, is
    192.168.0.99 localhost.localdomain myhost
    If I use something like 127.0.0.1 in front and simply add my hostname at the end, I can't connect with the Inet, unfortunately. I did not test it, but I'm pretty sure, that this host configuration won't work in any other network, where I get a dynamic IP from the DHCP. Is there a possibility to write the content of the /etc/hosts with netcfg, like the /etc/resolv.conf for example?
    MfG Skit

    Because you didn't specify what localhost was in your hosts file. It only knows of localhost.localdomain(does not imply 'localhost') and acer being the loopback.
    I think he understood that.
    'localhost' is universally understood as the loopback.
    this is some kind of 'magic' answer isn't it? the resolving doesn't come out as a miracle... and that is IMHO what needs explanation.
    his computer alone doesn't (obviously) get it because sure, it's not set. now what 'magic' makes it known when a cable is plugged in? the computer tries to reslove locally (via /etc/hosts), fails at it, and then asks the dns server about it. so I reckon the dns server is instructed on replying '127.0.0.1' for a 'localhost' hostname request. why so? because dns servers have an option to look at their local /etc/host for resolving before delegating to bigger servers, so the dns server certainly has localhost matching 127.0.0.1 in his /etc/host, and blindly replies accordingly, oblivious to the fact that he is replying about his 'own' 127.0.0.1 to someone else.
    Last edited by lloeki (2008-01-16 08:24:12)

  • /etc/hosts Prank Gone Wrong, need help restoring files to original

    Some friends were messing around on my computer and playing a joke on me
    using the sudo pico /etc/hosts command they were able to send me from sites I wanted to visit, like facebook, to sites I didnt want to visit..
    what they wrote was:
    67.55.108.167 facebook.com
    67.55.108.167 www.facebook.com
    I have since deleted it but the every time I go to facebook from another sight I am still redirected. The odd part is that I can go to facebook, but only after ive been redirected. What I mean is, I try to go to facebook, get redirected, then try to go to facebook right away. If I do that it works fine. Also Safari is the only internet browser that is effected. Opera and Firefox are both un effected. I tried uninstalling and reinstalling safari as well as using the same command as they did, but in reverse. Still no luck. Any suggestion? Unfortunately they didnt back up the /etc/hosts before they edited it

    You might also want to flush your DNS cache
    dscacheutil -flushcache
    Also make that password change.
    Look in System Preferences -> Accounts to see if your friends added any new admin accounts or granted an existing account admin access.
    If they know how to create ssh-keygen keys, they could have deposited a key in your /private/var/root/.ssh/authorized_keys2 file.
    There are any number of additional tricks they could have done, if they had admin access. I'm just scratching the surface.
    If you do trust these friends, then most likely they just played with /etc/hosts. If they are the kind of friends that get malicious, I would consider the "nuke and pave" reinstall.

  • How to use /etc/hosts file

    how to get Mac OS "X" 10.6.x to use /etc/hosts file and/or /etc/resolv.conf file(s) (ala Unix-style); instead of using some other mechanism?

    I 'thought' that SnowLeopard (somewhere in the "Support" arena) told me that 10.6 (SnowLeopard) did NOT use /etc/hosts, but I am corrected, and now understand through a number of replies here (Apple-Support-Discussions) and other responses that SnowLeopard (10.6 (I'm at 10.6.7) DOES USE /etc/hosts... - AND YES _ I'm attempting to prevent some things, and have some web-site-development-things go to a local-server, etc. etc. etc. - but - I guess my 'answer' was supplied by a number of people and that my ...nix background and my familiarity with /etc/hosts is fine and working well...
    thanks to one and all who helped! - I'm now also well-acquainted with dscl, dscacheutil, and other such utilities...
    THANKSSSSS!!!!!!!

  • /etc/hosts, /etc/hostname.bgeN configuration

    I am writing this to get help.
    I have a Solaris 10 box.
    bash-3.00$ uname -a
    SunOS soft19 5.10 Generic_125100-10 sun4u sparc SUNW,Netra-240
    I have the following stuff on this box,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    #10.9.48.244 soft19 Secondary
    bash-3.00$ cat /etc/hostname.bge0
    soft19
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.48.244 netmask ffffff00 broadcast X.X.X.255
    In our code base, we have the following,
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    hp->h_addr_list[0] will give 10.9.16.121
    Everything is correct here!!
    Now I change the configuration a bit,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    #10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    10.9.48.244 soft19 Secondary
    and now
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but when I reboot the system, I get the following,
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 0.0.0.0 netmask ffffff00 broadcast X.X.X.255
    And I know this is because
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    Now I change /etc/hostname.bge1 to have just soft19
    and I reboot the system and what I see is this
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    Which is correct again!
    Now my question is
    With this
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    How can I get this even if the system reboots?

    Hi, Thanks, but I know this. And was expecting the same.
    But my question still remains unanswered..
    How to tweak /etc/hosts and /etc/hostname.bgeN files for....
    With this code
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    One more thing, I want to get this all the time, even my system reboots.
    I know a method to get below [by modifying /etc/hosts file]
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but this will not work when the system reboots? I am looking for a permanent solution.
    Thanks,
    Atul

Maybe you are looking for

  • Issue with Master and child relationship,viewlink

    Hi Frnds, In one of our custom pages we have Master child relationship between Invoice lines and their distributions. Things work absolutely fine when total no of distributions(say 10) are equal to max no of distributions that can be shown on 1st pag

  • Scan to PDF - F2210

    I am wanting to scan documents and save as a PDF, however I am not seeing pdf as a file type option in the save as file type dialog box.  The help says I am able to do this.  Hope someone can help. This question was solved. View Solution.

  • Preview in bin doesn't work in STP 3

    I send a multitrack from FCP 7 to STP 3, withing STP 3 I open the bin & select a file to audition, nothing happens & the play button is grayed out and not selectable. Same in the browser. I browse to a file on my HD, select it & it won't preview... A

  • Problems by moving folders - lost pictures

    Using LR 4.4 on OS X 10.7.5 I have transferred some folders from my internal drive to an external (FW) drive. Whereas most of the transfer worked fine, I had the following problems: - one folder (at least) completely disappeared from LR. The files we

  • Open a screen painter file

    Hi Dear; what is the sentence that open a screen painter file. thank you Dear.