How to be connected to two different LANs simultaneously

Networkssh

I have a home router is connected to the internet, I have a MacMini that connects to the router via WiFi. This works fine.

Now I have got another Linux machine which I connected with a cable to the Mac, and defined manually a LAN (The Mac is 1.0.0.1, the Linux is 1.0.0.9). Now both show me an established connection, and I have installed an SSH demon on the Linux machine. So far everything is fine. But when I try to ssh from the Mac into the Linux, I get a timeout almost every time. Occasionally it works, usually with the WiFi made inactive. My guess is that the ssh request is simply forwarded on the wrong LAN, but it's only a guess.

I'm not sure why, but I found two vnics that are active on the Mac. They have an address that starts with 10.x.x.x, so I don't think they're interfering, but thought it's important to note here.

So, any ideas whats going on?

Here is the output of ifconfig from the Mac:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
    ether c8:2a:14:58:4d:c2 
    inet6 fe80::ca2a:14ff:fe58:4dc2%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
    media: autoselect (1000baseT <full-duplex,flow-control>)
    status: active
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 28:cf:da:05:4e:93 
    inet6 fe80::2acf:daff:fe05:4e93%en1 prefixlen 64 scopeid 0x5 
    inet 192.168.2.102 netmask 0xffffff00 broadcast 192.168.2.255
    media: autoselect
    status: active
fw0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 4078
    lladdr c8:2a:14:ff:fe:f4:a3:78 
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0a:cf:da:05:4e:93 
    media: autoselect
    status: inactive
vnic0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 00:1c:42:00:00:08 
    inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
    inet6 fe80::21c:42ff:fe00:8%vnic0 prefixlen 64 scopeid 0x8 
    inet6 fdb2:2c26:f4e4::1 prefixlen 64 
    media: autoselect
    status: active
vnic1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 00:1c:42:00:00:09 
    inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
    inet6 fe80::21c:42ff:fe00:9%vnic1 prefixlen 64 scopeid 0x9 
    inet6 fdb2:2c26:f4e4:1::1 prefixlen 64 
    media: autoselect
    status: active

Best Answer

Martin,

You have set up two conflicting networks in the Mac.

The way to fix this is to tell the Mac exactly what you want to do which is, I assume, to share your Mac's WiFi 'net connection over Ethernet to your Linux box.

The first thing you need to do is take out all references to a network over the Ethernet interface as Sharing will take care of all that. So if you have manually set IP addresses and such then take all that out.

Open System Preferences > Sharing and select Internet Sharing. Then in the drop down "Share your connection from: " choose "Wi-Fi" and in the box tick "Ethernet".

This should fix your problem but it might require rebooting the Linux box.