Jump to content

[SOLVED] Connect two computers with ethernet and still use wifi?

HappyMouse

I have a Dell Precision T3500 running Ubuntu Server 16.04 and a MacBook running macOS Sierra. The server is a basic file server, sharing files over SMB. My plan was to have the server only accessible if you are directly connected to it with an Ethernet cable. I am running into an issue, though.

 

If I connect an Ethernet cable from the server to my MacBook, I can interact with the server just fine, but then my WiFi connection drops on my MacBook (for the record, my server is not connected to my network, or the internet). I want to be able to surf the web while transferring files to the server at the same time.

 

Is this possible? I could connect my server to my router, but I don't want to have it accessible to everyone on my network; just whoever has a physical connection via ethernet.

Any help is appreciated. I tried this already with no success.

Link to comment
Share on other sites

Link to post
Share on other sites

A seperate access point and a subnet would work. Put the WiFi on a subnet, and only give it access to the outside world.

Network diagram:
Internet-----Router----Access Point---WiFi Devices

                        |---File Server
                        |---MacBook

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks Oddball. I'm not quite sure what subnet is though, nor do I know how to set one up. Feel free to correct me, but wouldn't the diagram you typed allow my server to be on the network? This isn't exactly what I was looking for, sorry. I just want it accessable to only whatever devices are directly connected to it. Here's a diagram of what I was thinking of (please excuse the terrible mspaint drawing):

 

diagram.png

 

In the diagram above, only my MacBook would be able to communicate with the server. The MacBook would still be on WiFi, and the server wouldn't be on WiFi. Demo PC can't even ping the file server, and the file server can only ping the MacBook.

 

I hope I'm explaining this well, I'm fairly new to this and I am bad with networking.

Link to comment
Share on other sites

Link to post
Share on other sites

how are you setting up the wired connection between the macbook and file server? If its DHCP, then disable whatever DHCP server is on the wired connection. You want to assign static IPs on both the macbook and the server *without* specifying any Default Gateway or DNS addresses on either of them. This would mean that the wired connection is not used at all for access to the internet by either device, and therefore the wifi networking on the macbook should still work fine. The problem right now most likely is that you are defining a default gateway IP on the wired network on the macbook, and it is prioritizing the wired over the wireless.

 

BTW, the static IPs used by the macbook and server should be a completely different subnet from that used by your router / wireless network, otherwise the macbook will get confused between the two networks.

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Ok, so here's what I did:

 

I added this line to /etc/hosts on the server so I could type in the computer name and log in without having to remember an IP address:

219.0.1.1	smb-server

 

I changed iface en0 inet dhcp in /etc/network/interfaces on the server to:

iface en0 inet static
    address 219.0.1.1
    netmask 255.255.0.0

 

And on my Mac, I set the following for "Ethernet" under System Preferences > Network:

Configure IPv4: Manually
IP Address: 219.0.2.2
Subnet Mask: 255.255.0.0
Router:
DNS Server:
Search Domains:

 

 

Now all I have to do is press ⌘K in Finder and type smb://smb-server and log in and it works like I wanted it to! Yay!

 

Thank you all very very much! ^_^

 

 

Now, I was just thinking, I might be getting a new Mac this Christmas. If it has two Ethernet ports on it, could I set it up a similar way? (so one port is connected to the server, the other to my router, and have them both work like this does. Or, alternatively, use a single Ethernet port on the Mac and use an Ethernet switch to allow me to plug in both a cord to my router and a cord to my server, still keeping them separated?)

Link to comment
Share on other sites

Link to post
Share on other sites

53 minutes ago, HappyMouse said:

Ok, so here's what I did:

 

I added this line to /etc/hosts on the server so I could type in the computer name and log in without having to remember an IP address:


219.0.1.1	smb-server

 

I changed iface en0 inet dhcp in /etc/network/interfaces on the server to:


iface en0 inet static
    address 219.0.1.1
    netmask 255.255.0.0

 

And on my Mac, I set the following for "Ethernet" under System Preferences > Network:


Configure IPv4: Manually
IP Address: 219.0.2.2
Subnet Mask: 255.255.0.0
Router:
DNS Server:
Search Domains:

 

 

Now all I have to do is press ⌘K in Finder and type smb://smb-server and log in and it works like I wanted it to! Yay!

 

Thank you all very very much! ^_^

 

 

Now, I was just thinking, I might be getting a new Mac this Christmas. If it has two Ethernet ports on it, could I set it up a similar way? (so one port is connected to the server, the other to my router, and have them both work like this does. Or, alternatively, use a single Ethernet port on the Mac and use an Ethernet switch to allow me to plug in both a cord to my router and a cord to my server, still keeping them separated?)

Just letting you know.... 219.0.0.0/16 is owned by Softbank, a Japanese Telecommunications company that owns a surprising number of non-telecommunications stuff also. In general you shouldn't use public IP ranges for private usage, you never know what site or service stops working because of a conflict.

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for the tip. Would 100.x.x.x be okay? Or would you recommend any others?

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, HappyMouse said:

Thanks for the tip. Would 100.x.x.x be okay? Or would you recommend any others?

Use one of the officially reserved private IP ranges:

10.0.0.0/8

172.16.0.0/12

192.168.0.0/16

Obviously you would normally use a small subset of one of there, like most routers use 192.168.1.0/24 or similar. At work we use 10.0.0.0/8 for infrastructure (switches, APs, etc), and 172.16.x.0/24 for end devices (computers and such). If your main router is 192.168.1.0/24, then use 192.168.2.0/24 for the private. Or whatever.

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Ok, cool, thanks. My router is 192.168.0.1, so I'll try 192.168.2.1 on the server and 192.168.1.100 on the MacBook (which I believe are unused on my network) and report back with my results. I'll use 192.168.2.x for servers and 192.168.1.x for clients. Would that setup be okay?

 

Would I set the mask on both to 255.255.0.0?

Link to comment
Share on other sites

Link to post
Share on other sites

41 minutes ago, HappyMouse said:

Ok, cool, thanks. My router is 192.168.0.1, so I'll try 192.168.2.1 on the server and 192.168.1.100 on the MacBook (which I believe are unused on my network) and report back with my results. I'll use 192.168.2.x for servers and 192.168.1.x for clients. Would that setup be okay?

 

Would I set the mask on both to 255.255.0.0?

why would you use different subnets on the macbook and server? They need to be able to talk to each other directly.

Router, including everything other than the server: 192.168.0.0/24

MacBook wireless: DHCP, something in 192.168.0.0/24

MacBook wired: 192.168.1.100/24

Server: 192.168.1.101/24

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Oh, oops, sorry. I thought on using 192.168.2.x for servers and 192.168.1.x for clients, both with 255.255.0.0 as the subnet mask, but I didn't realise it would cause issues. I'll just use 192.168.1.100 for the MacBook and 192.168.1.101 for the server, like you suggested.

 

So, just thinking on futureproofing this, would I need to reserve 100 and 101 on my router so it doesn't try to assign them to devices later on? (which could cause issues)

 

Thanks, and I'll report back with my results when I can (I am currently at work)

Link to comment
Share on other sites

Link to post
Share on other sites

255.255.0.0 as a subnet mask would mean that 192.168.0.0-192.168.255.255 is one big network. There would be no seperation at a logical level, and devices with more than one IP like the MacBook would be confused.

 

1 hour ago, HappyMouse said:

So, just thinking on futureproofing this, would I need to reserve 100 and 101 on my router so it doesn't try to assign them to devices later on? (which could cause issues)

The IPs used for the private wired link should be completely outside of the subnet used by the router.

2 hours ago, HappyMouse said:

My router is 192.168.0.1

192.168.0.1 with a subnet mask of 255.255.255.0 (/24) means the subnet is 192.168.0.1-192.168.0.255. The IPs 192.168.1.100 and 192.168.1.101 are outside of it. Making a reservation for those IPs would mean nothing, and many routers won’t even let you do it at all.

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Argh, sorry, now I'm getting a bit confused. Small correction, my router is actually 192.168.1.1, if that makes a difference. And all of the devices on it are 192.168.1.50, 192.168.1.32, etc., so I believe that would make it 255.255.255.0?

 

So, in that case would my config be like this, correct?:

 

Server

IP: 192.168.2.100

Subnet Mask: 255.255.255.0

 

MacBook

IP: 192.168.2.101

Subnet Mask: 255.255.255.0

 

It's also probably helpful to note that I was able to get it working with a subnet mask of 255.255.0.0, but if that is not advised then I will most definitely change it to what I put above.

 

 

Edit: Never mind, I understand it now. I set the IPs and subnet mask to what I specified above and it worked like a charm, thank you! I just have one more question, if I bought an Ethernet switch, could I do something like this?:

 

diagra.png.d3c2c64efcdfccc06a5cf44541eba4e9.png

Link to comment
Share on other sites

Link to post
Share on other sites

Yes that would work fine

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×