Routing with a multihomed Mac

Hi,

I have a Mac running Leopard 10.5.4 with two network cards in it, and I'm trying to get it to act as a router.

The setup is very simple:

A ---- M ---- B

M is the Mac with two nics.
The nic (en0) on computer M connected to computer A has an IP of 10.0.0.1/24.
Computer A has an IP of 10.0.0.2 and a gateway of 10.0.0.1

The nic (en1) on computer M connected to computer B has an IP of 192.168.0.1/24.
Computer B's IP is 192.168.0.2 with a gateway of 192.168.0.1

Both computer A and B can ping computer M on the appropriate interface, but I cannot get computers A and B to ping each other. It sounds to me like computer M simply isn't forwarding the packets across its interfaces.

The routing table on computer M shows entries for both subnets on the appropriate en0/en1 interface.

There are no firewall rules at all on any of the machines (so nothing is blocking the ping).

Is there something I need to do to tell Leopard to forward traffic across its two network cards?

For the record: there is no NAT going here at all, and this has nothing to do with internet connection sharing. This is an isolated little network with only three machines; no net connection, no NAT, no nothing. All I want is for machine M to do some routing for me 🙂

Can anyone help?

Thanks in advance.

Hamster.

Macbook Pro, Mac OS X (10.5.4)

Posted on Aug 8, 2008 3:38 AM

Reply
2 replies

Aug 8, 2008 8:57 AM in response to MacHamster

It sounds to me like computer M simply isn't forwarding the packets across its interfaces


That's correct. By default the OS doesn't forward packets, only accepts packets destined for itself.

Is there something I need to do to tell Leopard to forward traffic across its two network cards?


Yes. Enable IP forwarding:

sysctl -w net.inet.ip.forwarding=1


Note this will be transient (i.e. lost at next reboot). To make it persistent add the 'net.inet.ip.forwarding=1' to /etc/sysctl.conf

Aug 8, 2008 9:25 AM in response to Camelot

{quote:title=Camelot wrote:}
sysctl -w net.inet.ip.forwarding=1
{quote}



Thank you so much for that. I have to admit I burst out laughing when I read the solution. As a linux admin I am all too familiar with /etc/sysctl.conf and I'm kicking myself for not having looked there before posting 🙂

It just didn't cross my mind because I know the Mac has no /proc filesystem! :-D

Thanks again!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Routing with a multihomed Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.