After the machine next reboots, it will not act as a router.
If you are using Solaris 2.5 or greater, it's even easier to make your
machine not route packets. Simply create an /etc/notrouter file:
%% touch /etc/notrouter
Afterwards, reboot the machine.
It may be useful to note, that on Solaris machines, ip_forwarding can
have three values:
0 Never Forward
1 Always Forward
2 Only forward when two or more interfaces are up
The above steps result in the ndd /dev/ip ip_forwarding variable being
changed from "1" to "0", which prevents routing.
3.8: How to Set a Netmask under SunOS
In order to include a permanent netmask on your SunOS machine, you
must make an entry in the /etc/netmasks file, in the following format:
network-address-without-zeroes netmask
For example:
%%%% cat /etc/netmasks
150.101 255.255.255.0
The above would subnet the class B network, 150.101.0.0, into 254
subnets, from 150.101.1.0 to 150.101.254.0.
It is important to note that the entry in the left hand column must be
the original base network number (ie # for a Class A, #.# for a Class
B and #.#.# for a Class C), not the subnet.
3.9: How to Set a Netmask under Solaris
In order to include a permanent netmask on your Solaris machine, you
must make an entry in the /etc/netmasks file, in the following format:
network-address netmask
For example:
%%%% cat /etc/netmasks
150.101.0.0 255.255.255.0
The above would subnet the class B network, 150.101.0.0, into 254
subnets, from 150.101.1.0 to 150.101.254.0.
In 2.5.1 and below, only one entry for the entire class network is allowed
to support standard subnetting as specified in RFC-950
It is important to note that the entry in the left hand column must be
the original base network number (ie #.0.0.0 for a Class A, #.#.0.0
for a Class B and #.#.#.0 for a Class C), not the subnet.
The 2.6 kernel has changed to support VLSM. It is now possible to combine
the RFC-950 and RFC-1519 form of subnet masks in the netmasks file.
The network address should be the "SUBNETTED" address NOT the standard
network number based on the hosts ip address. (see man page for netmasks)
Here are a few examples:
A host address 192.188.206.65 with a netmask of 255.255.255.224
/etc/netmasks
192.188.206.64 255.255.255.224
A host address 172.31.16.193 with a netmask of 255.255.255.192
/etc/netmasks
172.31.16.192 255.255.255.192
See section 3.10 to get a better understanding of how to subnet by bit.
3.10: How to Subnet by Bit
As was noted in Section 1.3, subnetting is actually done at the bit
level. That is, all the bits that form the IP address are masked by
the bits that form the Netmask, in order to generate the Network
Address. Here's some examples of what a netmask looks like down at
the bit level:
255.255.255.0 = 11111111.11111111.11111111.00000000
255.255.255.192 = 11111111.11111111.11111111.11000000
And here are a few examples of using the '192' netmask:
IP Address Netmask Network Address
---------- ------- ---------------
150.101.16.90 255.255.255.192 150.101.16.64
150.101.16.150 255.255.255.192 150.101.16.128
Expanding out the first example should make this a bit more clear:
150.101.16.90 = 10010110.01100101.00010000.01011010
255.255.255.192 = 11111111.11111111.11111111.11000000
Network Address = 10010110.01100101.00010000.01000000 = 150.101.16.64
The resulting network number is 150.101.16.64 and the host address
is 26.
The only caveat is that RFC 917 states that it is illegal to have a
subnet address that is all 0s or all 1s. This means that when you
split your class C, you will lose the bottom set of IP addresses, and
also the top set of IP addresses.
Putting this all together, we can take a look at two examples. These
examples both assume a Class C network (that is a network between
192.*.*.* and 223.*.*.*), which you wish to subnet.
IP ADDRESS = any Class C
NETMASK = 255.255.255.128 = 11111111.11111111.11111111.10000000
Subnet 1 = '0' Illegal because subnet is all 0s
Subnet 2 = '1' Illegal because subnet is all 1s
Clearly, using the 255.255.255.128 mask to subnet a Class C is useless.
IP ADDRESS = any Class C
NETMASK = 255.255.255.192 = 11111111.11111111.11111111.11000000
Subnet 1 = '00' Illegal because subnet is all 0s
addresses x.x.x.0 to x.x.x.63 are wasted
Subnet 2 = '01' network x.x.x.64, broadcast x.x.x.127
machines range from x.x.x.65 to x.x.x.126
Subnet 3 = '10' network x.x.x.128, broadcast x.x.x.191
machines range from x.x.x.129 to x.x.x.190
Subnet 4 = '11' Illegal because subnet is all 1s
addresses x.x.x.192 to x.x.x.255 are wasted
Thus, if you had a Class C that you wanted to divide into two subnets,
you would use the 192 netmask described above, and end up with two
ranges of 63 machines each.
Now, the above all assumes that you own a Class C network, that is a
network with an network address between 192.*.*.* and 223.*.*.*.
Another common situation is the case where you are on a Class B
network (ie 150.101.0.0), but you actually control a network
equivalent in size to a Class C (ie 150.101.16.0), and you want to
subnet further. Things work about the same as above, but you do not
have to waste the top and bottom IP ranges. This is because the entire
subnet, which is nine or more bits long, is not set to all 0s or all 1s
in those cases only the last two digits are. So, if we were subnetting
150.101.16.0 further, using the 192 subnet, our table would look like
this:
IP ADDRESS = 150.101.16.0
(though any class B, further subnetted will work the same)
NETMASK = 255.255.255.192 = 11111111.11111111.11111111.11000000
Subnet 1 = '00010000.00' network 150.101.16.0, broadcast 150.101.16.63
machines range from 150.101.16.1 to 150.101.16.62
Subnet 2 = '00010000.01' network 150.101.16.64, broadcast 150.101.16.127
machines range from 150.101.16.65 to 150.101.16.126
Subnet 3 = '00010000.10' network 150.101.16.128, broadcast 150.101.16.191
machines range from 150.101.16.129 to 150.101.16.190
Subnet 4 = '00010000.11' network 150.101.16.192, broadcast 150.101.16.255
machines range from 150.101.16.193 to 150.101.16.254
Subnetting by the bit can be a pretty complex process and SunService
can not provide further assistance on initial configuration of this
type. However, if you're trying to subnet at this small of a level,
and don't totally understand how to do so, consult Section 8.0 and 9.0
for where you can get further assistance from within Sun.
3.11: How to Protect a Gateway Machine
Routing:
---------------
You may find that you wish to keep a gateway machine from sending
routing information via certain interfaces. This is usually done on a
machine that acts as a firewall of some type. Assuming that you have a
multiple interface machine that is advertising routing information
(via in.routed and in.rdisc), you should do two things.
First, totally turn off in.rdisc:
%%%% mv /usr/sbin/in.rdisc /usr/sbin/rdisc.save
Second, add norip lines to the /etc/gateways file for all interfaces
that you do not want routing information to be sent through. For
example, if le1 led to an external net, you would probably add the
following entry:
%%%% cat /etc/gateways
norip le1
This type of setup should only be done on a firewall machine where you
are trying to decrease your net connectivity.
IP forwarding:
---------------
For Security and network isolation. You can set ip_forwarding off and
ip_strict_dst_multihoming on, if you are trying to prevent access to
the other interfaces.
"ndd /dev/ip ip_forwarding" Determines if the workstation will route packets.
ex: ndd -set /dev/ip ip_forwarding 0
"ndd /dev/ip ip_strict_dst_multihoming" Determines whether to use Strict
Destination Multihoming. If this variable is set to True, and ip_forwarding
is turned off, then the machine will not except packets destined for a
different interface. RFC112
ex: ndd -set /dev/ip ip_strict_dst_multihoming 0
also see:
"ip_forward_directed_broadcasts" Determines whether to forward
broadcasts directed to a specific net or subnet, if directly connected
"ip_forward_src_routed" Determines whether to forward packets that are
source routed,(packets which have a specific machine listed as part of route)
3.12: How to Proxy Arp
Proxy ARPing involves one machine answering ARP requests for another
machine. This is most frequently done when a point-to-point interface
(ie PPP) is being used. For example, imagine the following setup:
ppp-machine psi
150.101.16.200---PPP LINK--ttya--150.101.16.28--le0--150.101.16.0 NETWORK
8:0:20:1:2:70 8:0:20:1:2:3
^^^ether NA
default route=psi
In this example systems on le0 network would have problems, because systems
on the le0 network and ppp link are not directly connected on the 150.101.16.0
network, 150.101.16.X will arp for 150.101.16.200 and not get a response.
Using psi to proxy arp on behalf of the ppp-machine will allow the packets
to be forwarded properly.
The following command, run on psi, would allow that machine to proxy
arp for ppp-machine:
# arp -s ppp-machine 8:0:20:1:2:3 pub
^^^ ^^^^^^^^^^^^
ppp client hostname psi servers ethernet mac address
Note that psi supplies its own ethernet address, not ppp-machine's.
This is because ARP should cause packets to go to psi, which is the
only machine which actually can pass on packets to ppp-machine.
(This command should also be put in the rc files if you wish it to be
permanent.)
Example:
Create an executable file called /etc/rc2.d/S99proxyarp. This should
have an arp entry for each of the clients , listing your server's
ethernet address:
#!/bin/sh
#
# S99proxyarp script to force ip forwarding
# and add published arp entries for point to point clients.
ndd -set /dev/ip ip_forwarding 1
arp -s ppp-pc1 8:0:20:1:2:3 pub
arp -s ppp-pc2 8:0:20:1:2:3 pub
make it executable:
# chmod +x /etc/rc2.d/S99proxyarp
3.13: How to Remove ARP Entries in Solaris?
You may determine that you need to remove arp entries. This could be
done if a machine has changed ether addresses, and you must have
access to it at once, or if a proxy arp has changed. You can delete a
single ARP entry with the following command:
# arp -d machine-name
a simple way to clear a machine's entire ARP cache without rebooting, deleting
entries manually or waiting for timeouts.
# ifconfig le0 <IP>
The above command ( = ifconfig down; ifconfig up) will delete all entries
including static entries and published virtual interface entries.
See srdb 11416 for arp time-out info.
srdb 11416 what are the ARP values set by ndd?
4.0 Some Frequently Asked Questions
4.1: Miscellaneous Questions
Q: Does Sun support gated?
A: No. The public domain version of gated is available via several ftp sites,
However, SunService can provide NO assistance with gated.
Where to get GateD:
The GateD Consortium can be reached at:
http://www.gated.org/ http://www.gated.org/new_web/code/code/gated-multi/code.html Sun offers this tar file strictly as a convenience, and offer no warranty, etc.
ftp://playground.sun.com/pub/GateD/ Q: What type of routing should I use?
A: This depends on your overall network setup, and your goals.
If your machine is on a simple unchanging network, that only has a few
routers connecting it, it is best to just install one static default
router. In addition, you _must_ use a static default router if you do
not (or can not) propagate either Router Discovery or RIP messages
within your network. The only deficit with this method is that you
don't have a fallback if the primary router fails. This is not a
problem in Solaris 2.4 and above, which allow multiple router entries
in the defaultrouter file. Section 3.1 explains how to set up a
default router.
If you have a complex internal network, or a network that frequently
changes, or you want to make sure that your machine has fallback
opportunities if your primary router goes down, you should use one of
the dynamic routing programs. If you have multiple routers which all
support Router Discovery and are on a Solaris system, you will want to
run in.rdisc. Otherwise, you'll want to run in.routed.
Note that dynamic routing programs will not work unless you have
already configured the machines on your network to send out either
Router Discovery or RIP messages. Also, you should be aware that the
dynamic routing protocols will introduce some limited level of
additional traffic to your network.
Sections 3.3 and 3.4 explain how to set up in.routed and in.rdisc.
Q: What routes are automatically set up?
A: A few routes automatically get set up every time your machine is
booted.
First, all machines will always have a localhost route back to
themselves:
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
127.0.0.1 127.0.0.1 UH 0 591 lo0
This is standard and increases the efficiency of packets that a
machine sends to itself.
Second, Solaris machines have a special multicast route:
224.0.0.0 150.101.16.28 U 3 0 le0
Multicast routes are used by certain programs that broadcast to a
group of machines rather than to the subnet in general.
Finally, all machines will always set up one route for each of their
interfaces. The route will be a simple one which says that all packets
which go to the interface's network should be routed through the
interface.
For example, I have one interface, le0, with an IP address of
150.101.16.28. Since I use a netmask of 255.255.255.0, this means that
my local network is 150.101.16.0, and the route looks like this:
150.101.16.0 150.101.16.28 U 3 951 le0
(It should be noted that machines which use point-to-point interfaces,
such as PPP, will have slightly different routes consult the PPP Tip
Sheet for more info on these.)
Q: Where did all these routes in my routing table come from? When I look
at netstat -rn I see a lot of routes that I didn't add.
A: As noted in the previous question and answer, you will get one for each
interface is configured on bootup as well as for the loopback and multicast
addresses.
One of the following Sun routing daemons may have added them:
in.routed
in.rdisc
GateD (or any other 3rd party, non-Sun supported routing daemon may add them)
/etc/gateways may have routing table entries that get added
They may have manually been entered on the command line
ICMP redirects from routers can add them (look for the D flag in the netstat -rn
output).
They may have been added to some script (probably executed during bootup)
somewhere on the system. Check for this by grep'ing for "route" in
directories like /etc/rc2.d, /etc/rc3.d and so on.
Q: Why was ip_forwarding changed in 2.6 and above.
A: ip_forwarding of 0 is now the default and the value 2 was removed to comply
more strickly to RFC1122 (default MUST be to not forward packets)
In 2.6, 2.7 if a defaultrouter is defined, then S69inet will set
ip_forwarding off(0)
unless dhcp has set IpFwdF. see 2.7 ip(7P)
Bug references:
Bug Id: 1113271 Synopsis: ip_forwarding should be configurable via /etc/system
Bug Id: 4135171 Synopsis: 2.6 routing issue should be documented
Bug Id: 4052347 Synopsis: Man page for ip needs updated for new ip_forwarding
values in Solaris 2.6
To force ip_forwarding on, add the ndd change in the startup script.
ndd -set /dev/ip ip_forwarding 1
The Netra implements a S99routing (/opt/netra/networking/routing/bin/boot.conf)
that turns it on
#!/bin/sh
ndd -set /dev/ip ip_forwarding 1
ndd -set /dev/ip ip_forward_src_routed 0
---
2.7 ip man page update:
"...The IP layer will normally act as a router (forwarding
datagrams that are not addressed to it, among other things)
when the machine has two or more interfaces that are up.
... When the IP module is loaded, ip_forwarding is 0
and remains so if:
o only one non-DHCP-managed interface is up (the most
common case)
o the file /etc/notrouter exists and DHCP does not say
that IP forwarding is on
o the file /etc/defaultrouter exists and DHCP does not
say IP forwarding is on
Otherwise, ip_forwarding will be set to 1."
-
4.2: Basic Routing Problems
This sections outlines a very common routing problems. The techniques
described in Section 2.0 will be needed to resolve more difficult
routing problems.
Q: Why can I only ping machines on my subnet?
A1: You are using in.routed (this is how a machine ships by default),
but are not propagating RIP packets on your network. You should define
a default router, as described in Section 3.1.
A2: Your netmask is set incorrectly on the machine which can not ping.
Sections 3.8 and 3.9 describe how to define a permanent custom
netmask.
A3: You have a default router defined, but that machine is not
forwarding the IP packets. If that router is a Sun machine, you should
make sure that it has _not_ been modified as described in Section 3.6
or 3.7. If it is a non-Sun machine, SunService can not provide further
assistance in resolving why it might not be forwarding IP packets.
4.3: in.routed Errors
Q: Why does in.routed constantly generate the following error:
"packet from unknown router, x.x.x.x"
A: This occurs because your machine is receiving broadcast packets
from a router that is on a different subnet. Since broadcast packets
will not typically cross subnet boundaries, this usually means that
you have machines from two subnets on the same physical wire.
Often, this is a mistake if you see this error, and do not expect to
have multiple networks on the same wire, you should track down the
source machine (x.x.x.x), and fix its IP address.
However, there are cases where this setup might be intentional, as
outlined in RFC 1597. This would imply that you had several networks
all using the same physical wire. Unfortunately, this is not currently
supported correctly, as is described in Section 6.1.
If you are on a SunOS machine, just install patch 100283 and this
problem will go away. More information on this is contained in Section
5.1.
Under Solaris, a fix for this issue is still pending. If the errors
are too much, you should revert to using a default router, as
described in Section 3.1, until the problem is corrected.
Q: Why does in.routed keep bringing my PPP interface up?
A: in.routed automatically sends out RIP packets every 30 seconds.
This will keep your PPP interface up. To prevent this, you can put the
following entry in your /etc/gateways file:
%%%% cat /etc/gateways
norip ipdptp0
This will allow you to continue running in.routed, without have it
keep your PPP interface constantly up. Another Tip Sheet exists for
PPP which explains many routing problems associated with a PPP
interface.
4.4: netmask and broadcast Problems
Q: why is my netmasks entry being ignored?
A1: The network address listed in the netmasks file is a subnet
instead of the base network. Remember that the network address should
just be # if you are on a class A, #.# if you are on a class B, and
#.#.# if you are on a class C. Section 1.3 has a listing of which IP
addresses belong to which classes.
A2: Although you have added the netmasks to /etc/netmasks, you have
not put it in NIS. After NIS is brought up, your /etc/netmasks file is
no longer consulted. Make sure to duplicate any netmasks entries in
your NIS maps.
Q: Why do I get segmentation faults on boot after changing my netmasks
file?
A: This is a known bug in some Solaris systems. It is mentioned in
Section 6.1. If you examine your /etc/netmasks file, you will find
that it contains blank lines. Remove them, reboot, and your system
will come up clean.
Q: Does Sun support variable-length subnetting, per RFC 1219?
A: Solaris 2.6 or above supports VLSM and CIDR.
Q1: Why can't I add a netmask for a remote subnet?
Q2: If I add a netmask for a subnet not directly connected to my
machine, it is ignored. Why?
A: Sun systems only support netmasks for networks that are directly
connected to a machine. This means that if you try and add a netmask
for a network that is not directly connected to your machine, it will
fail. If you want to route to a remote network which is subnetted, the
correct method is to route to a machine that is directly connected to
the subnetted network, and then allow that machine to route to the
appropriate subnetwork.
When RFC 1219 is implemented on Suns, this functionality may become
available.
Q: How do I make SunOS 4.x limited broadcast all 1's like solaris2.
A.
Manually specify the broadcast,
---------
example:
# ifconfig le0
le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
inet 1207.48.123.87 netmask ffffff00 broadcast 207.48.123.0
ether 8:0:20:1a:f:83
# ifconfig le0 broadcast 129.151.21.255
# ifconfig le0
le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
inet 207.48.123.87 netmask ffffff00 broadcast 207.48.123.255
ether 8:0:20:1a:f:83
---------
Add a ifconfig line to /etc/rc.local to take effect on bootup.
...
# set the netmask from NIS if running, or /etc/netmasks for all ether interfaces
ifconfig -a netmask + broadcast + > /dev/null
ifconfig le0 broadcast 207.48.123.255
4.5: traceroute information and Problems
Sun does not support the public domain traceroute package.
New :
Solaris 2.7 software bundles the popular traceroute utility. The traceroute utility is
used to trace the route an IP packet follows to an Internet host. Traceroute uses the
IP protocol ttl (time to live) field and attempts to elicit an ICMP TIME_EXCEEDED response
from each gateway along the path, and PORT_UNREACHABLE (or ECHO_REPLY) from
the destination host. The traceroute utility starts sending probes with a ttl of 1, and
increases by one until it gets to the intended host or has passed through a maximum
number of intermediate hosts.
The traceroute utility is especially useful for determining routing configuration problems
and routing path failures. If a particular host is unreachable, the traceroute utility
can be used to see what path the packet follows to the intended host and where possible
failures occur. The traceroute utility also displays the round-trip time for each
gateway along the path to the target host. This information can be useful for analyzing
where traffic is slow between the two hosts.
For more information, see TCP/IP and Data Communications Administration Guide.
The below questions simply note some problems that
we have run into with traceroute, and the simple steps that can be
taken to correct them. Further problems or errors with traceroute
should be directed to the traceroute author.
Q: Why does traceroute fail on every other packet, under Solaris:
# traceroute psi
traceroute to psi (150.101.16.2, 30 hops max, 40 byte packets
1 psi (150.101.16.2 6 ms * 2 ms
A: Solaris introduced a variable called 'ip_icmp_err_interval' which
enforces a minimum time in between ICMP error messages. traceroute
depends upon ICMP error messages, and tends to send them very fast. As
a result, if ip_icmp_err_interval is set to the default value on a
Solaris machine, traceroute's second packet will always get dropped,
as shown above. You can disable this Solaris feature by adjusting the
ndd variable:
# ndd -set /dev/ip ip_icmp_err_interval 0
If you want this change to be permanent, you should add it to the file
/etc/rc2.d/S69inet.
However, since every single Solaris machine between you and your
destination must change this variable, it is often more reasonable
just to let every second packet get dropped, and not worry about it.
4.6: arp Problems
Q: Why does arp fail with the following message:
# arp -s system 0:8:20:1:2:3 pub
"system: No such device or address"
A: This occurs if you try and use arp to add a machine that is not on
a local network. You may only arp entries for hosts on subnets that
are directly connected to your machine.
5.0 Patches
The following is the list of all of the routing related patches for
4.1.3, 4.1.3_u1, 4.1.4, 5.3 and 5.4. If you are having routing
problems, installing the patches is a good place to start, especially
if you recognize the general symptoms noted below.
In order for a machine to be stable, all of the recommended patches
should be installed as well. The list of recommended patches for your
operating system is available from sunsolve.sun.com.
5.1: Routing Patches for SunOS
100283 SunOS 4.1.1 4.1.2 4.1.3: in.routed mishandles gateways, multipl
Fixes problems in the way that routed broadcasts some routes, and
corrects an error in routing to machines with multiple interfaces on
the same physical wire.
5.2: Routing Patches for Solaris
101318 SunOS 5.3: Jumbo patch for kernel (includes libc, lockd)
104231 SunOS 5.3: in.routed patch
101945 SunOS 5.4: jumbo patch for kernel
104232 SunOS 5.4: in.routed patch
103169 SunOS 5.5: arp,ip,udp,icmp driver and ifconfig fixes
104234 SunOS 5.5: in.routed patch
103630 SunOS 5.5.1: ip ifconfig arp udp icmp patch
104236 SunOS 5.5.1: in.routed finds packet from unknown router
104958 SunO