TechSpot

Networking a Mac and a PC both wirelessly and wired! *****s guide required.

By rednek
Jan 3, 2011
Post New Reply
  1. Hi

    I'm running a music studio with a PC (Win XP Home) and a MacBookPro (Snow Leopard).

    What I'd like to be able to do is the following:
    Have the PC and the MBP access the internet via their wireless connections (yup, I know, easy - done in fact),
    but also....
    Have the MBP and the PC talk to EACHOTHER via a wired connection: both machines have gigabit ethernet, and the mac, i'm told, will do the crossover automatically (ie negating the need for a crossover ethernet cable). I'd like to be able to transfer sets of large audio files from one machine to the other which, via wifi, takes forever; but I'd also like to have both machines access the internet independently of each other.

    I'm kind of asking if this is, in fact possible and, if so, how to do it.

    Also, what would be useful is to be able to run Synergy on both machines, so I can use the keyboard and mouse of the PC to operate both machines. This was easy when I had a PC laptop, but now I've switched to the mac, its all a bit different.

    Any help, suggestions, advice is, as always, extremely welcome.

    Kind Regards

    Red
  2. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    MBP?? What do you refer to?

    I have Win/XP, a Mac OSX, and RedHat linux all sharing files on the same subnet.
    Just connect (anyway you like to the router) and enable Print/File Sharing on all system.

    Google File Sharing Mac and PC to get the setup
    here's one example
  3. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Hi JB,
    Many thanks for the quick response! MBP=mac book pro.
    Apologies for the ignorance, but will the method you suggest facilitate file sharing via ethernet only, and access to the internet via wifi only? This is what I need to be able to do.
    Kind Regards
    Red
  4. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    hmm; You want any system wired to the router to enable file sharing
    but at the same time, ONLY WiFi connections to have Internet access? very unique setup and could be complex to achieve.
    Before we launch off into left field, what is the concept you're attempting to implement; protect files from Internet access?
  5. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Correct. I have no wired internet access in the music studio, but can access the wifi in the house (next to the studio). Wifi will enable me to transfer files between the mac an PC, but it is so slow compared to gigabit ethernet and makes the transferring of large sets of audio files very time consuming.

    I could always switch off the wifi on one of the boxes and switch the ethernet port on I can get the fast transfer speeds, but it would be more convenient I didn't have to climb behind my rig every time I need to transfer a file.
  6. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    Let me show you the normal setup and then discuss it:

    The typical in-home LAN looks like
    Code:
    modem==router-----wired.systems
              |
              +- - (wireless) - - -  if so equipped - - other.systems
    
    File Sharing can be enabled on systems safely AS LONG AS
    you never port forward 137-139, 445

    Using various features of routers+firewalls, you can inhibit any unknown
    systems from accessing your router and/or at least deny file sharing to them.

    The above works well - - so why restrict wireless differently than wired? Can't you use this setup? If not, please clarify why not.
  7. SNGX1275

    SNGX1275 TS Forces Special Posts: 12,494   +292

    I think there might be some confusion. Here is how I see what rednek is saying:
    The problem is he doesn't have wired internet access, only wireless. He can share over wireless, but even Wireless N speeds suck compared to gigabit. He can achieve gigabit wired - without a router connecting them, by just using a regular cat-5 cable. He wants to share between the comps this way rather than wireless. So he is using a router, but wants that for wireless internet connectivity only.

    Its like, I have 2 laptops on the same table upstairs, wireless router is downstairs so I can't easily run a wire from each to the router. I can share files between them, but it has to travel over the air, which is slow compared to over a wire. So it would be ideal if I had a short cat-5 cable to just plug into each's ethernet port and send files that way.
  8. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Exactly right. Its the speed at which I can transfer the files between the two computers which will make the real difference.
  9. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    I need both PC and Mac able to access the internet independently if each other, as I cannot access the modem/router with cable, only wireless - its in a different part of the building and I'm not able to install a CAT5 network through the house. Also, even if I could, my router is only 100mb, and I could really use the speed of a gigabit connection.
  10. Leeky

    Leeky TechSpot Evangelist Posts: 4,378   +98

    So you want to connect both computers via Ethernet and take advantage of gigabit speed?

    I presume you can connect via wire though, because your above statement makes it sound like running cable in your house can't be done?
  11. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Yup, the mac and the pc spend a lot of the time in the same room, ie, when I'm working on music projects. And this is when I'd need the gigabit speed. However, the modem/router is not in this room, its in the main house and I can't run a cable to where it is., so have to access the internet via a wireless connection. Even if I could I'd still only get 100mb unless I bought a gigabit switch.

    I don't need a crossover cable, as the mac auto-detects, which is useful.
     
  12. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    I was only attempting to the the O.P. to see the simpilicity of using the router itself.

    Of course the alternative is
    Code:
    Modem===Router - - wifi - - system#1--wired---system#2
    You need to emable Internet Connection Sharing on the PC which will cause the
    NIC attached to the cable to have an forced address of 192.168.0.1 (gee thanks MS.) and the other side will be 192.168.0.2
    This then requires that your router not have these addresses and you will need to configure it
    for something like 192.168.1.1.

    The downside of this arrangement is system#1 must be running if system#2 is to have Internet access.

    There's a complicated alternative
    Code:
    Modem===Router - - wifi - - system#1--wired---system#2
                 |                                   ^
                 V                                   |
                 + - - - - - - - - - - - - - - - - - +
    
    but I have to jump off for a job - - I'll explain tonight
  13. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Its this second option which would be of most interest. Many thanks JB; hope the job goes well, and look forward to hearing from you soon.
  14. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    yea, I guessed as much :)

    Ok; everyone knows this part; just two wifi connections and both have Internet Service
    Code:
    Modem===Router - - wifi - - system#1        system#2
                 |                                   ^
                 V                                   |
                 + - - - - - - - - - - - - - - - - - +
    
    With both systems running and connected to the router, you should be able to ping
    on system#1; ping system#2's address
    on system#2; ping system#1's address​


    here's the tricky addition
    Code:
    Modem===Router - - wifi - - [B]system#1---wired---system#2[/B]
                 |                                   ^
                 V                                   |
                 + - - - - - - - - - - - - - - - - - +
    Both wifi settings system#1 & #2 need the Gateway address to be that of the router. This you alread have if both have Internet Service.

    All the wired stuff will need static assignments on both sides. I'll refer to the new setup for wired as System#x Nic2
    (implying the wired connection. leave all wifi settings as-as).

    I also assume your router is at 192.168.0.1 (correct me as needed)

    First get the WiFi settings from system#1 using ipconfig /all and report
    • IP Address. . . . . . . . . . . . . : 192.168.0.4
    • Subnet Mask . . . . . . . . . . . : 255.255.255.0
    • Default Gateway . . . . . . . . . : 192.168.0.1
    • DHCP Server . . . . . . . . . . . : 192.168.0.1
    • DNS Servers . . . . . . . . . . . . : 8.8.8.8

    the above are used to seed the static settings.

    For now, focus on the config, not the how-to

    we config system#1 Nic#2 like
    • IP Address. . . . . . . . . . . . . : 192.168.11.2
    • Subnet Mask . . . . . . . . . . . : 255.255.255.0
    • Default Gateway . . . . . . . . . : 192.168.11.4
    • DHCP Server . . . . . . . . . . . : 192.168.0.1
    • DNS Servers . . . . . . . . . . . . : 8.8.8.8

    we config system#2 Nic#2 like
    • IP Address. . . . . . . . . . . . . : 192.168.11.4
    • Subnet Mask . . . . . . . . . . . : 255.255.255.0
    • Default Gateway . . . . . . . . . : 192.168.11.2
    • DHCP Server . . . . . . . . . . . : 192.168.0.1
    • DNS Servers . . . . . . . . . . . . : 8.8.8.8
    Notice the IP of one system is the gateway address in the other system.

    to make sharing much easier, let's call system#1 Mickey and system#2 Donald
    We add Mickey and Donald to the top of the
    \windows\system32\drivers\etc\hosts file like
    Code:
    # this one will already exist
    [COLOR="Gray"]127.0.0.1     localhost[/COLOR]
    ## you add these two
    [COLOR="Teal"]192.168.11.2  mickey[/color]
    [COLOR="Red"]192.168.11.4   donald[/color]
    
    Obviously you can use anything you like other than mickey and donald :)

    to get the updated hosts file to be used, we need to bounce (stop/restart) like this
    net stop "dns client"
    net start "dns client"​
    and the quotes are required.

    you should NOW be able to ping
    Code:
    on system#1;  ping system#2's address
       also ping donald
    on system#2;  ping system#1's address
       also ping mickey
    Once you can pind donald & mickey then \\donald\sharedDocs and \\mickey\\shareDocs will work.

    DO NOT USE INTERNET CONNECTION SHARING! this will just mess up the whole thing.
    Whatever firewall you are using, you enable Print/File Sharing on both systems.
    If necessary, you can manually configure network access
    Code:
    allow  in    tcp/udp  src-ip 192.168.11.* input-ports 137-139+445
    allow  out   tcp/udp  dst-ip 192.168.11.* output-ports 137-139+445
    Whew! let's see how you stand on just understanding the above concepts - - - -
  15. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Hi JB

    Many thanks for this. It WORKS!!!!! Lovely fast file transfer between mac and pc in the studio, and independent internet access. Top man!

    HOWEVER!!!

    The internet access only works on either machine when the ethernet cable is unplugged, ie, when there is no physical connection between the two machines. Its like as soon as you connect them via ethernet, they both look to that port for internet access, over-riding the wireless connection.

    I can easily just unplug the cable and have internet access immediately restored, but this is a little inelegant. It would be nice to be able to go on the net whilst waiting for files to transfer, for example.

    Would you know of a solution to this?

    Kind Regards

    Red
  16. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    Good Job Red :wave:
    I'll have to think about it ; get me some data please.

    connect everything and on Donald (system#2) run this

    ipconfig /all >sys2Tcp.txt
    netstat -r >sys2Routes.txt
    attach both to your follow-up
  17. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    system 2 (Donald) is a mac. Would you happen to know similar commands for the terminal console?
  18. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    I'll look it up, but substitute System#1 - - it's just as good
  19. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    fyi: for future use:

    Applications->Utilities->Launch Terminal
    (this is the Mac/FreeBSD interface aka xterm and ~like Windows Command Prompt)

    the command comparisons are
    Code:
    Windows      ->  Mac Equiv
    netstat -r       netstat -r
    ipconfig /all    ifconfig
    Not in the above cases, but sometimes you need root access.
    To do that, enter su with no parms and then enter the root password
    You can google for How to enable Root on OSX and if you do, be sure to give it a
    new password (and record it!)
  20. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Hi JB
    system 1 attached.
    Red

    Attached Files:

  21. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    Here's the scoop
    Code:
    Active Routes:
    Network Destination     Netmask          Gateway       Interface  Metric
              0.0.0.0       0.0.0.0      	192.168.1.1     192.168.1.3	  [COLOR="Red"]25[/COLOR]
              0.0.0.0       0.0.0.0     	192.168.11.[COLOR="Blue"]4[/COLOR]    192.168.11.2	  [COLOR="Red"]10[/COLOR]
    ....
    Default Gateway:      192.168.11.[COLOR="Blue"]4[/COLOR]
    
    the Metric for the WiFi is 25 and that of the ethernet is 10::
    ergo the ethernet link is considered to be 'faster' and is chosen as the Default Gateway :(

    You're going to need a script to correct this as TCP is making the choice for the Metric as the link becomes active.

    A) I assume you normally will have WiFi by default and the ethernet wired link sys#1->sys#2 will be far less frequently be active.

    B) so we'll fitz with the wired connection in the script. Sadly, you will need to do this on each system and the scripts will be different (aka Mac vs Win).

    [1] For the Windows Side: using Admin login or runas admin
    route -p add 0.0.0.0 MASK 0.0.0.0 192.168.11.4 METRIC 30 if 2

    [2]For the Mac Side: run under root (su)
    route -n add default -net 192.168.11.2 -netmask 0.0.0.0 -hopcount 30

    Suggest you address one system at a time, eg: use [1] by itself without -p to ensure wifi takes precedence when the ethernet is attached. You will be able to do one way actions PC=> mac and yet still browse.
    Once correct, add -p to [1]. Once you've used the -p,
    you should not need it again (but test after rebooting the pc to be sure)

    on [2]: run manually and then test for Mac=>PC and still able to use the browser.
    Once this works, the chore is to make it permanent

    Get a Terminal,
    su to root
    cd /etc
    ls rc.local
    if not found
    touch rc.local​
    look what you have ls -F rc*
    typically you'll see rc rc.boot rc.common rc.netboot [you just added rc.local]

    the RC file drives all the other stuff and the last logic in RC reads
    if [ -f /etc/rc.local ] then # if this file exists
    sh /etc/rc.local # then run it with the SH shell
    fi​

    Every time the network is started, rc.local will be the last thing attemped.

    Now edit /etc/rc.local and insert
    #!bin/sh
    route -n add default -net 192.168.11.2 -netmask 0.0.0.0 -hopcount 30
    exit 0
  22. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Many thanks for this JB. As luck would have it, my ISP is upgrading my line today, and I'm going to get intermittent internet access for the next 2 - 3 days!!! So rather than trying to work out if its the new config or the ISP preventing internet access I'm going to postpone this operation til after the weekend, when I shall resume in earnest, and will report back on the results of your last post.

    Once again, extremely grateful for your time and considerable expertise.

    Kind Regards

    Red
  23. jobeard

    jobeard TS Ambassador Posts: 13,369   +302

    I Expect one more issue to occur, but don't fret - -
    need to add specific route for 192.168.11.2 to 168.11.4 and
    converse on the other machine 192.168.11.4 to 192.168.11.2​
    Now I will be out of the office on Thrus, returning Friday.
  24. rednek

    rednek Newcomer, in training Topic Starter Posts: 36

    Hi JB. I think I've sorted it. I just left the default gateway and dns server entries blank, and all is well. Many thanks for your time - I'm very grateful.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.