DHCP Server to Redirect any url to landing page

后端 未结 1 1016
温柔的废话
温柔的废话 2021-01-01 07:39

I have a linux DHCP server which I need to redirect all web traffic to a landing page which will have instructions on how to register their computer on the network.

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 07:59

    You appear to be trying to set up what's known as a captive portal.

    There are several components to this, one of which is indeed a DHCP server, but that's hardly the most critical one.

    A short overview

    Your network will have at the very least the following components:

    • DHCP server
    • DNS server
    • Gateway
    • A login system

    Clients will get an IP address from the DHCP server and will be told to use your DNS server and gateway.

    Solution 1: DNS based redirection

    Until users are logged in your DNS server replies with the IP address of the login web server. Take care to set a very low TTL on the DNS replies. You want to make sure the clients browser re-resolves the IP address after the login.

    This will quite likely cause problems for any application other than web browsing on port 80.

    Solution 2: TCP interception

    This is a slightly harder solution, but is likely to work better. The DNS server always returns the correct IP address for whatever web site the client is trying to reach. The gateway will redirect the TCP sessions on port 80 to the login server. All other packets should get an ICMP error reply (network unreachable for example).

    0 讨论(0)
提交回复
热议问题