Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Further abbreviate by using ip a and ip l; the show command is the default anyway. –  grawity Nov 23 '11 at 2:02
    
Thanks for the 12.04 update - Its hard to keep up with the subtle changes - my brain is stuck in 2009 –  Jeremy Hajek Jul 22 '12 at 5:12

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.