You are on page 1of 3

SOLARIS 10 ADMIN

Comment activer une carte rseau sous Solaris ? # ifconfig a lo0 : flag=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 Inet 127.0.0.1 netmask ff000000 # ifconfig a plumb # ifconfig -a lo0 : flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 Inet 127.0.0.1 netmask ff000000 e1000g0: flags=1000842<BROADCAST, RUNNING, MULTICAST, IPv4> mtu 1500 index 2 inet 0.0.0.0 netmask 0 ether 0:c:29:91:b1:1e # Comment administrer les routes sous Solaris 10?

To use the route command, Syntax:


# route add [net|host] <Addr> netmask <Mask> [GatewayAddr|-interface ] <metric>

Example: Add a network


# route add net 10.10.10.0 netmask 255.255.255.0 192.168.1.1 1

same as
# route add 10.10.10.0/24 192.168.1.1 1

Add a host
# route add host 1.1.1.1 netmask 255.255.255.0 192.168.1.1 1

same as
# route add 1.1.1.1/24 192.168.1.1 1

To route the traffic through an interface instead of an IP Gateway


# route add 1.1.1.1/24 -interface hme0

To check that the roots are added to Kernel IP Routing table,


# netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface 192.168.1.0 192.168.1.1 U 1 273 hme0 224.0.0.0 192.168.1.1 U 1 0 hme0 default 192.168.1.1 UG 1 196

Static Routes at boot time To make the routes available at boot time so the next time when the server reboots, the routes are still available. Add a startup script named as
/etc/rc2.d/S76static-routes

and add the required route commands as above. Change the permissions for the file so that the file is executable by root.
# chmod 744 /etc/rc2.d/S76static-routes

This should help.

HowTo: Change Default Gateway or Default Router in Sun Solaris ?

The Default Gateway or the Default Router is the IP address (IPv4) to which all the traffic to any target destination(s) which does not have a route in the Routing Table of the server will be forwarded. This Default Gateway is maintained in the file /etc/defaultrouter [IPv4 only] This IP Address should be in the same network or the subnet as that of the server itself. If you wish to add or edit the Default Gateway or the Default Router in Sun Solaris, edit /etc/defaultrouter file and update the IP Address. One entry per line for one or more default gateways (very unlikely to have muktiple default gateways). This file is read at the boot time and hence the server needs to be rebooted for the changes to take effect. Instead of rebooting the server, update the Kernel IP Routing table first by deleting the existing Default Gateway or Default Router (if any) and then adding the new IP address. To view the existing Kernel IP Routing table, # netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface - 192.168.1.0 192.168.1.10 U 1 195 hme0

224.0.0.0 default 127.0.0.1

192.168.1.10 192.168.1.1 127.0.0.1

U UG UH

1 1 5

0 hme0 325 92 lo0

Now, remove the dexisting default gateway; # route delete default 172.1.1.1 Add the new Default Gateway using: # route add default 192.168.1.1 This should help. For a detailed Man Page for /etc/defaultrouter click here.

You might also like