I have a WiFi hotspot setup using Hostapd and Dnsmasq. Everything works great, but I'm trying to trigger the sort of Terms and Conditions page you might see at a hotel or coffee shop after you connect to their captive portal. Most modern devices will automatically bring up this Terms and Conditions page immediately after connecting to one of these captive portal networks, which is what I'd like to happen after connecting to my hotspot.  As I understand it this is usually detected by the device by checking to see if a specific website returns a predictable response. For instance Google seems to test a connection to http://clients1.google.com and if it gets any response other than "generate204" it should trigger the captive portal agreement page. I've found two ways to redirect all traffic (and presumably these specific domains) to a web server running on my device...  One by adding the following line to /etc/dnsmasq.conf:  address=/#/10.0.0.1   and the other by using iptables. This triggers from a script on boot:  iptables -t nat -A PREROUTING -d 0/0 -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1   Both succeed in redirecting all traffic to 10.0.0.1 (which is the correct address for the local web server) when manually entering a url into the browser, but the page doesn't open automatically upon connecting to the access point.  I've also tried manually adding entries for specific google URL's like:  address=/clients1.google.com/10.0.0.1   into the /etc/dnsmasq.conf with no luck. I've run out of ideas, any suggestions.
123522
I have a WiFi hotspot setup using Hostapd and Dnsmasq. Everything works great, but I'm trying to trigger the sort of Terms and Conditions page you might see at a hotel or coffee shop after you connect to their captive portal. Most modern devices will automatically bring up this Terms and Conditions page immediately after connecting to one of these captive portal networks, which is what I'd like to happen after connecting to my hotspot.  As I understand it this is usually detected by the device by checking to see if a specific website returns a predictable response. For instance Google seems to test a connection to http://clients1.google.com and if it gets any response other than "generate204" it should trigger the captive portal agreement page. I've found two ways to redirect all traffic (and presumably these specific domains) to a web server running on my device...  One by adding the following line to /etc/dnsmasq.conf:  address=/#/10.0.0.1   and the other by using iptables. This triggers from a script on boot:  iptables -t nat -A PREROUTING -d 0/0 -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1   Both succeed in redirecting all traffic to 10.0.0.1 (which is the correct address for the local web server) when manually entering a url into the browser, but the page doesn't open automatically upon connecting to the access point.  I've also tried manually adding entries for specific google URL's like:  address=/clients1.google.com/10.0.0.1   into the /etc/dnsmasq.conf with no luck. I've run out of ideas, any suggestions.
26174
when i type www.google.com how does the dns lookup work. According to my knowledge it first goes to the root server and finds out where the .com dns server is. Next it returns the ip address of that server. Next from there is finds out where the google server is. Now it returns a ip address and that would be the place where www.google.com is found.  So to resolve this two dns look ups are needed. Correct me if iam wrong.
26431
If several computers with local addresses (192.168.0.#) are connected to a router and each computer opens a web browser and requests a page over HTTP, when these TCP:80 packets are sent out, the router switches the local address with the static IP of the router (i.e. Provider given IP) so the server can reply to the appropriate address.   But how does the router know to which computer to forward the HTTP reply, since the TCP header does not contain the local IP address (does it?), and all computers are using port 80?  Does this have anything to do with the MAC addresses?   How exactly does this work?
21027
Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?  It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS hostnames.
41128
I just bought a  VPS hosting plan and was following this  to set up. In the "Setting the Hostname" section and "Update /etc/hosts " section, it says the FQDN/hostname to be set here does not need to be related with the websites I am about to host, which makes me confused.  I did my own research by reading lots of articles but am still not very sure what role the hostname/FQDN is playing in my web hosting business. Here are some basic facts I've managed to find out, feel free to correct me if anything wrong:   FQDN must be something like xxx.somedomain.com, if "xxx." is omitted then it is not a FQDN. the xxx, which I think could be loosely called a subdomain, can also be referred to as "hostname", according to . In my local machine, by adding the following line to the hosts file  63.117.14.58 www.yahoo.com whatever   every network requests for "www.yahoo.com" or "whatever" will be redirected to IP address 63.117.14.58(which is google.com's IP). It is a way to block unwanted sites in local machine.  Now the tutorial suggests adding this line to the "hosts" file in my server  12.34.56.78(//my server's IP) myhostname.anything.com myhostname   It mentions that in the above line, domain name may or may not be the domain I am about to host, but the hostname should be the one I have already set during previous steps. My questions are:  1)Based on Facts#3, I think this line redirects any requests on the server for myhostname.anything.com or myhostname to my IP address, but what does this mean? Shouldn't any request for myhostname.anything.com from a user's computer already be translated to a certain IP address(Be it or not my IP address)? Why do I have to redirect it on my server?  My understanding about how a HTTP request works is when user type in the domain name into the browser, the browser will contact the domain server, and the domain server will direct it to a DNS server based on the domain's DNS record, and then the DNS server will resolve the IP address, and then browser fetch data from that IP address. This procedure of my understanding seems having nothing to do with the "hosts" file on my server.  2) A.In regards of the FQDN, why the hostname has to be same with the hostname I set on my server and the domain name doesn't?   B.What will happen if I do set a different hostname here?   C.And what is the purpose to set or not set my domain name as the FQDN here?   D.And what will happen if I only set a FQDN but not the hostname? like this  12.34.56.78(//my server's IP) myhostname.anything.com   Lots of questions but I believe the answers to some of them are overlapped, and overall I think the big question is "What part does setting hostname/editting hosts file play in my webhosting business?"   Thank you for your time in advance.
98980
I am running ddwrt v24-sp2 on three WRT54GL routers. These routers all send their syslog information to the same remote server using syslogd  The problem is that in the logs the hostname will change between the LAN IP and 127.0.0.1.  This makes it hard to tell which device is doing what when I have several events listed as localhost and makes it impossible to script events to happen when certain syslog messages are received.   Does anyone know of any way I can differentiate which message comes from which host? Is there some option I did not see to for a tag or extra information into the message. Can I force the host to send its hostname with each message?  Here is an example of the syslog output:     06-28-2010 11:43:57    User.Info   10.255.255.2    Jun 28 17:43:58 : >Connecting to *.*.*.*      06-28-2010 11:43:54    User.Info   127.0.0.1   Jun 28 17:43:54 : >Connecting to *.*.*.*       06-28-2010 11:43:52    Daemon.Info 10.255.255.1    Jun 28 17:43:53 >chillispot[428]: chilli.c: 1088: Rereading configuration file and doing DNS lookup      06-28-2010 11:43:51    Daemon.Info 127.0.0.1   Jun 28 17:43:52 >chillispot[623]: chilli.c: 1088: Rereading configuration file and doing DNS lookup      06-28-2010 11:43:51    Daemon.Info 10.255.255.3    Jun 28 17:43:51 >chillispot[4185]: chilli.c: 1088: Rereading configuration file and doing DNS lookup   thanks  Chris
110584
I have a Toshiba z830 with ubuntu 12.04. I could use without problems the DSL connection (I have no router, only a modem) at home until a couple of days ago:   It stopped to work when while connected with the DSL connection via CiscoVPN (to my workplace), I had to leave the laptop unattended for a while and I guess the laptop tried to go to suspend. When I came back there were many messages on a black screen (sorry, I cannot attach an image because of my low reputation) and the laptop was not responding. I had to reset the it.   After rebooting it, the internet connection didn't work as did before (no browsing, no ssh, no skype, etc) although it says it is connected. I only can browse, etc when I connect to CiscoVPN to the same place where I was connected when it crashed.  When I am physically where I connected via VPN (at work) I can use the wireless, which I am not able to use now anymore since the incident described above.  Some additional information:  martillu@ubuntu:~$ cat /etc/resolv.conf   domain km.icrr.u-tokyo.ac.jp   nameserver 10.240.12.134   nameserver 10.240.12.135    martillu@ubuntu:~$ route -n   Kernel IP routing table   Destination Gateway Genmask Flags Metric Ref Use Iface   0.0.0.0 61.127.116.199 0.0.0.0 UG 0 0 0 ppp0   61.127.116.199 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0   169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ppp0    martillu@ubuntu:~$ ifconfig   eth0 Link encap:Ethernet HWaddr e8:e0:b7:2f:bc:5a   inet6 addr: fe80::eae0:b7ff:fe2f:bc5a/64 Scope:Link   UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1   RX packets:17620 errors:0 dropped:1 overruns:0 frame:0   TX packets:13168 errors:0 dropped:0 overruns:0 carrier:0   collisions:0 txqueuelen:1000   RX bytes:19452232 (19.4 MB) TX bytes:2568218 (2.5 MB)   Interrupt:20 Memory:c0700000-c0720000    lo Link encap:Local Loopback   inet addr:127.0.0.1 Mask:255.0.0.0   inet6 addr: ::1/128 Scope:Host   UP LOOPBACK RUNNING MTU:16436 Metric:1   RX packets:134 errors:0 dropped:0 overruns:0 frame:0   TX packets:134 errors:0 dropped:0 overruns:0 carrier:0   collisions:0 txqueuelen:0   RX bytes:36316 (36.3 KB) TX bytes:36316 (36.3 KB)    ppp0 Link encapoint-to-Point Protocol   inet addr:219.167.252.226 P-t-P:61.127.116.199 Mask:255.255.255.255   UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1454 Metric:1   RX packets:17608 errors:0 dropped:0 overruns:0 frame:0   TX packets:13129 errors:0 dropped:0 overruns:0 carrier:0   collisions:0 txqueuelen:3   RX bytes:18993590 (18.9 MB) TX bytes:2221195 (2.2 MB)    wlan0 Link encap:Ethernet HWaddr 9c:b7:0d:d9:21:f3   UP BROADCAST MULTICAST MTU:1500 Metric:1   RX packets:0 errors:0 dropped:0 overruns:0 frame:0   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0   collisions:0 txqueuelen:1000   RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)    I think that: domain km.icrr.u-tokyo.ac.jp in the resolv.conf may be suspicious, since if I am not connected via CiscoVPN I do not know why it should appear "km.icrr.u-tokyo.ac.jp" (this is where I connect via VPN).
64274
It seems there's no way to tell bind that *-foo.example.com should resolve to eg. 10.1.2.3, while *-bar.example.com resolves to 10.2.3.4. Is there any workaround? Can some names eg. resolve with an external program? Or should I change bind to eg. ?  I'm trying to avoid buying another SSL wildcard cert. (With wildcard certs, such as *.example.com, it's not possible to allow dots in the * part.)  Specifying all *-foo or *-bar names in the zone file is not an option, since I need to be able to create both type of addresses on the fly.
42125
Even though I have seen and read quite a few similar Q's I was still unable to understand what is required for me to be able to do this.  I have an internal network. One of the machines is a web server. The router is configured for NAT redirecting a specific port to to that machine.  A public domain name is configured using dynamic DNS to point to my external address.  So incoming communication hits the router from its WAN interface and gets pointed to the internal server on the right port.  But if I try to use my public domain name from another machine within my network if fails to be redirected to the server.    In a way I would like that the same NAT rules would apply not only to incoming traffic but to outgoing (sort-of) traffic and have it sent back to the right server.  Assuming this helps, my router (D-Link DSL-2760U) does support static routing, but I am not sure how to configure it. It has the following parameters:   IP Version DstIP/PrefixLength Gateway Interface Metric
90022
Is it possible to tell your router to redirect specific domains to a specific IP? The router is an Airport Extreme, unfortunately. If it can't be done with this specific router, is there another way to achieve this?
91607
I have a CentOS system that retrieves its upstream DNS servers via DHCP.  I want to run DNSMasq on this box and use it as a server to resolve some hostnames for development.  The problem is when my system starts, the upstream DNS servers are loaded into /etc/resolv.conf and THEN the DNS1 entry from my ifcfg-enp0s3 setup gets loaded.   That's a problem because when I query for the internal dev names, it tries to go out to the upstream DNS server instead of checking DNSMasq first.  I need the DNSMasq server to be at the TOP of the /etc/resolv.conf and the dhcp loaded ones at the bottom of the resolv.conf so that DNSMasq will work properly.  Any simple way to do that?
19253
Captive WIFI portals suck.  So often when I open in a browser (Desktop Chrome or Mobile Chrome) a HTTP site, I get the captive portal, but with auto-completion and so quickly I connect again to WIFI.  The problem is that after the captive portal redirects, I'll have also a HTTPS redirect and Chrome remember the certificate and to use only HTTPS.  So I cannot use the same site twice (in a session).  A well-known public HTTP only site will resolve this.  Well-known sites usually work, causing some less debugging of the WIFI connection.
82493
When I wake the laptop from the sleep I need to get the VPN state as I left it (turned on). Can't find the setting of autoconnect in VPN settings... Need some easy way to ask the system to autoconnect the VPN when the internet is available.  Edit based on comments:  Ubuntu 18.04 has no option to Always connect to VPN when using using this connection.
117648
I was using a Linksys Wireless-G router and a DSL modem for internet access in my house.  My desktop was connected via ethernet cable to the router, and all the other clients in the house were accessing the network wirelessly.  (The router connects to the DSL modem by ethernet cable also.)  Now I have switched to using a "Clear Spot 4G Personal Hotspot" which has no ethernet ports, just a USB port.  It's working great for all the wireless clients in the house.  And when I plug it into my desktop (which has no wireless adapter/device of any kind attached) I can access the internet through the hotspot's USB connection.  However I have found an odd conflict (which I could also use help with) -- when the hotspot is plugged in at the same time my USB TV Tuner is plugged in, the TV tuner doesn't work.  I can be watching TV, and plug in the hotspot, and suddenly the TV stream will just freeze and all attempts to access the device freeze the program attempting to do so, and I can't even shut down windows cleanly (system hangs on shutdown).  As soon as I unplug the hotspot, the TV programs become responsive again.  It took me a while to find the connection between this freeze on the TV tuner and the hotspot USB connection, but it's pretty clear.  So now I'm trying to find another way to access the wireless network without buying a wireless network adapter.  I tried configuring my Linksys Wireless-G router as a Gateway, but I don't think that works between wireless networks because there's no place to enter into the router the parameters of the wireless network that I want it to connect to, and the only connection I can make between my desktop and the Linksys WRT54G is an ethernet cable.  Am I missing something?  Is there a way to configure the Linksys router to "participate" in an existing wireless network, or do I just need to get a wireless network adapter?  I thought maybe I can try to set the router up with the exact same wireless network parameters that I am using on the hotspot, but that just seems like a recipe for conflicts... any chance it would work itself out and just form a larger version of the same network?
37226
This is a direct follow-on to . , I'd add the "-AlwaysAppendSearchDomains" argument to the mDNSResponder plist file so that all local resolver lookups added the search domains, regardless of whether there was a period in the label to be looked up. For example, whether I try to ssh to hostname foo.bar or foo, the search domain of baz.com should be tried, not only for the latter case, as was (and is) the default behavior.   Now, it looks like the mDNSResponder is gone, replaced with discoveryd. I cannot find a similar option to get it to always appending the search domain. Suggestions? I'd rather not go the route of using a non-default local resolver, but I'd consider it as an option. For now, I'll just type in the long FQDNs, but I'd really rather not.  Thanks, Pete
118305
My question is basically the same as .  I have two interfaces eth1 (10.0.0.2) and wlan0 (192.168.0.2). My default route is for eth1. Let's say I want all https-traffic to go through wlan0. Now if I use the solution suggested in the other question, https traffic will go through wlan0, but will still have the source-address of eth1 (10.0.0.2). Since this address is not routeable for the wlan0 gateway, answers won't ever come back. The easy way would be to just set the bind-addr properly in the application, but in this case it is not applicable.  I figure I need to rewrite the src-addr:  # first mark it so that iproute can route it through wlan0 iptables -A OUTPUT -t mangle -o eth1 -p tcp --dport 443 -j MARK --set-mark 1 # now rewrite the src-addr iptables -A POSTROUTING -t nat -o wlan0 -p tcp --dport 443 -j SNAT --to 192.168.0.2   Now tcpdump sees the outgoing packets just fine and ingoing packets arrive for 192.168.0.2, however they probably never end up in the application, because all I ever get to see, is that the application is resending the SYN-packet, although the SYN-ACK was already received.  So I thought, maybe I need to rewrite the incoming address too:  iptables -A PREROUTING -t nat -i wlan0 -p tcp --sport 443 -j DNAT --to 10.0.0.2   but that didn't work either. So I’m kind of stuck here. Any suggestions?
37347
I'm running Ubuntu server on a computer used as a wireless AP, but this AP should resolve all DNS requests to an internal IP address rather than actually performing the lookup.  I want to do the same thing that paid public WiFi hotspots do - you can connect but if you attempt to load any websites they show a default page. I've noticed that they do this by resolving all domains to an internal IP address.  I've added these lines to /etc/dnsmasq.conf:  # Add domains which you want to force to an IP address here. # The example below send any host in double-click.net to a local # web-server. address=/com/192.168.2.1 address=/uk/192.168.2.1 address=/org/192.168.2.1 address=/gov/192.168.2.1 address=/net/192.168.2.1 address=/us/192.168.2.1   which works fine for those TLD's, but I'd like to be able to do it with all domains so I can sleep at night.