0

when i cat the file

/etc/sysconfig/network-scripts/ifcfg-ens192 

a line showing the gateway for ens192:

GATEWAY=10.2.2.2 

but when i run netstat -r or route

Destination Gateway Genmask Flags MSS Window irtt Iface default gateway 0.0.0.0 UG 0 0 0 ens192 10.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 ens192 10.2.3.0 0.0.0.0 255.255.255.0 U 0 0 0 ens256 

Gateway seems to be 0.0.0.0 what is the difference between the two gateway? i am so confused..

4
  • Is there another line in netstat's output that includes 10.2.2.2 ? Commented Sep 5, 2017 at 6:36
  • @MarkPlotnick No, there isnt, ive edit to the full netstat output Commented Sep 5, 2017 at 7:47
  • Can you add -n to the netstat -r command? Commented Sep 5, 2017 at 9:58
  • @Mark Plotnick, the n flag shows gateway as 10.2.2.2! thanks!! Commented Sep 12, 2017 at 3:24

1 Answer 1

2

You misunderstand the meaning of a gateway. You need a gateway for reaching an IP address which is not link-local.

10.2.2.0/255.255.255.0 is link-local thus you do not need a gateway for it. This entry does not show which gateway is used but which interface is used for this subnet.

2
  • so 10.2.2.2 should not appear in route or netstat -r? Commented Sep 5, 2017 at 7:49
  • @once I am not so familiar with route, I always use ip route. I would expect your line default gateway to be default 10.2.2.2. Maybe your entry GATEWAY=10.2.2.2 is wrong somehow and thus not accepted as default gateway. Commented Sep 5, 2017 at 8:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.