Hi,
I have following setup:
Internet <=ETH=> DSL Router <=ETH=> Linux (CentOS) m/c
Requirement:
When there is no physical connection between Internet and DSL Router, the DSL router should redirect any access to external site to an error page with message "No Physical Connection".
Issue:
When DSL Router is connected to internet, I can successfully browser internet from the Linux m/c. The DSL router (LAN IP 192.168.1.254) has DHCP server running and I use dhclient on the Linux m/c to get IP. Successful dhclient sets following on Linux m/c:
IP: 192.168.1.64
Gateway: 192.168.1.254
Nameserver (as in /etc/resolv.conf): 192.168.1.254
With these setting I can successfully browse say "www.google.com"
When I disconnect the connection between Internet and DSL Router, and browse to
www.google.com, I get standard "Address not found" page of Firefox. I used wireshark to trace the packets and I observed following:
1: DNS request to router for
www.google.com
2: DNS response from router with IP as 192.168.1.254
No further packets.
To isolate, I tried the same test on same setup with one change. I replaced Linux m/c with a Windows m/c and following was the observation in wireshark:
1: DNS request to router for google.com
2: DNS response from router with IP as 192.168.1.254
3: TCP handshake between Windows m/c and router
4: HTTP request to router with host as "www.google.com"
5: HTTP 302 response from router with location containing URL of custom error page
6: Browser displayed error page with message "No Physical connection".
Question:
One thing to note here is that DSL Router resolved
www.google.com to its correct address when there was Internet connection and the Linux m/c established further connection and was able to access google. However, when there is no internet connection, DSL Router resolved
www.google.com to 192.168.1.254. At this point the IP of
www.google.com is same as that of Default Gateway, which in turn is same as that of nameserver.
Does Linux treat this situation in a special way and doesn't attempt to connect to resolved IP? Is there a way this can be overridden through some config file changes??
The fact that it works fine with Windows, I don't think there is any issue with the DSL Router.
Thanks in Advance!
PS. This is my first post and sorry for the long post