Monday, 8 June 2009

Network Forwarding

To me Networks are a black-art. So when I arrived upon the problem of connecting a newly acquired non wireless enabled Apple Mac to the internet which is on a wireless router I knew I would have a problem.
My proposed solution was to have a network cable between the Mac and one of the NICs in my Linux box (which is wireless enabled). Wiring this up wasn't a problem - the hard bit came when I needed to configure the system to route properly. Step by step here's what I did...

  1. Configure the Mac with an IP address, say 192.168.11.6
  2. Assign the NIC IP address in my Linux box to another address on the network, say 192.168.11.7
  3. Back on the Mac, set the router to point to the Linux NIC (192.168.11.7) and the netmask to 255.255.0.0. Set the gateway to your internet router gateway IP (ie 192.168.1.1)
  4. Set IP forwarding on the Linux box.
  5. Add an entry to your router table on the Linux box which will direct all packets targeted for the Mac to the NIC card to which the Mac is connected (netmask 255.255.255.255).
  6. Send all other IPs with address 192.168.11.x to your wirless NIC.
  7. Set the default Gateway to the internet router address (192.168.11.1).
  8. From the Mac you should now be able to ping your NICs on the Linux box but not 192.168.11.1 or anything outside.
  9. Finally, to solve this probem, use the ARP Proxy settings to make the Linux NICs forward messages from the Mac.
Needless to say I would never have worked this out without the intervention of my good friend and Network Guru Steve Glass.