2

if the format is:

route add -host 192.168.1.20 gw 10.1.1.20 dev eth0:1

I know, It will route 192.168.1.20 to 10.1.1.20

Then, what's the "dev eth0:1" mean?

3

The inclusion of 'dev eth0:1' forces the kernel to use the eth0:1 interface for traffic matching the route specification.

Also in this case, the interface specification is for an alias interface or label configured on eth0.

  • Then, which ip to route to? the question format doesn't inlucde a target IP. – lovespring Mar 1 '16 at 19:36
  • 1
    Not sure what you mean by target IP. The example you gave will route packets addressed to 192.168.1.20 via 10.1.1.20. – Eli Heady Mar 1 '16 at 19:43
0

you have to assign an interface to direct the traffic.

your interface is dev (device) eth0:1 the :1 is a logic id for the interface, cause you can configure multiple networks in an interface.

  • 2
    use of "dev" is optional in both route and its successor ip. If not included, the kernel will determine the most appropriate device based on existing routes and device configurations. – Eli Heady Mar 1 '16 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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