How do I tell ubuntu to send traffic to a single IP through eth6?

1

1

I want to ensure that all IP traffic going to 172.16.60.62 uses eth6. Please provide complete commands because my linux-fu is rusty. The host is running Ubuntu Precise 12.04

user@host:~$ ifconfig eth3
eth3      Link encap:Ethernet  HWaddr 00:e0:81:72:fe:c9  
          inet addr:172.16.60.122  Bcast:172.16.60.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:81ff:fe72:fec9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:128500 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29082 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:67524823 (67.5 MB)  TX bytes:2217634 (2.2 MB)
          Interrupt:71 Base address:0x6000 

user@host:~$ ifconfig eth6
eth6      Link encap:Ethernet  HWaddr 00:60:dd:47:81:35  
          inet addr:172.16.60.61  Bcast:172.16.60.255  Mask:255.255.255.0
          inet6 addr: fe80::260:ddff:fe47:8135/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1
          RX packets:109610 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109388 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10785630 (10.7 MB)  TX bytes:10754350 (10.7 MB)
          Interrupt:70 

user@host:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.60.1     0.0.0.0         UG    0      0        0 eth3
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth6
172.16.60.0     0.0.0.0         255.255.255.0   U     1      0        0 eth6
172.16.60.0     0.0.0.0         255.255.255.0   U     1      0        0 eth3

flashnode

Posted 2011-11-22T15:40:24.953

Reputation: 339

Answers

4

You can add a static route for that specific IP address that sends it wherever you like:

# ip route add 172.16.60.62/32 dev eth6

By the way, "ifconfig" and "route" are deprecated on Linux; you would be better off using "ip":

$ ip address show
$ ip link show
$ ip route show

You can abbreviate those commands to make things quicker. ip a s and so on.

grifferz

Posted 2011-11-22T15:40:24.953

Reputation: 676

Further abbreviate by using ip a and ip l; the show command is the default anyway. – user1686 – 2011-11-23T02:02:14.170

Thanks for the 12.04 update - Its hard to keep up with the subtle changes - my brain is stuck in 2009 – Jeremy Hajek – 2012-07-22T05:12:42.833