0

We would like to set up and private single cable connection between two Mavericks servers, that also need to talk to the rest-of-the-world.

The two servers for sake of argument are DB and Web.

There are two interface cards on each, which we'll call A & B. In each case A will be for rest-of-the-world, and B for between the pair.

Interface-wise, DB(A) is en0, ->rest of world; DB(B) is en3, ->Web Server; Web(A) is en0, ->rest of world; Web(B) is en4, -> DB Server;

We've run ourselves around in a few different circles, attempting this using route commands, something along the lines of:

// on DB server
// en0 card IP address 192.168.1.50
// en3 card IP address 10.0.0.50
sudo route -n add 10.0.0.51 -interface en3

// on Web server
// en0 card IP address 192.168.1.51
// en4 card IP address 10.0.0.51
sudo route -n add 10.0.0.50 -interface en4

Several questions:

Can this be done with a simple cable/cross-over cable without using up ports on the local ethernet switch?

Can we use a local network range for the B network: e.g. The A subnet is 192.168.1.x and The B subnet is 10.0.0.x?

What are the commands on MacOS X Mavericks to ensure that traffic is routed correctly, and that the routes are remembered between restarts? Will we need a script for this to run at restart?

Are we even on the right track?

All help gratefully received!

2 Answers 2

2

Yes, just connect two network devices directly with a cable (these days, it doesn't need to be a cross-over cable, thanks to Auto MDI-X ).

Give them both IP addresses in an unused range (like 10.0.0.50 and 10.0.0.51). It should just work, without the need to add a route.

2
  • Yes, but, BTW, it should work for small values of should and large values of doesn't
    – Dycey
    Jan 12, 2015 at 15:08
  • Hmmh, sorry, but it really should work - I have a number of Linux servers connected this way, and right now my Macbook is connected to configure a switch in exactly the same way - all without a route. Did you set the netmask to the same value on both machines?
    – Sven
    Jan 12, 2015 at 15:21
0

Doing network configuration on OS X with ifconfig, route, etc doesn't work very well -- the problem (and solution) is that OS X has a separate idea of how the network should be set up, and a background daemon (configd) that applies that to the live network configuration. If you make manual changes to the network state, configd will overwrite them at random. Solution: adjust OS X's configuration, and let configd manage the live settings for you. You can use the Network pane in System Preferences and/or the networksetup command.

There are a couple of possible gotchas in the the network settings. I'll describe the necessary settings in terms of the Network preference pane:

  • Each interface should have a "network service" listed on the left of the preference pane. Set its IP address and subnet mask appropriately.

  • You need to click the Advanced button to get to the DNS etc settings. It'll probably be best to use the same settings for both services, except...

  • The router setting is different: for the rest-of-world interface, use the actual network gateway's LAN address; for the private interface, use the other computer's private IP (e.g. the DB server's private interface would have its IP as 10.0.0.50, and use 10.0.0.51 as the router). The reason for this is that configd sometimes seems to panic if it can't ARP the router.

  • The rest-of-world interface should be at the top of the service list, with the private interface below it. If they aren't in the right order, click the gear icon under the service list, choose "Set Service Order", and drag the services into the correct order.

After you set this up, run netstat -rn. You should see a default route for the rest-of-world (real) router, and another "default" for source based routing, which you can ignore. You should also see routes for each of the subnets with the appropriate interface listed. And a bunch more stuff as well, including 169.254 (self-assigned link local addresses), ARP entries, etc. Something like this:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.1.1        UGSc           11 33271918     en0
default            link#5             UCSI            1        0     en3
192.168.1          link#4             UCS             1        0     en0
192.168.1.1        0:11:22:33:44:55   UHLWIir         9        0     en0   1199
192.168.1.50       127.0.0.1          UHS             0   148277     lo0
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              8 13767842     lo0
169.254            link#4             UCS             3        0     en0
169.254.53.131     link#4             UHLSW           0        0     en0
169.254.255.255    0:11:22:33:44:55   UHLSW           0        0     en0
10.0.1             link#5             UCS            36        0     en3
10.0.1.50          127.0.0.1          UHS             3  2167637     lo0
[...]

If that doesn't work, I'd need more info (probably including the netstat -rn output from both computers) to troubleshoot...

3
  • Gordon, thanks for this. Nope, that didn't work! In fact honestly, we'd tried doing it via the Network Config panel, and miraculously it ignores the private network connection, and routes via the preferred (top) network anyway. Hence the route route. :-) However, we will try it again, and get a netstat -rn listing. (We were using Network Utility which is a pain to copy from)
    – Dycey
    Jan 12, 2015 at 17:00
  • @Dycey does the Network preference pane show a green status indicator for the private interface? Jan 12, 2015 at 17:11
  • Also, what does route get 10.0.1.5x show on each of the computers (with "5x" being the other computer)? Jan 12, 2015 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .