Routing traffic back and forth through a Mac mini server with 2 network interfaces

Solution 1:

It should be possible to create a bridge with en0 and en2 and enable net.inet.ip.forwarding to get rid of all routing problems. The bridge acts more or less as another switch between en0 and en2.


  • Disable Internet Sharing
  • remove the gateway in the en2 settings of the Mac mini and change the IP-address to an available one in 192.168.88.0/24 (e.g. 192.168.88.11)
  • remove all additional static routes
  • Check for bridge interfaces with ifconfig
  • On the server create a file bridge:

    sudo mkdir -p /usr/local/bin/ #only if the folder is missing
    sudo nano /usr/local/bin/bridge
    

    with the content

    #!/bin/bash
    
    sysctl -w net.inet.ip.forwarding=1
    ifconfig bridge create
    ifconfig bridge0 addm en0 addm en2 up #use the first available bridge number here and the proper interface device names
    
  • enter sudo chmod +x nano /usr/local/bin/bridge
  • Create a launch daemon usr.bridge.plist:

    sudo nano /Library/LaunchDaemons/usr.bridge.plist
    

    with the content

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>usr.bridge</string>
        <key>ProgramArguments</key>
        <array>
            <string>/bin/sh</string>
            <string>-c</string>
            <string>/usr/local/bin/bridge</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/tmp/usr.bridge.err</string>
        <key>StandardOutPath</key>
        <string>/tmp/usr.bridge.out</string>
    </dict>
    </plist>
    
  • Load the plist

    sudo launchctl load /Library/LaunchDaemons/usr.bridge.plist
    
  • Change the IP-addresses of node_1 and node_10 to available ones in 192.168.88.0/24 (e.g. 192.168.88.101 and 192.168.88.110). Change their default gateways to 192.168.88.1 and the DNS server to 192.168.88.10.