troubleshooting Question

How to manipulate the source address to use if there is more than one address in NIC

Avatar of chumotan
chumotan asked on
Unix OS
6 Comments1 Solution519 ViewsLast Modified:
i have a sun machine with two NICs. One NIC have four IP address.
# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.140.22.13 netmask ffffff00 broadcast 10.140.22.255
        ether 0:14:4f:a9:d2:c4
bge0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.140.22.16 netmask ffffff00 broadcast 10.140.22.255
bge0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.140.22.17 netmask ffffff00 broadcast 10.140.22.255
bge0:3: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.140.22.26 netmask ffffff00 broadcast 10.140.22.255
bge1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 10.7.0.26 netmask ff000000 broadcast 10.255.255.255
        ether 0:14:4f:a9:d2:c5


i have different IP address on the same network interface. i have a program which receive a packet from an address 10.140.22.30, the program response to the packet with the source address 10.140.22.26.
However, i would like to use the source address 10.140.22.13 to response. i dump the route table below and don't know whether i can change the metric to force to use 10.140.22.13?
Please suggest the command to check metric and change the metric.

# netstat -rn

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
10.140.14.0          10.140.22.254        UG        1     67
10.140.22.0          10.140.22.16         U         1     83  bge0:1
10.140.22.0          10.140.22.17         U         1      0  bge0:2
10.140.22.0          10.140.22.26         U         1      0  bge0:3
10.140.22.0          10.140.22.13         U         1      0  bge0
10.140.18.0          10.140.22.254        UG        1     63
10.140.16.0          10.140.22.254        UG        1     52
10.0.0.0             10.7.0.26            U         1   7192  bge1
224.0.0.0            10.140.22.13         U         1      0  bge0
default              10.140.22.254        UG        1      0
127.0.0.1            127.0.0.1            UH        4  96931  lo0

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros