Airport Computer-To-Computer Networks: DNS and DHCP

Discussion in 'macOS' started by Savings, Jan 3, 2007.

  1. Savings macrumors member

    Joined:
    Dec 16, 2006
    #1
    I've been scouring the net for information about how IP addresses are assigned when I create a Computer-To-Computer wireless network with the "create network" option in the AirPort menu on my Macbook Pro.

    What I'm wondering is how to configure my laptop to assign IP addresses via DHCP AND route all DNS requests to a DNS server running on my laptop. The ultimate goal of this is to create a portable wireless Intranet to host a few websites off a wireless network on my laptop for when I'm at school and my classmates and I don't have access to the outside internet.

    I've been able to find a boatload of DNS server implementations that run on Mac OS X but very little about configuring my DHCP server to assign a local DNS server to the users. Does this type of network setup even use a DHCP server by default? Or self-assigned IPs? Any information about DHCP with computer-to-computer networks would be very helpful. Thank.
     
  2. Kodex macrumors member

    Joined:
    Jan 30, 2003
    #2
    You are gonna need to be running a copy of Mac OS X Server to host your own DNS lookup
     
  3. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #3
    interesting, but I dont know if you would even need DNS services on a single subnet / local intranet. you wouldnt really even need routing tables, it's all point to point stuff generally.

    I'm interested also...
     
  4. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #4
    are you sure?

    /usr/sbin/named (on my MBP)

    ?
     
  5. Kodex macrumors member

    Joined:
    Jan 30, 2003
    #6
    Ive never tried using the terminal to modify settings of that nature, there is not GUI implemented though
     
  6. Savings thread starter macrumors member

    Joined:
    Dec 16, 2006
    #7
    I took a look at that. The reason that I want to run DNS is so that I can route all requests to websites (google, myspace, MacRumors, ect.) to a local webpage explaining that this network isn't connected to the internet but DOES run some services. Without DNS, the user would have to type in my IP address to see said web page and would receive error messages when they went to, say, google. The goal here is something akin to the captive portals used at wifi hotspots to route you to the login page, but I don't ultimately want them to login. I want them to browse my website running on the LAN.

    As far as running Mac OS X server goes, is it a feasible OS to use for both daily school use as well as running applications on? Or is it missing many of the regular OS X features that would impact regular client use?

    Essentially, I want to map my laptop's IP to a domain name then redirect all web traffic to sites other than mine on the LAN to my page using DNS to prevent errors.
     
  7. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #8
    kodex: you can pretty much get a 'manual' of your commands in terminal (shell) by typing "man commandname".. eg "man named" will give you a small manual about the BIND name server.

    superbovine: that link gives a general overview of the possibilities, but no real tech info for what 'savings' is looking for.

    what ever happened to sneaker-net? :)
     
  8. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #9
    I've done this kind of thing with IPTABLES, however it's not included in OS X that I'm aware of. You can issue some rules that will forward all port 80 (web) traffic to your own apache server, serving a default 'info' page, of some sorts...

    there is no doubt an easier, less 'techie' way to do this.. maybe google for some ideas, you shouldnt need any kind of DNS services to make this work, unless you specifically want only certain sites to redirect to your machine.
     
  9. Savings thread starter macrumors member

    Joined:
    Dec 16, 2006
    #10
    IPTABLES sounds easier than DNS to implement for this, but wouldn't forwarding ALL 80 traffic to a single page make it impossible to serve up more than one page, since any requests for sub-pages would be sent back to the start page? Or could I simply use an alternative HTTP port, like 8080, for the subpage links as a workaround?
     
  10. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #11
    you could certainly use an alternate port for your 'real' pages, with perhaps a link on the 'default page' that people can click on when they magically see your 'default page'.

    Otherwise, a DNS facility with bogus record files would be the way to go (to translate certain host names to bogus ones)

    I'd be hitting up some of the linux guru's out there with this kind of query :)
     
  11. Savings thread starter macrumors member

    Joined:
    Dec 16, 2006
    #12
    Yeah, I'll ask around on some linux sites too. Thanks for the tip. If the computer I install iptables on is the router, iptables entries will affect all clients on my router, not just my localhost connections, right?

    EDIT: Here's an article addressing iptables for Mac OS X, which references ipfw as the FreeBSD equivalent to iptables on the Mac.
     
  12. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #13
    iptables is pretty powerful, you can choose which hosts/subnets are in the rules, etc.

    I dont know of OS X is built to use IPTABLES, it's kernel stuff afterall.. hrmmm
     
  13. Savings thread starter macrumors member

    Joined:
    Dec 16, 2006
    #14
    I found some information on an Apple Mailing List at http://lists.apple.com/archives/darwinos-users/2002/Jul/msg00145.html which let me to think that natd redirect_port is the right way to do this. The problem is natd only seems to run when Internet Sharing is turned on.

    From a technical standpoint, is the AirPort network created by Internet Sharing in system preferences when sharing en0 (Ethernet) to en1 (airport) the same as "create network" in the AirPort menu?
     

Share This Page