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?

2 Answers 2

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.

2
  • Then, which ip to route to? the question format doesn't inlucde a target IP.
    – lovespring
    Commented Mar 1, 2016 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
    Commented Mar 1, 2016 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.

1
  • 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
    Commented Mar 1, 2016 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .