Re: attached gateways
Re: attached gateways
- Subject: Re: attached gateways
- From: "Peter Sichel" <email@hidden>
- Date: Thu, 23 Jun 2005 08:35:04 -0400
>> If you type "netstat -rn" at the command line you will get the
>> routing table.
This might not contain all the information you want. The System
Configuration Framework (SCF) maintains the users network settings.
This is normally the best place to get them from. The SCF drives various
agents that derive the DNS and routing configuration and install them
into the BSD implementation.
In Mac OS X, only one default gateway can be active at a time. If your
Network Preferences Panel contains a router setting for both en0 and en1
(or they are configured via DHCP), only one of these will be installed
in the routing table at any time.
>here's how my system is setup:
>
>iface address gateway
>en0 192.168.20.150 192.168.20.1
>en1 192.168.21.150 192.168.21.1
>
>
>i tried netstat -rn, but it wouldn't show a line for both interfaces.
>
>when running netstat -rna , i get:
>
>Internet:
>Destination Gateway Flags Refs Use Netif
>Expire
...
>192.168.0 link#5 UCS 0 0 en1
...
>the gateway for en1 says "link#5". what is that supposed to mean?
This is a route for a directly attached network. All packets for
192.168.0.x should be sent via en1 (link#5 in the BSD interface table).
>it should say "192.168.21.1" .
This default gateway isn't currently installed in the BSD routing
table. The Network Preferences Panel only allows you to specify a
single Router address to be used as the default gateway when this
network service is the primary interface.
>that info is here on my system somewhere.
>
>how can i get ahold of it?
You probably want to be using the System Configuration Framework which
is a collection of property lists and a schema that defines where
various settings can be found. This is somewhat easier to access from
Cocoa since CFString, CFArray, and CFDictionary are toll free bridged to
the corresponding Cocoa classes making them easy to iterate and examine.
Kind Regards,
- Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden