Understanding Routing table entry

前端 未结 3 1113
温柔的废话
温柔的废话 2021-01-30 02:39

I want to ask a question about route command in Linux. I have enter following command in Linux terminal

> route

and got the output:

3条回答
  •  礼貌的吻别
    2021-01-30 03:12

    Let's go through the lines one by one:

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     *               255.255.255.0   U     1      0        0 eth0
    

    This says that any packet with a destination of 192.168.1.0 through 192.168.1.255 will be sent out eth0 without using a gateway (unless a more-specific route overrides this one).

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0
    

    This says that any packet with a destination of 192.168.122.0 through 192.168.122.255 will be sent out virbr0 without using a gateway. (Again, unless a more-specific route overrides this one.)

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    link-local      *               255.255.0.0     U     1000   0        0 eth0
    

    This says that any packet with a link-local address will be sent out interface eth0 with no gateway.

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
    

    This says that any packet to a destination without another route will be sent out eth0, using 192.168.1.1 as a gateway.

提交回复
热议问题