Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Given the following output from ifconfig, I would like all outgoing traffic to come from bond1:1 instead of the default bond1 interface, how would I go about accomplishing this?

bond1     Link encap:Ethernet  HWaddr 00:25:90:2a:db:6f
      inet addr:15.23.88.181  Bcast:15.23.88.183  Mask:255.255.255.248
      inet6 addr: fe80::225:90ff:fe2a:db6f/64 Scope:Link
      UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
      RX packets:1714059 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1342213 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:159624075 (159.6 MB)  TX bytes:397807364 (397.8 MB)

bond1:1   Link encap:Ethernet  HWaddr 00:25:90:2a:db:6f
      inet addr:15.23.72.200  Bcast:15.255.255.255  Mask:255.255.255.255
      UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

bond1:2   Link encap:Ethernet  HWaddr 00:25:90:2a:db:6f
      inet addr:15.23.72.201  Bcast:15.255.255.255  Mask:255.255.255.255
      UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1



root@service:/etc/nginx/sites-enabled# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
15.23.88.176    0.0.0.0         255.255.255.248 U     0      0        0 bond1
10.54.22.192    0.0.0.0         255.255.255.192 U     0      0        0 bond0
10.0.0.0        10.54.22.193    255.0.0.0       UG    0      0        0 bond0
0.0.0.0         15.23.88.177    0.0.0.0         UG    100    0        0 bond1


/etc/network/interfaces

auto bond1
iface bond1 inet static
pre-up /usr/sbin/ethtool -s bond1 speed 1000 duplex full autoneg on
post-up ifenslave bond1 eth1 eth3
pre-down ifenslave -d bond1 eth1 eth3
bond-slaves none
bond-mode 4
bond-miimon 100
bond-downdelay 0
bond-updelay 0
bond-lacp-rate fast
bond-xmit_hash_policy 1
address 15.23.88.181
netmask 255.255.255.248
gateway 15.23.88.177

auto bond1:1
iface bond1:1 inet static
address 15.23.72.200
netmask 255.255.255.255

auto bond1:2
iface bond1:2 inet static
address 15.23.72.201
netmask 255.255.255.255

I am using Ubuntu, any help would be appreciated.

share|improve this question
    
When you say come from, you mean that you want the source IP of the packets generated from your host to have the IP associated with bond1:1 right? –  Zoredache Jul 7 '11 at 22:37
    
Yes. Sorry, I realized that wasn't very clear after posting. –  Michael Jul 7 '11 at 22:40
    
Your computer is configured to use the 15.23.88.177 gateway. Unless that router (or another) has a route configured to route 15.23.72.200 through your computer (15.23.88.188), it is unlikely that any host will be able to communicate with yours with this configuration. How certain are you that this is what you need? –  Slartibartfast Jul 8 '11 at 2:00

1 Answer 1

up vote 1 down vote accepted

Add to /etc/network/interfaces under bond1:

post-up /sbin/ip route add default via 15.23.88.177 dev bond1 src 15.23.72.200

share|improve this answer
    
Thank you, that was exactly what I wanted. –  Michael Jul 11 '11 at 5:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.