networking - setup Mac Book Wifi interface as Wifi hotspot using specific DHCP option

07
2014-07
  • srjohnhuang

    I want to using my Mac Book as an access point.
    Besides that I also need to configure its DHCP server to not provide DNS info.
    For example, Mac Books AP's ssid is "MacBookHotspot".
    While my iPhone connected to "MacBookHotspot", I want the Wifi info displayed my iPhone would be looked like:

    IP ADDRESS
    DHCP(tab)
    IP Address    192.168.0.1
    Subnet Mask   255.255.255.0
    Router        192.168.0.254
    DNS           
    Search Domains
    Client ID
    

    (key point: DNS filed is blank)
    Does anyone have any good suggestion? Thanks!

  • Answers
  • srjohnhuang

    We can separate this into 2 major steps.
    1st, to setup your Mac as a Wifi router.
    2nd, to configure the router's DHCP options.
    1st step is easier, please try to follow the instruction of How to share Internet connection on a mac
    Note: There are two parts of this link, please check Sharing Wired Ethernet connection wirelessly (making a hotspot) part.

    After 1st step, we can see the Wifi icon of the Mac is changed to a wifi sharing icon. At the mean time, the system will auto generate a /etc/bootpd.plist file.
    Now click the Mac's wifi sharing icon, and close it. Open the file with your favorite editor, and you can see it includes the DNS settings like

                    <key>dhcp_domain_name_server</key>
                    <array>
                            <string>192.168.2.1</string>
                    </array>
    

    Now, please delete these lines, and save the file.
    Click the Mac's wifi sharing icon, and open it now.
    Done! You can use your iPhone to connect the Mac's SSID, and you will see your DNS is left blank now.

    p.s. If you want to configure more DHCP options, maybe you can refer to Running DHCP on Mountain Lion Server

  • CharlesH

    I will admit its been a while since I've done this however just tested again and it still works as I remember.

    So using Eethernet to the Mac Book for the internet access then you can share this internally as below:

    System Preferences – and clicked “Sharing”. on “Computers using option” – chose Airport.

    In AIRPORT OPTIONS, chose a name for the connection and entered security options.

    You however cannot change the DHCP options (actually this is not strictly DHCP but more IP passthrough). When I connect my phone to the shared connection it points DNS to my Mac and passes through the Ethernet for the outside world.

    Hope this helps.


  • Related Question

    linux - Dhcpd Daemon is trying to lease itself?
  • t0mm13b

    I have a Slackware Linux 13.0 box with two interfaces, eth0 and eth1. I have set this box up to be on the 192.168.1.0/24 network, with subnet mask of 255.255.255.0.

    I am trying to run a dhcpd server on this box to service two interfaces above, so I subnetted the 192.168.1.0/24 network into two subnets.

    • For eth0 192.168.1.1, subnet mask 255.255.255.128, broadcast mask 192.168.1.127.
    • For eth1 192.168.1.129, subnet mask 255.255.255.128, broadcast mask 192.168.1.255.

    Both the interfaces are assigned manually.

    eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
              inet addr:192.168.1.1  Bcast:192.168.1.127  Mask:255.255.255.128
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:1404 (1.3 KiB)
              Interrupt:11 Base address:0x8000 Memory:faffc000-faffcfff
    
    eth1      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
              inet addr:192.168.1.128  Bcast:192.168.1.255  Mask:255.255.255.128
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:10003 errors:0 dropped:0 overruns:0 frame:0
              TX packets:13286 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:1589229 (1.5 MiB)  TX bytes:9900005 (9.4 MiB)
              Interrupt:11
    

    Here is the dhcpd.conf set up

    authoritative;
    ddns-update-style interim;
    ignore client-updates;
    
    subnet 192.168.1.0 netmask 255.255.255.128 {
    
         range 192.168.1.2 192.168.1.126;
         default-lease-time 86400;
         max-lease-time 86400;
    
         option routers 192.168.1.1;
    
         option ip-forwarding off;
    
         option domain-name-servers 208.67.222.222, 208.67.220.220;
    
         option broadcast-address 192.168.1.127;
         option subnet-mask 255.255.255.128;
    }
    
    subnet 192.168.1.128 netmask 255.255.255.128 {
    
         range 192.168.1.129 192.168.1.254;
         default-lease-time 86400;
         max-lease-time 86400;
    
         option routers 192.168.1.1;
    
         option ip-forwarding off;
    
         option domain-name-servers 208.67.222.222, 208.67.220.220;
    
         option broadcast-address 192.168.1.255;
         option subnet-mask 255.255.255.128;
    }
    

    This is what is showing in the log

    Apr 10 18:09:58 inspiron8600 dhcpd: DHCPDISCOVER from 00:00:00:00:00:00 (inspiron8600) via eth1
    Apr 10 18:09:58 inspiron8600 dhcpd: DHCPOFFER on 192.168.1.131 to 00:00:00:00:00:00 (inspiron8600) via eth1
    Apr 10 18:10:01 inspiron8600 dhcpcd[3832]: eth1: adding IP address 169.254.153.6/16
    

    This is happening spuriously, and the log gets filled up with nonsense..it should be noted that 'inspiron8600' is the linux box that is running the dhcpd server. So my question is this:

    How do I stop this from happening? And why would it be trying to give itself a lease?

    I am sure I have missed something but cannot see it and would appreciate a pair of eyes from the community to spot the obvious flaw!

    To mention, the MAC's have been filtered out and replaced with 0's to protect the guilty!!!


  • Related Answers
  • mmv-ru

    Its strange behavior.

    1. Its not answer but HWaddr 00:00:00:00:00:00 look wery strange!
    2. Not strange that the dhcp server gives the address for self host. It give address for everybody who ask. Strange why dhcp client ask!
    3. If dhcp clien functionality not necessry dhcpcd (DHCP Client Daemon) can be stopped and disabled.
  • Niten

    I hope this isn't a dumb question, but have you checked to make sure you don't have dhclient or dhcpcd (I don't know which one Slackware uses) still running on the system? In Slackware you may still have to disable the DHCP client daemon manually, depending on how you assigned the system's static IP addresses.

    Does the following command show anything running?

    ps -C dhcpcd,dhclient