understanding ip route show command on linux
1) What is the meaning of the IP ADDRESS 10.0.2.2 which is shown as the default route ?
That is your default gateway - the next hop packets will be routed to if they don't match a more specific route.
2) Why is that not listed in the output of ifconfig.
ifconfig
doesn't display routing information.
Related videos on Youtube
liv2hak
Updated on September 18, 2022Comments
-
liv2hak over 1 year
I have a Windows 7 PC as host.The network details of my Windows PC are as follows.
IP ADDRESS - 192.168.1.70 DEFAULT GATEWAY - 192.168.1.254
I have installed Virtual Box on Windows 7 and I have an Ubuntu 12.04 Virtual Machine running on the Virtual Box.
When the networking mode for the Virtual Machine is NAT.
The machine has the IP - 10.0.2.15
I am able to ping from VM to Host PC (Windows 7 - 192.168.1.70)
As expected I am not able to ping from my host PC to the Virtual Machine as the VM is in NAT mode.
The output of ip route show on Ubuntu VM (IP 10.0.2.15) is show below.
sudo ip route show default via 10.0.2.2 dev eth0 proto static 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 metric 1 169.254.0.0/16 dev eth0 scope link metric 1000
The output of ifconfig on Ubuntu VM (IP 10.0.2.15) is shown below
eth0 Link encap:Ethernet HWaddr 08:00:27:da:13:5b inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feda:135b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24658 errors:0 dropped:0 overruns:0 frame:0 TX packets:12911 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21780009 (21.7 MB) TX bytes:935844 (935.8 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:234 errors:0 dropped:0 overruns:0 frame:0 TX packets:234 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:39750 (39.7 KB) TX bytes:39750 (39.7 KB)
My question is
1) What is the meaning of the IP ADDRESS 10.0.2.2 which is shown as the default route ?
2) Why is that not listed in the output of ifconfig.
Thanks & Regards, Karthik.
-
EEAA about 11 years
-
-
liv2hak about 11 yearsSo basically what you are saying is that it is the IP address of the Linux Kernel Routing Table.?
-
EEAA about 11 yearsNo, there is no such thing as a Linux Kernel Routing Table IP address.
10.0.2.2
is the IP address of your network's gateway.